1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add specs for {Method,UnboundMethod}#owner of a zsuper method

This commit is contained in:
Benoit Daloze 2022-09-28 19:04:06 +02:00
parent 94cea3e4d0
commit aa53d69aa2
Notes: git 2022-09-29 22:49:00 +09:00
2 changed files with 13 additions and 0 deletions

View file

@ -23,4 +23,10 @@ describe "Method#owner" do
@m.method(:handled_via_method_missing).owner.should == MethodSpecs::Methods
end
end
ruby_version_is "3.2" do
it "returns the class on which public was called for a private method in ancestor" do
MethodSpecs::InheritedMethods::C.new.method(:derp).owner.should == MethodSpecs::InheritedMethods::C
end
end
end

View file

@ -1,5 +1,6 @@
require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require_relative '../method/fixtures/classes'
describe "UnboundMethod#owner" do
it "returns the owner of the method" do
@ -23,4 +24,10 @@ describe "UnboundMethod#owner" do
child_singleton_class.instance_method(:class_method).owner.should == parent_singleton_class
child_singleton_class.instance_method(:another_class_method).owner.should == child_singleton_class
end
ruby_version_is "3.2" do
it "returns the class on which public was called for a private method in ancestor" do
MethodSpecs::InheritedMethods::C.instance_method(:derp).owner.should == MethodSpecs::InheritedMethods::C
end
end
end