-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix a nil error in failure_message of content type validation matcher #1910
Conversation
Can you add a test to demonstrate the error this may fix? |
Sure, sure. As I wrote above, I'm requesting advice on how extensively we want to test the output of |
97967f2
to
dc6968f
Compare
end | ||
|
||
it "does not run the validation if the control is false" do | ||
dummy = Dummy.new | ||
dummy.go = false | ||
expect(matcher).to_not accept(dummy) | ||
expect{ matcher.failure_message }.to_not raise_error |
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.
Space missing to the left of {.
dc6968f
to
e26f038
Compare
72cdafd
to
719d293
Compare
Could I maybe get some feedback on this? I rebased the commits on top of the current master and pushed them one by one. This should show that the fix still applies, and that |
This is great, @lime. Can you please rebase again on top of latest master? And please add a note on the change to the |
Thanks for the update! I'll take a look at it tonight. :) |
…ssage Note: this is most likely not the way we want to test our matchers, but it demonstrates the current issue.
When a matcher uses both `allowing` and `rejecting`, and validation fails, `@missing_rejected_types` might still be `nil`. When a matcher only uses either of the two, a part of the message is `nil`.
b823c6f
to
8cd76a8
Compare
[ci skip]
Rebased, sorry for the delay. |
Thanks!! |
When a matcher uses both
allowing
andrejecting
, and validation fails,@missing_rejected_types
might still benil
. The validation itself works as intended, but callingfailure_message
raises due to@missing_rejected_types.any?
.Presumably, this fixes #1334. Possibly also #1476.
I haven't added any tests for this fix yet. Any suggestions on what tests we would want? The minimal case would be:
But that feels dumb. On the other hand, testing the failure message string for some specific pattern feels like overkill. Ideas?