From 96e71ad16d21606b2d6f3f32b24982ee28eda1f5 Mon Sep 17 00:00:00 2001 From: Nicholas Koh Date: Thu, 25 Aug 2022 22:34:29 +0800 Subject: [PATCH] Add more ruby2_keywords --- lib/mocha/invocation.rb | 1 + lib/mocha/stubbed_method.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/mocha/invocation.rb b/lib/mocha/invocation.rb index b2030c660..6e8115720 100644 --- a/lib/mocha/invocation.rb +++ b/lib/mocha/invocation.rb @@ -18,6 +18,7 @@ def initialize(mock, method_name, *arguments, &block) @yields = [] @result = nil end + ruby2_keywords(:initialize) if RUBY_V3_PLUS def call(yield_parameters = YieldParameters.new, return_values = ReturnValues.new) yield_parameters.next_invocation.each do |yield_args| diff --git a/lib/mocha/stubbed_method.rb b/lib/mocha/stubbed_method.rb index 95b64f5fa..348b6d8f0 100644 --- a/lib/mocha/stubbed_method.rb +++ b/lib/mocha/stubbed_method.rb @@ -59,6 +59,7 @@ def define_new_method stub_method_owner.send(:define_method, method_name) do |*args, &block| self_in_scope.mock.method_missing(method_name_in_scope, *args, &block) end + stub_method_owner.send(:ruby2_keywords, method_name) if RUBY_V3_PLUS retain_original_visibility(stub_method_owner) end