Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
ruby >= 3.2 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmohare committed Feb 27, 2024
1 parent fd1dbb6 commit 8d08422
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/rspec/support/method_signature_verifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class MethodSignatureVerifier

def initialize(signature, args=[])
@signature = signature
@non_kw_args, @kw_args = split_args(*args)
@non_kw_args, @kw_args = split_args(args.clone)
@min_non_kw_args = @max_non_kw_args = @non_kw_args
@arbitrary_kw_args = @unlimited_args = false
end
Expand Down Expand Up @@ -385,7 +385,7 @@ def unlimited_args?
!@unlimited_args || @signature.unlimited_args?
end

def split_args(*args)
def split_args(args)
kw_args = if @signature.has_kw_args_in?(args) && !RubyFeatures.kw_arg_separation?
last = args.pop
non_kw_args = last.reject { |k, _| k.is_a?(Symbol) }
Expand Down Expand Up @@ -418,13 +418,13 @@ def split_args(*args)
class LooseSignatureVerifier < MethodSignatureVerifier
private

def split_args(*args)
def split_args(args)
if RSpec::Support.is_a_matcher?(args.last) && @signature.could_contain_kw_args?(args)
args.pop
@signature = SignatureWithKeywordArgumentsMatcher.new(@signature)
end

super(*args)
super(args)
end

# If a matcher is used in a signature in place of keyword arguments, all
Expand Down

0 comments on commit 8d08422

Please sign in to comment.