1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rubygems/test_gem_uninstaller.rb
mame 498324c5d3 * lib/test/unit/ui/console/testrunner.rb: prevent destructive modification to $0.
* test/rubygems/gemutilities.rb (build_rake_in): move from test_gem_ext_rake_builder.rb.

* test/rubygems/test_gem_ext_rake_builder.rb: ditto.

* test/rubygems/test_gem_installer.rb: override Gem.ruby and ENV["rake"].

* test/rubygems/test_gem_uninstaller.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 12:33:11 +00:00

66 lines
1.5 KiB
Ruby

require File.join(File.expand_path(File.dirname(__FILE__)),
'gem_installer_test_case')
require 'rubygems/uninstaller'
class TestGemUninstaller < GemInstallerTestCase
def setup
super
ui = MockGemUi.new
util_setup_gem ui
build_rake_in do
use_ui ui do
@installer.install
end
end
end
def test_initialize_expand_path
uninstaller = Gem::Uninstaller.new nil, :install_dir => '/foo//bar'
assert_match %r|/foo/bar$|, uninstaller.instance_variable_get(:@gem_home)
end
def test_remove_executables_force_keep
uninstaller = Gem::Uninstaller.new nil, :executables => false
use_ui @ui do
uninstaller.remove_executables @spec
end
assert_equal true, File.exist?(File.join(@gemhome, 'bin', 'executable'))
assert_equal "Executables and scripts will remain installed.\n", @ui.output
end
def test_remove_executables_force_remove
uninstaller = Gem::Uninstaller.new nil, :executables => true
use_ui @ui do
uninstaller.remove_executables @spec
end
assert_equal "Removing executable\n", @ui.output
assert_equal false, File.exist?(File.join(@gemhome, 'bin', 'executable'))
end
def test_path_ok_eh
uninstaller = Gem::Uninstaller.new nil
assert_equal true, uninstaller.path_ok?(@spec)
end
def test_path_ok_eh_legacy
uninstaller = Gem::Uninstaller.new nil
@spec.loaded_from.gsub! @spec.full_name, '\&-legacy'
@spec.platform = 'legacy'
assert_equal true, uninstaller.path_ok?(@spec)
end
end