summaryrefslogtreecommitdiff
path: root/spec/ruby/core/unboundmethod/bind_call_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/unboundmethod/bind_call_spec.rb')
-rw-r--r--spec/ruby/core/unboundmethod/bind_call_spec.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/ruby/core/unboundmethod/bind_call_spec.rb b/spec/ruby/core/unboundmethod/bind_call_spec.rb
index 8f25f8bd0d..ee1dad9c9e 100644
--- a/spec/ruby/core/unboundmethod/bind_call_spec.rb
+++ b/spec/ruby/core/unboundmethod/bind_call_spec.rb
@@ -7,10 +7,12 @@ describe "UnboundMethod#bind_call" do
@parent_um = UnboundMethodSpecs::Parent.new.method(:foo).unbind
@child1_um = UnboundMethodSpecs::Child1.new.method(:foo).unbind
@child2_um = UnboundMethodSpecs::Child2.new.method(:foo).unbind
+ @normal_um_super = UnboundMethodSpecs::Mod.instance_method(:foo_super)
+ @parent_um_super = UnboundMethodSpecs::Parent.new.method(:foo_super).unbind
end
it "raises TypeError if object is not kind_of? the Module the method defined in" do
- -> { @normal_um.bind_call(UnboundMethodSpecs::B.new) }.should raise_error(TypeError)
+ -> { @normal_um.bind_call(UnboundMethodSpecs::B.new) }.should.raise(TypeError)
end
it "binds and calls the method if object is kind_of the Module the method defined in" do
@@ -45,6 +47,12 @@ describe "UnboundMethod#bind_call" do
end
end
um = p.method(:singleton_method).unbind
- ->{ um.bind_call(other) }.should raise_error(TypeError)
+ ->{ um.bind_call(other) }.should.raise(TypeError)
+ end
+
+ it "allows calling super for module methods bound to hierarchies that do not already have that module" do
+ p = UnboundMethodSpecs::Parent.new
+
+ @normal_um_super.bind_call(p).should == true
end
end