diff options
author | Benoit Daloze <eregontp@gmail.com> | 2022-09-28 18:54:05 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2022-09-29 15:48:35 +0200 |
commit | 94cea3e4d0a60326bd95be762819eed8ccd59ca6 (patch) | |
tree | 3f1ce9e04741e68ab53728e8ced70fa05e759d40 /spec/ruby/core | |
parent | 892f350a7db4d2cc99c5061d2e74498dfc4809ca (diff) | |
download | ruby-94cea3e4d0a60326bd95be762819eed8ccd59ca6.tar.gz |
Fix {Method,UnboundMethod}#super_method for zsuper methods
* We need to resolve the zsuper method first, and then look the super
method of that.
Diffstat (limited to 'spec/ruby/core')
-rw-r--r-- | spec/ruby/core/method/super_method_spec.rb | 15 | ||||
-rw-r--r-- | spec/ruby/core/unboundmethod/super_method_spec.rb | 16 |
2 files changed, 9 insertions, 22 deletions
diff --git a/spec/ruby/core/method/super_method_spec.rb b/spec/ruby/core/method/super_method_spec.rb index dc8764f6c7..c63a7aaa0f 100644 --- a/spec/ruby/core/method/super_method_spec.rb +++ b/spec/ruby/core/method/super_method_spec.rb @@ -49,18 +49,9 @@ describe "Method#super_method" do MethodSpecs::InheritedMethods::C.new.derp.should == 'BA' end - ruby_version_is ""..."3.2" do - it "returns the expected super_method" do - method = MethodSpecs::InheritedMethods::C.new.method(:derp) - method.super_method.owner.should == MethodSpecs::InheritedMethods::A - end - end - - ruby_version_is "3.2" do - it "returns the expected super_method" do - method = MethodSpecs::InheritedMethods::C.new.method(:derp) - method.super_method.owner.should == MethodSpecs::InheritedMethods::B - end + it "returns the expected super_method" do + method = MethodSpecs::InheritedMethods::C.new.method(:derp) + method.super_method.owner.should == MethodSpecs::InheritedMethods::A end end diff --git a/spec/ruby/core/unboundmethod/super_method_spec.rb b/spec/ruby/core/unboundmethod/super_method_spec.rb index 5cf96e6fa9..aa7c129377 100644 --- a/spec/ruby/core/unboundmethod/super_method_spec.rb +++ b/spec/ruby/core/unboundmethod/super_method_spec.rb @@ -29,18 +29,14 @@ describe "UnboundMethod#super_method" do # https://github.com/jruby/jruby/issues/7240 context "after changing an inherited methods visibility" do - ruby_version_is ""..."3.2" do - it "returns the expected super_method" do - method = MethodSpecs::InheritedMethods::C.instance_method(:derp) - method.super_method.owner.should == MethodSpecs::InheritedMethods::A - end + it "calls the proper super method" do + method = MethodSpecs::InheritedMethods::C.instance_method(:derp) + method.bind(MethodSpecs::InheritedMethods::C.new).call.should == 'BA' end - ruby_version_is "3.2" do - it "returns the expected super_method" do - method = MethodSpecs::InheritedMethods::C.instance_method(:derp) - method.super_method.owner.should == MethodSpecs::InheritedMethods::B - end + it "returns the expected super_method" do + method = MethodSpecs::InheritedMethods::C.instance_method(:derp) + method.super_method.owner.should == MethodSpecs::InheritedMethods::A end end |