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

Commit

Permalink
code review feedback: defines diff_hashes_as_object conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlHeitmann committed Jun 15, 2024
1 parent 31f086e commit dd7a4c7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/rspec/support/differ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def diff_as_string(actual, expected)
end
# rubocop:enable Metrics/MethodLength

def diff_hashes_as_object(actual, expected)
if defined?(RSpec::Mocks::ArgumentMatchers::AnyArgMatcher)
if defined?(RSpec::Mocks::ArgumentMatchers::AnyArgMatcher)
def diff_hashes_as_object(actual, expected)
expected_to_diff =
expected.reduce({}) do |hash, (key, value)|
if RSpec::Mocks::ArgumentMatchers::AnyArgMatcher === value
Expand All @@ -71,7 +71,9 @@ def diff_hashes_as_object(actual, expected)
end

diff_as_object(actual, expected_to_diff)
else
end
else
def diff_hashes_as_object(actual, expected)
diff_as_object(actual, expected)
end
end
Expand Down

0 comments on commit dd7a4c7

Please sign in to comment.