diff options
Diffstat (limited to 'spec/ruby/library/delegate/delegate_class')
6 files changed, 43 insertions, 42 deletions
diff --git a/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb b/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb index 61680b9d5a..19ffc4cf85 100644 --- a/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb +++ b/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../../../spec_helper' +require_relative '../fixtures/classes' describe "DelegateClass.instance_method" do before :all do @@ -9,44 +9,44 @@ describe "DelegateClass.instance_method" do it "returns a method object for public instance methods of the delegated class" do m = @klass.instance_method(:pub) - m.should be_an_instance_of(UnboundMethod) + m.should.instance_of?(UnboundMethod) m.bind(@obj).call.should == :foo end it "returns a method object for protected instance methods of the delegated class" do m = @klass.instance_method(:prot) - m.should be_an_instance_of(UnboundMethod) + m.should.instance_of?(UnboundMethod) m.bind(@obj).call.should == :protected end it "raises a NameError for a private instance methods of the delegated class" do - lambda { + -> { @klass.instance_method(:priv) - }.should raise_error(NameError) + }.should.raise(NameError) end it "returns a method object for public instance methods of the DelegateClass class" do m = @klass.instance_method(:extra) - m.should be_an_instance_of(UnboundMethod) + m.should.instance_of?(UnboundMethod) m.bind(@obj).call.should == :cheese end it "returns a method object for protected instance methods of the DelegateClass class" do m = @klass.instance_method(:extra_protected) - m.should be_an_instance_of(UnboundMethod) + m.should.instance_of?(UnboundMethod) m.bind(@obj).call.should == :baz end it "returns a method object for private instance methods of the DelegateClass class" do m = @klass.instance_method(:extra_private) - m.should be_an_instance_of(UnboundMethod) + m.should.instance_of?(UnboundMethod) m.bind(@obj).call.should == :bar end it "raises a NameError for an invalid method name" do - lambda { + -> { @klass.instance_method(:invalid_and_silly_method_name) - }.should raise_error(NameError) + }.should.raise(NameError) end end diff --git a/spec/ruby/library/delegate/delegate_class/instance_methods_spec.rb b/spec/ruby/library/delegate/delegate_class/instance_methods_spec.rb index ae329ab8eb..586be56cae 100644 --- a/spec/ruby/library/delegate/delegate_class/instance_methods_spec.rb +++ b/spec/ruby/library/delegate/delegate_class/instance_methods_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../../../spec_helper' +require_relative '../fixtures/classes' describe "DelegateClass.instance_methods" do before :all do @@ -7,20 +7,20 @@ describe "DelegateClass.instance_methods" do end it "includes all public methods of the delegated class" do - @methods.should include :pub + @methods.should.include? :pub end it "includes all protected methods of the delegated class" do - @methods.should include :prot + @methods.should.include? :prot end it "includes instance methods of the DelegateClass class" do - @methods.should include :extra - @methods.should include :extra_protected + @methods.should.include? :extra + @methods.should.include? :extra_protected end it "does not include private methods" do - @methods.should_not include :priv - @methods.should_not include :extra_private + @methods.should_not.include? :priv + @methods.should_not.include? :extra_private end end diff --git a/spec/ruby/library/delegate/delegate_class/private_instance_methods_spec.rb b/spec/ruby/library/delegate/delegate_class/private_instance_methods_spec.rb index d93b6d0e3d..18ca2a4c88 100644 --- a/spec/ruby/library/delegate/delegate_class/private_instance_methods_spec.rb +++ b/spec/ruby/library/delegate/delegate_class/private_instance_methods_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../../../spec_helper' +require_relative '../fixtures/classes' describe "DelegateClass.private_instance_methods" do before :all do @@ -7,17 +7,17 @@ describe "DelegateClass.private_instance_methods" do end it "does not include any instance methods of the delegated class" do - @methods.should_not include :pub - @methods.should_not include :prot - @methods.should_not include :priv # since these are not forwarded... + @methods.should_not.include? :pub + @methods.should_not.include? :prot + @methods.should_not.include? :priv # since these are not forwarded... end it "includes private instance methods of the DelegateClass class" do - @methods.should include :extra_private + @methods.should.include? :extra_private end it "does not include public or protected instance methods of the DelegateClass class" do - @methods.should_not include :extra - @methods.should_not include :extra_protected + @methods.should_not.include? :extra + @methods.should_not.include? :extra_protected end end diff --git a/spec/ruby/library/delegate/delegate_class/protected_instance_methods_spec.rb b/spec/ruby/library/delegate/delegate_class/protected_instance_methods_spec.rb index 3ae0270dbd..d540b45065 100644 --- a/spec/ruby/library/delegate/delegate_class/protected_instance_methods_spec.rb +++ b/spec/ruby/library/delegate/delegate_class/protected_instance_methods_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../../../spec_helper' +require_relative '../fixtures/classes' describe "DelegateClass.protected_instance_methods" do before :all do @@ -7,23 +7,23 @@ describe "DelegateClass.protected_instance_methods" do end it "does not include public methods of the delegated class" do - @methods.should_not include :pub + @methods.should_not.include? :pub end it "includes the protected methods of the delegated class" do - @methods.should include :prot + @methods.should.include? :prot end it "includes protected instance methods of the DelegateClass class" do - @methods.should include :extra_protected + @methods.should.include? :extra_protected end it "does not include public instance methods of the DelegateClass class" do - @methods.should_not include :extra + @methods.should_not.include? :extra end it "does not include private methods" do - @methods.should_not include :priv - @methods.should_not include :extra_private + @methods.should_not.include? :priv + @methods.should_not.include? :extra_private end end diff --git a/spec/ruby/library/delegate/delegate_class/public_instance_methods_spec.rb b/spec/ruby/library/delegate/delegate_class/public_instance_methods_spec.rb index e06b55612e..124b92de82 100644 --- a/spec/ruby/library/delegate/delegate_class/public_instance_methods_spec.rb +++ b/spec/ruby/library/delegate/delegate_class/public_instance_methods_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../../fixtures/classes', __FILE__) +require_relative '../../../spec_helper' +require_relative '../fixtures/classes' describe "DelegateClass.public_instance_methods" do before :all do @@ -7,19 +7,19 @@ describe "DelegateClass.public_instance_methods" do end it "includes all public methods of the delegated class" do - @methods.should include :pub + @methods.should.include? :pub end it "does not include the protected methods of the delegated class" do - @methods.should_not include :prot + @methods.should_not.include? :prot end it "includes public instance methods of the DelegateClass class" do - @methods.should include :extra + @methods.should.include? :extra end it "does not include private methods" do - @methods.should_not include :priv - @methods.should_not include :extra_private + @methods.should_not.include? :priv + @methods.should_not.include? :extra_private end end diff --git a/spec/ruby/library/delegate/delegate_class/respond_to_missing_spec.rb b/spec/ruby/library/delegate/delegate_class/respond_to_missing_spec.rb index 729cfc96c6..3975e5208b 100644 --- a/spec/ruby/library/delegate/delegate_class/respond_to_missing_spec.rb +++ b/spec/ruby/library/delegate/delegate_class/respond_to_missing_spec.rb @@ -1,3 +1,4 @@ +require_relative "../../../spec_helper" require 'delegate' describe "DelegateClass#respond_to_missing?" do |
