diff options
Diffstat (limited to 'spec/ruby/language/private_spec.rb')
| -rw-r--r-- | spec/ruby/language/private_spec.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/ruby/language/private_spec.rb b/spec/ruby/language/private_spec.rb index ddf185e6d2..94b56fee5b 100644 --- a/spec/ruby/language/private_spec.rb +++ b/spec/ruby/language/private_spec.rb @@ -4,12 +4,12 @@ require_relative 'fixtures/private' describe "The private keyword" do it "marks following methods as being private" do a = Private::A.new - a.methods.should_not include(:bar) - -> { a.bar }.should raise_error(NoMethodError) + a.methods.should_not.include?(:bar) + -> { a.bar }.should.raise(NoMethodError) b = Private::B.new - b.methods.should_not include(:bar) - -> { b.bar }.should raise_error(NoMethodError) + b.methods.should_not.include?(:bar) + -> { b.bar }.should.raise(NoMethodError) end # def expr.meth() methods are always public @@ -19,22 +19,22 @@ describe "The private keyword" do it "is overridden when a new class is opened" do c = Private::B::C.new - c.methods.should include(:baz) + c.methods.should.include?(:baz) c.baz Private::B.public_class_method1.should == 1 - -> { Private::B.private_class_method1 }.should raise_error(NoMethodError) + -> { Private::B.private_class_method1 }.should.raise(NoMethodError) end it "is no longer in effect when the class is closed" do b = Private::B.new - b.methods.should include(:foo) + b.methods.should.include?(:foo) b.foo end it "changes visibility of previously called method" do klass = Class.new do def foo - "foo" + "foo" end end f = klass.new @@ -42,7 +42,7 @@ describe "The private keyword" do klass.class_eval do private :foo end - -> { f.foo }.should raise_error(NoMethodError) + -> { f.foo }.should.raise(NoMethodError) end it "changes visibility of previously called methods with same send/call site" do @@ -56,12 +56,12 @@ describe "The private keyword" do end end end - }.should raise_error(NoMethodError) + }.should.raise(NoMethodError) end it "changes the visibility of the existing method in the subclass" do ::Private::A.new.foo.should == 'foo' - -> { ::Private::H.new.foo }.should raise_error(NoMethodError) + -> { ::Private::H.new.foo }.should.raise(NoMethodError) ::Private::H.new.send(:foo).should == 'foo' end end |
