1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00

Don't swap failure messages in ValidationMatcher

It's not entirely clear why these were being swapped to begin with, but
it was causing messages to appear backwards in the presence validation
matcher.

Other matchers using these methods were tested by hand and still output
correct messages -- they too may have been backwards before this fix.
This commit is contained in:
patrick brisbin 2013-05-24 11:13:52 -04:00
parent 69a4a776b4
commit a1afc5771a

View file

@ -34,10 +34,10 @@ module Shoulda # :nodoc:
allow = allow_value_matcher(value, message)
if allow.matches?(@subject)
@failure_message_for_should_not = allow.failure_message_for_should
@failure_message_for_should_not = allow.failure_message_for_should_not
true
else
@failure_message_for_should = allow.failure_message_for_should_not
@failure_message_for_should = allow.failure_message_for_should
false
end
end
@ -46,10 +46,10 @@ module Shoulda # :nodoc:
disallow = disallow_value_matcher(value, message)
if disallow.matches?(@subject)
@failure_message_for_should_not = disallow.failure_message_for_should
@failure_message_for_should_not = disallow.failure_message_for_should_not
true
else
@failure_message_for_should = disallow.failure_message_for_should_not
@failure_message_for_should = disallow.failure_message_for_should
false
end
end