I'm using RSpec match matcher to check if a hash contains expected values. When a key of the hash doesn't match, all the dynamic (a_string_starting_with, etc) values are shown as not matching. It's especially distracting when you try to match a bigger hash. I'm wondering if there's another way check the hash, so only the values which really do not match would show up in the diff.
Here's an example, where a is marked in red, although the value is correct.
it 'matches' do
actual = {
a: 'test test',
b: 1,
c: 2,
}
expect(actual).to match(
a: a_string_starting_with('test'),
b: 0,
c: 2,
)
end
I'm wondering if there's another matcher I should use. Or if there are any custom matchers or gems for this?
