This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec::Matchers.define :be_a_hash_like do |expected_hash| | |
match do |actual_hash| | |
matching_results = actual_hash == expected_hash | |
unless matching_results | |
system( | |
"git --no-pager diff $(echo '#{JSON.pretty_generate(expected_hash)}' | git hash-object -w --stdin) " + | |
"$(echo '#{JSON.pretty_generate(actual_hash)}' | git hash-object -w --stdin) --word-diff", | |
out: $stdout, | |
err: :out | |
) |