diff --git a/lib/shoulda/matchers/active_record/validate_format_of_matcher.rb b/lib/shoulda/matchers/active_record/validate_format_of_matcher.rb index 73a9313d..73e6b512 100644 --- a/lib/shoulda/matchers/active_record/validate_format_of_matcher.rb +++ b/lib/shoulda/matchers/active_record/validate_format_of_matcher.rb @@ -49,7 +49,7 @@ module Shoulda # :nodoc: def matches?(subject) super(subject) - @expected_message ||= :blank + @expected_message ||= :invalid return disallows_value_of(@value_to_fail, @expected_message) if @value_to_fail allows_value_of(@value_to_pass, @expected_message) if @value_to_pass end diff --git a/spec/shoulda/active_record/validate_format_of_matcher_spec.rb b/spec/shoulda/active_record/validate_format_of_matcher_spec.rb index 77d14007..472321e6 100644 --- a/spec/shoulda/active_record/validate_format_of_matcher_spec.rb +++ b/spec/shoulda/active_record/validate_format_of_matcher_spec.rb @@ -15,15 +15,15 @@ describe Shoulda::Matchers::ActiveRecord::ValidateFormatOfMatcher do end it "should not be valid with alpha in zip" do - @model.should_not validate_format_of(:attr).not_with('1234a') + @model.should validate_format_of(:attr).not_with('1234a') end it "should not be valid with to few digits" do - @model.should_not validate_format_of(:attr).not_with('1234') + @model.should validate_format_of(:attr).not_with('1234') end it "should not be valid with to many digits" do - @model.should_not validate_format_of(:attr).not_with('123456') + @model.should validate_format_of(:attr).not_with('123456') end it "should raise error if you try to call both with and not_with" do