You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a situation where you have a presence validation with a custom message and you say it { should_not validate_presence_of(:attribute) } when in fact the validation is being run, the test will pass. This is technically true, because it { should_not validate_presence_of(:attribute) } is the same thing as saying it { should_not validate_presence_of(:attribute).with_message(:blank) }. That may make sense for should, but for should_not this doesn't make any sense.
The text was updated successfully, but these errors were encountered:
Hey @mcmire. I'm working on this one. But honestly, I'm getting lost searching for the responsible method of the false positive, in lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb.
If you have a situation where you have a presence validation with a custom message and you say
it { should_not validate_presence_of(:attribute) }
when in fact the validation is being run, the test will pass. This is technically true, becauseit { should_not validate_presence_of(:attribute) }
is the same thing as sayingit { should_not validate_presence_of(:attribute).with_message(:blank) }
. That may make sense forshould
, but forshould_not
this doesn't make any sense.The text was updated successfully, but these errors were encountered: