thoughtbot / shoulda-matchers

Simple one-liner tests for common Rails functionality
https://matchers.shoulda.io
MIT License
3.51k stars 912 forks source link

feat: When an unrelated error is seen with negated allow_value, give a hint #1570

Closed matsales28 closed 10 months ago

matsales28 commented 1 year ago

To clean out some old PRs, I'm trying to push and merge some changes so we can close them. This is basically a copy of #1238, making the adjustments suggested on the code view. All the credit from this PR goes to @antifun.

I am quoting the PR owner.

In cases when an unrelated error is seen that makes allow_value fail, the validation message was using the erroneous text "but it was valid instead". This changes the validation message to indicate which attribute(s) actually failed validation.

Fixes https://github.com/thoughtbot/shoulda-matchers/issues/919 (kinda sorta).

Closes: #919 and #1238