summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_setup_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_commands_setup_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index bab2707ef5..e0a6c0c94c 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -28,6 +28,10 @@ class TestGemCommandsSetupCommand < Gem::TestCase
bundler/exe/bundle
bundler/lib/bundler.rb
bundler/lib/bundler/b.rb
+ bundler/man/bundle-b.1
+ bundler/man/bundle-b.1.txt
+ bundler/man/gemfile.5
+ bundler/man/gemfile.5.txt
]
create_dummy_files(filelist)
@@ -159,6 +163,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.rb_files_in('lib').sort
end
+ def test_bundler_man1_files_in
+ assert_equal %w[bundle-b.1 bundle-b.1.txt],
+ @cmd.bundler_man1_files_in('bundler/man').sort
+ end
+
+ def test_bundler_man5_files_in
+ assert_equal %w[gemfile.5 gemfile.5.txt],
+ @cmd.bundler_man5_files_in('bundler/man').sort
+ end
+
def test_install_lib
@cmd.extend FileUtils
@@ -173,6 +187,19 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
end
+ def test_install_man
+ @cmd.extend FileUtils
+
+ Dir.mktmpdir 'man' do |dir|
+ @cmd.install_man dir
+
+ assert_path_exists File.join("#{dir}/man1", 'bundle-b.1')
+ assert_path_exists File.join("#{dir}/man1", 'bundle-b.1.txt')
+ assert_path_exists File.join("#{dir}/man5", 'gemfile.5')
+ assert_path_exists File.join("#{dir}/man5", 'gemfile.5.txt')
+ end
+ end
+
def test_install_default_bundler_gem
@cmd.extend FileUtils
@@ -266,6 +293,29 @@ class TestGemCommandsSetupCommand < Gem::TestCase
files_that_stay.each {|file| assert_path_exists file }
end
+ def test_remove_old_man_files
+ man = File.join @install_dir, 'man'
+
+ ruby_1 = File.join man, 'man1', 'ruby.1'
+ bundle_b_1 = File.join man, 'man1', 'bundle-b.1'
+ bundle_b_1_txt = File.join man, 'man1', 'bundle-b.1.txt'
+ bundle_old_b_1 = File.join man, 'man1', 'bundle-old_b.1'
+ bundle_old_b_1_txt = File.join man, 'man1', 'bundle-old_b.1.txt'
+ gemfile_5 = File.join man, 'man5', 'gemfile.5'
+ gemfile_5_txt = File.join man, 'man5', 'gemfile.5.txt'
+
+ files_that_go = [bundle_old_b_1, bundle_old_b_1_txt]
+ files_that_stay = [ruby_1, bundle_b_1, bundle_b_1_txt, gemfile_5, gemfile_5_txt]
+
+ create_dummy_files(files_that_go + files_that_stay)
+
+ @cmd.remove_old_man_files man
+
+ files_that_go.each {|file| refute_path_exists file }
+
+ files_that_stay.each {|file| assert_path_exists file }
+ end
+
def test_show_release_notes
@default_external = @ui.outs.external_encoding
@ui.outs.set_encoding Encoding::US_ASCII