~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to test/rubygems/test_gem_doc_manager.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2011-09-24 19:16:17 UTC
  • mfrom: (1.1.8 upstream) (13.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110924191617-o1qz4rcmqjot8zuy
Tags: 1.9.3~rc1-1
* New upstream release: 1.9.3 RC1.
  + Includes load.c fixes. Closes: #639959.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require_relative 'gemutilities'
 
1
require 'rubygems/test_case'
2
2
require 'rubygems/doc_manager'
3
3
 
4
 
class TestGemDocManager < RubyGemTestCase
 
4
class TestGemDocManager < Gem::TestCase
5
5
 
6
6
  def setup
7
7
    super
8
8
 
9
 
    @spec = quick_gem 'a'
 
9
    @spec = quick_gem 'a', 2
10
10
    @manager = Gem::DocManager.new(@spec)
11
11
  end
12
12
 
13
13
  def test_uninstall_doc_unwritable
14
 
    orig_mode = File.stat(@spec.installation_path).mode
 
14
    path = @spec.base_dir
 
15
    orig_mode = File.stat(path).mode
15
16
 
16
17
    # File.chmod has no effect on MS Windows directories (it needs ACL).
17
18
    if win_platform?
18
19
      skip("test_uninstall_doc_unwritable skipped on MS Windows")
19
20
    else
20
 
      File.chmod(0, @spec.installation_path)
 
21
      FileUtils.chmod 0000, path
21
22
    end
22
23
 
23
24
    assert_raises Gem::FilePermissionError do
24
25
      @manager.uninstall_doc
25
26
    end
26
27
  ensure
27
 
    File.chmod orig_mode, @spec.installation_path
 
28
    FileUtils.chmod orig_mode, path
28
29
  end
29
30
 
30
31
end