2011-01-18 19:08:49 -05:00
|
|
|
######################################################################
|
|
|
|
# This file is imported from the rubygems project.
|
|
|
|
# DO NOT make modifications in this repo. They _will_ be reverted!
|
|
|
|
# File a patch instead and assign it to Ryan Davis or Eric Hodel.
|
|
|
|
######################################################################
|
|
|
|
|
2011-01-28 18:46:47 -05:00
|
|
|
require 'rubygems/test_case'
|
2007-11-10 02:48:56 -05:00
|
|
|
require 'rubygems/doc_manager'
|
|
|
|
|
2011-01-28 18:46:47 -05:00
|
|
|
class TestGemDocManager < Gem::TestCase
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
|
|
|
|
2011-03-07 03:44:45 -05:00
|
|
|
@spec = quick_gem 'a', 2
|
2007-11-10 02:48:56 -05:00
|
|
|
@manager = Gem::DocManager.new(@spec)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_uninstall_doc_unwritable
|
2011-03-07 03:44:45 -05:00
|
|
|
path = @spec.installation_path
|
|
|
|
orig_mode = File.stat(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
|
2011-03-07 03:44:45 -05:00
|
|
|
File.chmod 0000, path
|
2009-06-09 17:38:59 -04:00
|
|
|
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
|
2011-03-07 03:44:45 -05:00
|
|
|
File.chmod orig_mode, path
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|