-
Notifications
You must be signed in to change notification settings - Fork 53
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
What should happen when you use an anything
fuzzy matcher inside a Hash on your specs?
#241
Comments
Hi @KarlHeitmann! I've taken a look at your PR over on |
Hey @mcmire ! Thank you! I'll implement See you later! |
Hey @mcmire ! I wanted to catch up / update my status. I've read your guides and now I have a slightly better understanding of RSpec. I've noted you wrote some specs about fuzzy finding, but you wrote these examples using the Do you have any tips to debug the source code? Since you are running the examples inside a I understand there are integration tests and unit tests. The integration tests are "end to end", I mean: on one end you've got the input data (ie: the variables you want to diff) and you check the right output data (ie: the diff string) at the other end. To me, integration tests are great to start looking under the hood of a project. Because there I've got the overview of what is happening. But right now, I am thinking to myself that ~ maybe ~ it is a good idea to tackle this issue by starting with a unit test, because I ~ believe ~ my code change should be small. What do you think? It is a good or bad idea to fix the issue by working on a unit? I think there is a good chance I may be underestimating the issue. I grepped the source code with: |
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 aexpected
hash and they differ, but theexpected
hash includes some values whose values correspond to theanything
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:
expected
hash and retrieve all keys you must dig in that hash in order to find values that areanything
fuzzy matcher.actual
hash, and replace theanything
values on yourexpected
hash by the values you fetched on theactual
hash.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 inrspec-support
, because diffs is a topic that I found very interesting.Best.
The text was updated successfully, but these errors were encountered: