diff options
Diffstat (limited to 'test/rubygems/test_gem_uninstaller.rb')
-rw-r--r-- | test/rubygems/test_gem_uninstaller.rb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb index 9d42d9bcde..3925ab1a63 100644 --- a/test/rubygems/test_gem_uninstaller.rb +++ b/test/rubygems/test_gem_uninstaller.rb @@ -4,31 +4,28 @@ # File a patch instead and assign it to Ryan Davis or Eric Hodel. ###################################################################### -require "test/rubygems/gem_installer_test_case" +require 'rubygems/installer_test_case' require 'rubygems/uninstaller' -class TestGemUninstaller < GemInstallerTestCase +class TestGemUninstaller < Gem::InstallerTestCase def setup super - ui = MockGemUi.new - util_setup_gem ui - @user_spec.executables = ["my_exec"] # HACK util_make_exec user_bin_dir = File.join Gem.user_dir, 'gems', @user_spec.full_name, 'bin' FileUtils.mkdir_p user_bin_dir exec_path = File.join user_bin_dir, "my_exec" - File.open exec_path, 'w' do |f| + open exec_path, 'w' do |f| f.puts "#!/usr/bin/ruby" end user_bin_dir = File.join Gem.user_dir, 'bin' FileUtils.mkdir_p user_bin_dir exec_path = File.join user_bin_dir, "my_exec" - File.open exec_path, 'w' do |f| + open exec_path, 'w' do |f| f.puts "#!/usr/bin/ruby" end @@ -50,11 +47,14 @@ class TestGemUninstaller < GemInstallerTestCase def test_remove_executables_force_keep uninstaller = Gem::Uninstaller.new nil, :executables => false + executable = File.join Gem.user_dir, 'bin', 'my_exec' + assert File.exist? executable + use_ui @ui do - uninstaller.remove_executables @spec + uninstaller.remove_executables @user_spec end - assert_equal true, File.exist?(File.join(@gemhome, 'bin', 'executable')) + assert File.exist? executable assert_equal "Executables and scripts will remain installed.\n", @ui.output end @@ -62,13 +62,16 @@ class TestGemUninstaller < GemInstallerTestCase def test_remove_executables_force_remove uninstaller = Gem::Uninstaller.new nil, :executables => true + executable = File.join Gem.user_dir, 'bin', 'my_exec' + assert File.exist? executable + use_ui @ui do - uninstaller.remove_executables @spec + uninstaller.remove_executables @user_spec end - assert_equal "Removing executable\n", @ui.output + assert_equal "Removing my_exec\n", @ui.output - assert_equal false, File.exist?(File.join(@gemhome, 'bin', 'executable')) + refute File.exist? executable end def test_remove_executables_user |