Skip to content

Commit

Permalink
Rename parameter in PositionalOrKeywordHash
Browse files Browse the repository at this point in the history
To `actual_value` and `is_last_parameter` to `is_last_actual_value` and
`#extract_parameter` to `#extract_actual_value` to make the code
clearer.
  • Loading branch information
floehopper committed Jan 4, 2025
1 parent 16c7c51 commit a19bed1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/mocha/parameter_matchers/positional_or_keyword_hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def initialize(expected_value, expectation)
end

def matches?(actual_values)
parameter, is_last_parameter = extract_parameter(actual_values)
actual_value, is_last_actual_value = extract_actual_value(actual_values)

return false unless HasEntries.new(@expected_value, exact: true).matches?([parameter])
return false unless HasEntries.new(@expected_value, exact: true).matches?([actual_value])

if is_last_parameter && !same_type_of_hash?(parameter, @expected_value)
if is_last_actual_value && !same_type_of_hash?(actual_value, @expected_value)
return false if Mocha.configuration.strict_keyword_argument_matching?

deprecation_warning(parameter, @expected_value) if Mocha::RUBY_V27_PLUS
deprecation_warning(actual_value, @expected_value) if Mocha::RUBY_V27_PLUS
end

true
Expand All @@ -37,7 +37,7 @@ def mocha_inspect

private

def extract_parameter(actual_values)
def extract_actual_value(actual_values)
[actual_values.shift, actual_values.empty?]
end

Expand Down

0 comments on commit a19bed1

Please sign in to comment.