Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use RSpec fuzzy value matching for hash comparison #156

Merged

Conversation

jas14
Copy link
Collaborator

@jas14 jas14 commented Jul 14, 2022

Hello! 👋 I believe this fixes #150.

The issue seems to be that RSpec uses fuzzy matching to compare hashes in the "include" matcher, while super_diff's current RSpec-specific HashIncluding operation tree builder uses exact equality.

I understand this likely degrades performance, but maybe it's worth it to make the diff line up with RSpec's matching logic.

Eagerly awaiting your feedback!

@jas14
Copy link
Collaborator Author

jas14 commented Jul 14, 2022

I believe the collection including operator tree builder has the same issue, but I'm not sure how to replace Diff::LCS's comparison operator with fuzzy matching.

@jas14 jas14 force-pushed the rspec-include-fuzzy-value-matching branch from 67128db to bc2220c Compare July 19, 2022 12:46
@jas14 jas14 requested a review from mcmire August 31, 2022 16:22
@mcmire mcmire merged commit a8ed2b1 into splitwise:master Sep 1, 2022
@mcmire
Copy link
Collaborator

mcmire commented Sep 1, 2022

Hi @jas14, thanks for the ping and sorry it took so long for me to merge this. Thanks for this PR, seems like a great solution!

@sfcgeorge
Copy link

Oh wow so much simpler than I expected, thanks! 👍

@jas14 jas14 deleted the rspec-include-fuzzy-value-matching branch September 1, 2022 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include Hash with nested matchers incorrect
3 participants