-
Couldn't load subscription status.
- Fork 61
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
expectedhash and retrieve all keys you must dig in that hash in order to find values that areanythingfuzzy matcher. - Use these keys to fetch the data on the
actualhash, and replace theanythingvalues on yourexpectedhash by the values you fetched on theactualhash. - Later, when the diff string is generated, with the morph you made on the
expectedvar on step (2), the diff string will NOT calculate the diff on the key-value pairs you had before theanythingfuzzy 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.