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-05-31 23:45:05 -04:00
|
|
|
path = @spec.base_dir
|
2011-03-07 03:44:45 -05:00
|
|
|
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-05-31 23:45:05 -04:00
|
|
|
FileUtils.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-05-31 23:45:05 -04:00
|
|
|
FileUtils.chmod orig_mode, path
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|