summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_uninstaller.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-30 13:01:35 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-30 13:01:35 +0000
commit8da8d4b043c37b53a69803c71ff36b478d4776d0 (patch)
tree7c8cec15645e74f19c88e4eb5b210b96174c7d03 /test/rubygems/test_gem_uninstaller.rb
parentc5cb386eba6d9a2d9a8e6ffa8c30137d0c4660c1 (diff)
Merge RubyGems 3.0.0.beta1.
* It drop to support < Ruby 2.2 * Cleanup deprecated methods and classes. * Mark obsoleted methods to deprecate. * and other enhancements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_uninstaller.rb')
-rw-r--r--test/rubygems/test_gem_uninstaller.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb
index d005130895..a53526c0bc 100644
--- a/test/rubygems/test_gem_uninstaller.rb
+++ b/test/rubygems/test_gem_uninstaller.rb
@@ -177,10 +177,12 @@ class TestGemUninstaller < Gem::InstallerTestCase
gem_dir = File.join @gemhome, 'gems', @spec.full_name
Gem.pre_uninstall do
+ sleep(0.1) if win_platform?
assert File.exist?(gem_dir), 'gem_dir should exist'
end
Gem.post_uninstall do
+ sleep(0.1) if win_platform?
refute File.exist?(gem_dir), 'gem_dir should not exist'
end
@@ -212,7 +214,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
default_spec = new_default_spec 'default', '2'
install_default_gems default_spec
- spec = new_spec 'default', '2'
+ spec = util_spec 'default', '2'
install_gem spec
Gem::Specification.reset
@@ -482,4 +484,22 @@ create_makefile '#{@spec.name}'
assert_match %r!r-1 depends on q \(= 1, development\)!, lines.shift
assert_match %r!Successfully uninstalled q-1!, lines.last
end
+
+ def test_uninstall_no_permission
+ uninstaller = Gem::Uninstaller.new @spec.name, :executables => true
+
+ stub_rm_r = lambda do |*args|
+ _path = args.shift
+ options = args.shift || Hash.new
+ # Uninstaller calls a method in RDoc which also calls FileUtils.rm_rf which
+ # is an alias for FileUtils#rm_r, so skip if we're using the force option
+ raise Errno::EPERM unless options[:force]
+ end
+
+ FileUtils.stub :rm_r, stub_rm_r do
+ assert_raises Gem::UninstallError do
+ uninstaller.uninstall
+ end
+ end
+ end
end