2009-10-03 11:59:29 -04:00
|
|
|
require_relative 'gemutilities'
|
2007-11-10 02:48:56 -05:00
|
|
|
require 'rubygems/doc_manager'
|
|
|
|
|
|
|
|
class TestGemDocManager < RubyGemTestCase
|
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
|
|
|
|
|
|
|
@spec = quick_gem 'a'
|
|
|
|
@manager = Gem::DocManager.new(@spec)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_uninstall_doc_unwritable
|
|
|
|
orig_mode = File.stat(@spec.installation_path).mode
|
2009-12-08 02:19:09 -05:00
|
|
|
|
2009-06-09 17:38:59 -04:00
|
|
|
# File.chmod has no effect on MS Windows directories (it needs ACL).
|
|
|
|
if win_platform?
|
|
|
|
skip("test_uninstall_doc_unwritable skipped on MS Windows")
|
|
|
|
else
|
|
|
|
File.chmod(0, @spec.installation_path)
|
|
|
|
end
|
2007-11-10 02:48:56 -05:00
|
|
|
|
2008-10-25 18:58:43 -04:00
|
|
|
assert_raises Gem::FilePermissionError do
|
2007-11-10 02:48:56 -05:00
|
|
|
@manager.uninstall_doc
|
|
|
|
end
|
|
|
|
ensure
|
|
|
|
File.chmod orig_mode, @spec.installation_path
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|