public
Description: RSpec-style specification for the Ruby programming language
Homepage: http://rubyspec.org
Clone URL: git://github.com/brixen/rubyspec.git
commit  3722b9e624d7bbf62c378b8d4ac92b4b90e8d43a
tree    b84a3bea605481cd72eed0ed64d1e565d06b549e
parent  799fd9dc4e9b6d731d4d789687ee46d2949c3270 parent  7d2e72fbd3342412f2a2e48de859423a519604cd
rubyspec / 1.8 / core / module / protected_spec.rb
100644 24 lines (16 sloc) 0.542 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
 
describe "Module#protected" do
  
  before :each do
    class << ModuleSpecs::Parent
      def protected_method_1; 5; end
    end
  end
  
  it "makes an existing class method protected" do
    ModuleSpecs::Parent.protected_method_1.should == 5
    
    class << ModuleSpecs::Parent
      protected :protected_method_1
    end
    
    lambda { ModuleSpecs::Parent.protected_method_1 }.should raise_error(NoMethodError)
  end
  
end