diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-04-26 13:26:21 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-04-28 11:07:45 +0900 |
commit | d0a54673202458455244f79ed212a97727f0c7c7 (patch) | |
tree | 4d984b9e2675d906b3e336c7f951f03b11316546 /test/rubygems/test_gem_uninstaller.rb | |
parent | a15f7dd1fb1148c3d586238ee6907875f2e40379 (diff) | |
download | ruby-d0a54673202458455244f79ed212a97727f0c7c7.tar.gz |
Update rubygems with latest upstream changes
Closes: https://github.com/ruby/ruby/pull/2154
Diffstat (limited to 'test/rubygems/test_gem_uninstaller.rb')
-rw-r--r-- | test/rubygems/test_gem_uninstaller.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb index 126011be99..7440ca0191 100644 --- a/test/rubygems/test_gem_uninstaller.rb +++ b/test/rubygems/test_gem_uninstaller.rb @@ -22,9 +22,10 @@ class TestGemUninstaller < Gem::InstallerTestCase end def test_initialize_expand_path - uninstaller = Gem::Uninstaller.new nil, :install_dir => '/foo//bar' + FileUtils.mkdir_p 'foo/bar' + uninstaller = Gem::Uninstaller.new nil, :install_dir => 'foo//bar' - assert_match %r|/foo/bar$|, uninstaller.instance_variable_get(:@gem_home) + assert_match %r|foo/bar$|, uninstaller.instance_variable_get(:@gem_home) end def test_ask_if_ok @@ -133,6 +134,7 @@ class TestGemUninstaller < Gem::InstallerTestCase end def test_remove_not_in_home + Dir.mkdir "#{@gemhome}2" uninstaller = Gem::Uninstaller.new nil, :install_dir => "#{@gemhome}2" e = assert_raises Gem::GemNotInHomeException do @@ -149,6 +151,22 @@ class TestGemUninstaller < Gem::InstallerTestCase assert_path_exists @spec.gem_dir end + def test_remove_symlinked_gem_home + Dir.mktmpdir("gem_home") do |dir| + symlinked_gem_home = "#{dir}/#{File.basename(@gemhome)}" + + FileUtils.ln_s(@gemhome, dir) + + uninstaller = Gem::Uninstaller.new nil, :install_dir => symlinked_gem_home + + use_ui ui do + uninstaller.remove @spec + end + + refute_path_exists @spec.gem_dir + end + end + def test_path_ok_eh uninstaller = Gem::Uninstaller.new nil @@ -313,6 +331,7 @@ create_makefile '#{@spec.name}' end def test_uninstall_wrong_repo + Dir.mkdir "#{@gemhome}2" Gem.use_paths "#{@gemhome}2", [@gemhome] uninstaller = Gem::Uninstaller.new @spec.name, :executables => true |