Skip to content

Commit

Permalink
dont globally shim ruby2_keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmohare committed Feb 26, 2024
1 parent 869067e commit 6eb38eb
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions spec/rspec/support/method_signature_verifier_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6eb38eb

Please sign in to comment.