-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
Fixup issue with multiline diffs in custom matchers. #423
Fixup issue with multiline diffs in custom matchers. #423
Conversation
I''d like a review on this to make sure its a sensible strategy for solving this problem. /cc @myronmarston |
Yep, planning to review this tonight. I'm out most of the afternoon. |
@no_array = true | ||
@expected = expected[0] | ||
else | ||
@no_array = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is @no_array
meant to be used for? I see it set here but never used again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was for something that later proved unnecessary...
This looks like a reasonable fix, although it doesn't demonstrate adequately that it fixes the diff issue since there's no spec here demonstrating that the diff is the same for a custom matcher as for a matcher like |
Added a spec, it's not quite as simple as proposed in #420 cause ASCII control codes... |
LGTM. |
I'd like to hold off till I get a chance to look at the behaviour of expected/actual a bit more actually, I got a weird diff with true/false when playing around with the sample custom matcher. |
What's an example of where this produces a weird diff? |
Did you get a chance to look at the weird diff? |
Not yet, sorry, thanks for the reminder. |
Ping? |
So, looking at your example, I think the diff from before is weird, and the new behavior with this change (e.g. no diff) is correct. What do you think is weird about it? |
I'm ok with the lack of diff on the true/false but note that the strings aren't being diffed either... |
We only provide diffs when there are multiline strings involved: rspec-expectations/lib/rspec/expectations/fail_with.rb Lines 24 to 26 in 9003d2d
Your example did not provide multiline strings so I would not expect a diff. |
Fair enough |
Merging because the rbx build issue is separate. |
…n_custom_matchers Fixup issue with multiline diffs in custom matchers.
You still planning to add a deprecation warning to 2.99 for this? |
Yeah on my list |
Fix #420 by not forcing expected to be an array in custom matchers.