diff options
Diffstat (limited to 'spec/ruby/core')
-rw-r--r-- | spec/ruby/core/method/owner_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/unboundmethod/owner_spec.rb | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/method/owner_spec.rb b/spec/ruby/core/method/owner_spec.rb index ca5dff7295..05422f1697 100644 --- a/spec/ruby/core/method/owner_spec.rb +++ b/spec/ruby/core/method/owner_spec.rb @@ -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 diff --git a/spec/ruby/core/unboundmethod/owner_spec.rb b/spec/ruby/core/unboundmethod/owner_spec.rb index 5f1f4646b3..e8a734dac4 100644 --- a/spec/ruby/core/unboundmethod/owner_spec.rb +++ b/spec/ruby/core/unboundmethod/owner_spec.rb @@ -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 |