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

Commit

Permalink
Add code review feedback, this feat works only ruby version > 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlHeitmann committed May 25, 2024
1 parent b993756 commit daa5bb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rspec/support/differ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def diff(actual, expected)
diff = diff_as_string(coerce_to_string(actual), coerce_to_string(expected))
end
elsif no_procs_and_no_numbers?(actual, expected)
if Hash === expected && hash_with_anything?(expected)
if (RUBY_VERSION.to_f > 1.8) && hash_with_anything?(expected)
diff = diff_as_object_with_anything(actual, expected)
else
diff = diff_as_object(actual, expected)
Expand Down Expand Up @@ -85,7 +85,7 @@ def initialize(opts={})
private

def hash_with_anything?(arg)
safely_flatten(arg).any? { |a| RSpec::Mocks::ArgumentMatchers::AnyArgMatcher === a }
Hash === arg && safely_flatten(arg).any? { |a| RSpec::Mocks::ArgumentMatchers::AnyArgMatcher === a }
end

def no_procs_and_no_numbers?(*args)
Expand Down

0 comments on commit daa5bb5

Please sign in to comment.