Skip to content

Commit

Permalink
Add some other cases for #super_method specs
Browse files Browse the repository at this point in the history
Based on commit ruby/ruby@b4981594.
  • Loading branch information
robin850 committed Jul 22, 2015
1 parent 493847b commit 6370559
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/ruby/core/method/super_method_spec.rb
Expand Up @@ -22,4 +22,18 @@
sss_meth.receiver.should == obj
sss_meth.name.should == :overridden
end

it "returns nil when there's no super method in the parent" do
method = Object.new.method(:method)
method.super_method.should == nil
end

it "returns nil when the parent's method is removed" do
object = MethodSpecs::B.new
method = object.method(:overridden)

MethodSpecs::A.class_eval { undef :overridden }

method.super_method.should == nil
end
end
14 changes: 14 additions & 0 deletions spec/ruby/core/unboundmethod/super_method_spec.rb
Expand Up @@ -9,4 +9,18 @@
meth = meth.super_method
meth.should == UnboundMethodSpecs::A.instance_method(:overridden)
end

it "returns nil when there's no super method in the parent" do
method = Object.instance_method(:method)
method.super_method.should == nil
end

it "returns nil when the parent's method is removed" do
object = UnboundMethodSpecs::B
method = object.instance_method(:overridden)

UnboundMethodSpecs::A.class_eval { undef :overridden }

method.super_method.should == nil
end
end

0 comments on commit 6370559

Please sign in to comment.