diff --git a/spec/rspec/support/method_signature_verifier_spec.rb b/spec/rspec/support/method_signature_verifier_spec.rb index 482bcc33..9c48a588 100644 --- a/spec/rspec/support/method_signature_verifier_spec.rb +++ b/spec/rspec/support/method_signature_verifier_spec.rb @@ -1,8 +1,6 @@ require 'rspec/support' require 'rspec/support/method_signature_verifier' -def ruby2_keywords(*); end unless respond_to?(:ruby2_keywords, true) - module RSpec module Support RSpec.describe 'verifying methods' do @@ -12,16 +10,28 @@ def valid_non_kw_args?(arity) described_class.new(signature, [nil] * arity).valid? end - ruby2_keywords def valid?(*args) - described_class.new(signature, args).valid? + if RubyFeatures.kw_arg_separation? + ruby2_keywords def valid?(*args) + described_class.new(signature, args).valid? + end + else + def valid?(*args) + described_class.new(signature, args).valid? + end end def error_description described_class.new(signature).error_message[/Expected (.*),/, 1] end - ruby2_keywords def error_for(*args) - described_class.new(signature, args).error_message + if RubyFeatures.kw_arg_separation? + ruby2_keywords def error_for(*args) + described_class.new(signature, args).error_message + end + else + def error_for(*args) + described_class.new(signature, args).error_message + end end def signature_description