Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6370559

Browse files
committedJul 22, 2015
Add some other cases for #super_method specs
Based on commit ruby/ruby@b4981594.
1 parent 493847b commit 6370559

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
 

‎spec/ruby/core/method/super_method_spec.rb

+14
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,18 @@
2222
sss_meth.receiver.should == obj
2323
sss_meth.name.should == :overridden
2424
end
25+
26+
it "returns nil when there's no super method in the parent" do
27+
method = Object.new.method(:method)
28+
method.super_method.should == nil
29+
end
30+
31+
it "returns nil when the parent's method is removed" do
32+
object = MethodSpecs::B.new
33+
method = object.method(:overridden)
34+
35+
MethodSpecs::A.class_eval { undef :overridden }
36+
37+
method.super_method.should == nil
38+
end
2539
end

‎spec/ruby/core/unboundmethod/super_method_spec.rb

+14
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,18 @@
99
meth = meth.super_method
1010
meth.should == UnboundMethodSpecs::A.instance_method(:overridden)
1111
end
12+
13+
it "returns nil when there's no super method in the parent" do
14+
method = Object.instance_method(:method)
15+
method.super_method.should == nil
16+
end
17+
18+
it "returns nil when the parent's method is removed" do
19+
object = UnboundMethodSpecs::B
20+
method = object.instance_method(:overridden)
21+
22+
UnboundMethodSpecs::A.class_eval { undef :overridden }
23+
24+
method.super_method.should == nil
25+
end
1226
end

0 commit comments

Comments
 (0)
Please sign in to comment.