Open
Description
Hi!
I've opened a PR in rspec-support with a hacky fix to the problem you get when you compare an actual
hash with a expected
hash and they differ, but the expected
hash includes some values whose values correspond to the anything
matcher.
My PR contains some tests showing the failure and the fix. But the code changes I've made on the rspec differ engine is trivial:
- Navigate the
expected
hash and retrieve all keys you must dig in that hash in order to find values that areanything
fuzzy matcher. - Use these keys to fetch the data on the
actual
hash, and replace theanything
values on yourexpected
hash by the values you fetched on theactual
hash. - Later, when the diff string is generated, with the morph you made on the
expected
var on step (2), the diff string will NOT calculate the diff on the key-value pairs you had before theanything
fuzzy matcher. The result is you will have a clean diff showing you only the right values that differ and you are interested in.
I'd like to implement this behavior on super_diff
, but I know my proposal may be hacky. What are your thoughts about it? Any feedback is appreciated.
I am reading your specs
and the source code of super_differ, I'm looking forward to collaborate here or in rspec-support
, because diffs is a topic that I found very interesting.
Best.
Metadata
Metadata
Assignees
Labels
No labels