summaryrefslogtreecommitdiff
path: root/spec/ruby/library/delegate
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/delegate')
-rw-r--r--spec/ruby/library/delegate/delegate_class/instance_method_spec.rb14
-rw-r--r--spec/ruby/library/delegate/delegate_class/instance_methods_spec.rb12
-rw-r--r--spec/ruby/library/delegate/delegate_class/private_instance_methods_spec.rb12
-rw-r--r--spec/ruby/library/delegate/delegate_class/protected_instance_methods_spec.rb12
-rw-r--r--spec/ruby/library/delegate/delegate_class/public_instance_methods_spec.rb10
-rw-r--r--spec/ruby/library/delegate/delegate_class/respond_to_missing_spec.rb1
-rw-r--r--spec/ruby/library/delegate/delegator/eql_spec.rb8
-rw-r--r--spec/ruby/library/delegate/delegator/equal_spec.rb6
-rw-r--r--spec/ruby/library/delegate/delegator/equal_value_spec.rb6
-rw-r--r--spec/ruby/library/delegate/delegator/frozen_spec.rb14
-rw-r--r--spec/ruby/library/delegate/delegator/marshal_spec.rb2
-rw-r--r--spec/ruby/library/delegate/delegator/method_spec.rb18
-rw-r--r--spec/ruby/library/delegate/delegator/methods_spec.rb14
-rw-r--r--spec/ruby/library/delegate/delegator/not_equal_spec.rb6
-rw-r--r--spec/ruby/library/delegate/delegator/private_methods_spec.rb8
-rw-r--r--spec/ruby/library/delegate/delegator/protected_methods_spec.rb4
-rw-r--r--spec/ruby/library/delegate/delegator/public_methods_spec.rb4
-rw-r--r--spec/ruby/library/delegate/delegator/send_spec.rb8
-rw-r--r--spec/ruby/library/delegate/delegator/tap_spec.rb2
19 files changed, 81 insertions, 80 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 16bf8d734c..19ffc4cf85 100644
--- a/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb
+++ b/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb
@@ -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
-> {
@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
-> {
@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 6012ff72de..586be56cae 100644
--- a/spec/ruby/library/delegate/delegate_class/instance_methods_spec.rb
+++ b/spec/ruby/library/delegate/delegate_class/instance_methods_spec.rb
@@ -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 06b2115cc5..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
@@ -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 ac6659ec1e..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
@@ -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 6c0d9bcab1..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
@@ -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
diff --git a/spec/ruby/library/delegate/delegator/eql_spec.rb b/spec/ruby/library/delegate/delegator/eql_spec.rb
index 34f56f44c9..b302bb7016 100644
--- a/spec/ruby/library/delegate/delegator/eql_spec.rb
+++ b/spec/ruby/library/delegate/delegator/eql_spec.rb
@@ -6,14 +6,14 @@ describe "Delegator#eql?" do
base = mock('base')
delegator = DelegateSpecs::Delegator.new(base)
- delegator.eql?(delegator).should be_true
+ delegator.eql?(delegator).should == true
end
it "returns true when compared with the inner object" do
base = mock('base')
delegator = DelegateSpecs::Delegator.new(base)
- delegator.eql?(base).should be_true
+ delegator.eql?(base).should == true
end
it "returns false when compared with the delegator with other object" do
@@ -22,7 +22,7 @@ describe "Delegator#eql?" do
delegator0 = DelegateSpecs::Delegator.new(base)
delegator1 = DelegateSpecs::Delegator.new(other)
- delegator0.eql?(delegator1).should be_false
+ delegator0.eql?(delegator1).should == false
end
it "returns false when compared with the other object" do
@@ -30,6 +30,6 @@ describe "Delegator#eql?" do
other = mock('other')
delegator = DelegateSpecs::Delegator.new(base)
- delegator.eql?(other).should be_false
+ delegator.eql?(other).should == false
end
end
diff --git a/spec/ruby/library/delegate/delegator/equal_spec.rb b/spec/ruby/library/delegate/delegator/equal_spec.rb
index c8711c74b5..97aabebabe 100644
--- a/spec/ruby/library/delegate/delegator/equal_spec.rb
+++ b/spec/ruby/library/delegate/delegator/equal_spec.rb
@@ -6,8 +6,8 @@ describe "Delegator#equal?" do
obj = mock('base')
delegator = DelegateSpecs::Delegator.new(obj)
obj.should_not_receive(:equal?)
- delegator.equal?(obj).should be_false
- delegator.equal?(nil).should be_false
- delegator.equal?(delegator).should be_true
+ delegator.equal?(obj).should == false
+ delegator.equal?(nil).should == false
+ delegator.equal?(delegator).should == true
end
end
diff --git a/spec/ruby/library/delegate/delegator/equal_value_spec.rb b/spec/ruby/library/delegate/delegator/equal_value_spec.rb
index 0c967d5f94..d70aad1e03 100644
--- a/spec/ruby/library/delegate/delegator/equal_value_spec.rb
+++ b/spec/ruby/library/delegate/delegator/equal_value_spec.rb
@@ -9,16 +9,16 @@ describe "Delegator#==" do
it "is not delegated when passed self" do
@base.should_not_receive(:==)
- (@delegator == @delegator).should be_true
+ (@delegator == @delegator).should == true
end
it "is delegated when passed the delegated object" do
@base.should_receive(:==).and_return(false)
- (@delegator == @base).should be_false
+ (@delegator == @base).should == false
end
it "is delegated in general" do
@base.should_receive(:==).and_return(true)
- (@delegator == 42).should be_true
+ (@delegator == 42).should == true
end
end
diff --git a/spec/ruby/library/delegate/delegator/frozen_spec.rb b/spec/ruby/library/delegate/delegator/frozen_spec.rb
index b3145c54b1..ad87dc8bdf 100644
--- a/spec/ruby/library/delegate/delegator/frozen_spec.rb
+++ b/spec/ruby/library/delegate/delegator/frozen_spec.rb
@@ -10,30 +10,30 @@ describe "Delegator when frozen" do
it "is still readable" do
@delegate.should == [42, :hello]
- @delegate.include?("bar").should be_false
+ @delegate.include?("bar").should == false
end
it "is frozen" do
- @delegate.frozen?.should be_true
+ @delegate.frozen?.should == true
end
it "is not writable" do
- ->{ @delegate[0] += 2 }.should raise_error( RuntimeError )
+ ->{ @delegate[0] += 2 }.should.raise( RuntimeError )
end
it "creates a frozen clone" do
- @delegate.clone.frozen?.should be_true
+ @delegate.clone.frozen?.should == true
end
it "creates an unfrozen dup" do
- @delegate.dup.frozen?.should be_false
+ @delegate.dup.frozen?.should == false
end
it "causes mutative calls to raise RuntimeError" do
- ->{ @delegate.__setobj__("hola!") }.should raise_error( RuntimeError )
+ ->{ @delegate.__setobj__("hola!") }.should.raise( RuntimeError )
end
it "returns false if only the delegated object is frozen" do
- DelegateSpecs::Delegator.new([1,2,3].freeze).frozen?.should be_false
+ DelegateSpecs::Delegator.new([1,2,3].freeze).frozen?.should == false
end
end
diff --git a/spec/ruby/library/delegate/delegator/marshal_spec.rb b/spec/ruby/library/delegate/delegator/marshal_spec.rb
index 6c75c8f573..2817ac7e0b 100644
--- a/spec/ruby/library/delegate/delegator/marshal_spec.rb
+++ b/spec/ruby/library/delegate/delegator/marshal_spec.rb
@@ -10,7 +10,7 @@ describe "SimpleDelegator" do
it "can be marshalled" do
m = Marshal.load(Marshal.dump(@delegate))
m.class.should == SimpleDelegator
- (m == @obj).should be_true
+ (m == @obj).should == true
end
it "can be marshalled with its instance variables intact" do
diff --git a/spec/ruby/library/delegate/delegator/method_spec.rb b/spec/ruby/library/delegate/delegator/method_spec.rb
index 81c8eea710..e41d3b4a53 100644
--- a/spec/ruby/library/delegate/delegator/method_spec.rb
+++ b/spec/ruby/library/delegate/delegator/method_spec.rb
@@ -9,7 +9,7 @@ describe "Delegator#method" do
it "returns a method object for public methods of the delegate object" do
m = @delegate.method(:pub)
- m.should be_an_instance_of(Method)
+ m.should.instance_of?(Method)
m.call.should == :foo
end
@@ -18,7 +18,7 @@ describe "Delegator#method" do
-> {
@delegate.method(:prot)
}.should complain(/delegator does not forward private method #prot/)
- }.should raise_error(NameError)
+ }.should.raise(NameError)
end
it "raises a NameError for a private methods of the delegate object" do
@@ -26,36 +26,36 @@ describe "Delegator#method" do
-> {
@delegate.method(:priv)
}.should complain(/delegator does not forward private method #priv/)
- }.should raise_error(NameError)
+ }.should.raise(NameError)
end
it "returns a method object for public methods of the Delegator class" do
m = @delegate.method(:extra)
- m.should be_an_instance_of(Method)
+ m.should.instance_of?(Method)
m.call.should == :cheese
end
it "returns a method object for protected methods of the Delegator class" do
m = @delegate.method(:extra_protected)
- m.should be_an_instance_of(Method)
+ m.should.instance_of?(Method)
m.call.should == :baz
end
it "returns a method object for private methods of the Delegator class" do
m = @delegate.method(:extra_private)
- m.should be_an_instance_of(Method)
+ m.should.instance_of?(Method)
m.call.should == :bar
end
it "raises a NameError for an invalid method name" do
-> {
@delegate.method(:invalid_and_silly_method_name)
- }.should raise_error(NameError)
+ }.should.raise(NameError)
end
it "returns a method that respond_to_missing?" do
m = @delegate.method(:pub_too)
- m.should be_an_instance_of(Method)
+ m.should.instance_of?(Method)
m.call.should == :pub_too
end
@@ -64,6 +64,6 @@ describe "Delegator#method" do
@delegate.__setobj__([1,2,3])
-> {
m.call
- }.should raise_error(NameError)
+ }.should.raise(NameError)
end
end
diff --git a/spec/ruby/library/delegate/delegator/methods_spec.rb b/spec/ruby/library/delegate/delegator/methods_spec.rb
index b9942bd230..928f63f21d 100644
--- a/spec/ruby/library/delegate/delegator/methods_spec.rb
+++ b/spec/ruby/library/delegate/delegator/methods_spec.rb
@@ -14,24 +14,24 @@ describe "Delegator#methods" do
end
it "returns singleton methods when passed false" do
- @delegate.methods(false).should include(:singleton_method)
+ @delegate.methods(false).should.include?(:singleton_method)
end
it "includes all public methods of the delegate object" do
- @methods.should include :pub
+ @methods.should.include? :pub
end
it "includes all protected methods of the delegate object" do
- @methods.should include :prot
+ @methods.should.include? :prot
end
it "includes instance methods of the Delegator 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/delegator/not_equal_spec.rb b/spec/ruby/library/delegate/delegator/not_equal_spec.rb
index 6f2df21715..7fd234a671 100644
--- a/spec/ruby/library/delegate/delegator/not_equal_spec.rb
+++ b/spec/ruby/library/delegate/delegator/not_equal_spec.rb
@@ -9,16 +9,16 @@ describe "Delegator#!=" do
it "is not delegated when passed self" do
@base.should_not_receive(:"!=")
- (@delegator != @delegator).should be_false
+ (@delegator != @delegator).should == false
end
it "is delegated when passed the delegated object" do
@base.should_receive(:"!=").and_return(true)
- (@delegator != @base).should be_true
+ (@delegator != @base).should == true
end
it "is delegated in general" do
@base.should_receive(:"!=").and_return(false)
- (@delegator != 42).should be_false
+ (@delegator != 42).should == false
end
end
diff --git a/spec/ruby/library/delegate/delegator/private_methods_spec.rb b/spec/ruby/library/delegate/delegator/private_methods_spec.rb
index 7724b8d413..5615ed0668 100644
--- a/spec/ruby/library/delegate/delegator/private_methods_spec.rb
+++ b/spec/ruby/library/delegate/delegator/private_methods_spec.rb
@@ -9,12 +9,12 @@ describe "Delegator#private_methods" do
end
it "does not include any method of the delegate object" do # since delegates does not forward private calls
- @methods.should_not include :priv
- @methods.should_not include :prot
- @methods.should_not include :pub
+ @methods.should_not.include? :priv
+ @methods.should_not.include? :prot
+ @methods.should_not.include? :pub
end
it "includes all private instance methods of the Delegate class" do
- @methods.should include :extra_private
+ @methods.should.include? :extra_private
end
end
diff --git a/spec/ruby/library/delegate/delegator/protected_methods_spec.rb b/spec/ruby/library/delegate/delegator/protected_methods_spec.rb
index fd7874fb21..3ee999fdac 100644
--- a/spec/ruby/library/delegate/delegator/protected_methods_spec.rb
+++ b/spec/ruby/library/delegate/delegator/protected_methods_spec.rb
@@ -9,10 +9,10 @@ describe "Delegator#protected_methods" do
end
it "includes protected methods of the delegate object" do
- @methods.should include :prot
+ @methods.should.include? :prot
end
it "includes protected instance methods of the Delegator class" do
- @methods.should include :extra_protected
+ @methods.should.include? :extra_protected
end
end
diff --git a/spec/ruby/library/delegate/delegator/public_methods_spec.rb b/spec/ruby/library/delegate/delegator/public_methods_spec.rb
index 18da16a613..8cf6621e2d 100644
--- a/spec/ruby/library/delegate/delegator/public_methods_spec.rb
+++ b/spec/ruby/library/delegate/delegator/public_methods_spec.rb
@@ -9,10 +9,10 @@ describe "Delegator#public_methods" do
end
it "includes public methods of the delegate object" do
- @methods.should include :pub
+ @methods.should.include? :pub
end
it "includes public instance methods of the Delegator class" do
- @methods.should include :extra
+ @methods.should.include? :extra
end
end
diff --git a/spec/ruby/library/delegate/delegator/send_spec.rb b/spec/ruby/library/delegate/delegator/send_spec.rb
index 3022c2ce91..cc18a2794b 100644
--- a/spec/ruby/library/delegate/delegator/send_spec.rb
+++ b/spec/ruby/library/delegate/delegator/send_spec.rb
@@ -12,15 +12,15 @@ describe "SimpleDelegator.new" do
end
it "forwards protected method calls" do
- ->{ @delegate.prot }.should raise_error( NoMethodError )
+ ->{ @delegate.prot }.should.raise( NoMethodError )
end
it "doesn't forward private method calls" do
- ->{ @delegate.priv }.should raise_error( NoMethodError )
+ ->{ @delegate.priv }.should.raise( NoMethodError )
end
it "doesn't forward private method calls even via send or __send__" do
- ->{ @delegate.send(:priv, 42) }.should raise_error( NoMethodError )
- ->{ @delegate.__send__(:priv, 42) }.should raise_error( NoMethodError )
+ ->{ @delegate.send(:priv, 42) }.should.raise( NoMethodError )
+ ->{ @delegate.__send__(:priv, 42) }.should.raise( NoMethodError )
end
end
diff --git a/spec/ruby/library/delegate/delegator/tap_spec.rb b/spec/ruby/library/delegate/delegator/tap_spec.rb
index 34a88fa1d5..916e4a37fe 100644
--- a/spec/ruby/library/delegate/delegator/tap_spec.rb
+++ b/spec/ruby/library/delegate/delegator/tap_spec.rb
@@ -11,6 +11,6 @@ describe "Delegator#tap" do
yielded << x
end
yielded.size.should == 1
- yielded[0].equal?(delegator).should be_true
+ yielded[0].equal?(delegator).should == true
end
end