aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/autosave_association_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-14 01:43:57 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-14 01:46:27 +0100
commit363545aa20014c56f6da223acc4a46de5c873143 (patch)
tree70c650fe783a3d2ca3f659bd89de88fa2607c999 /activerecord/test/cases/autosave_association_test.rb
parent35933822dec7be3f895c7a3f1440d72c982aebdd (diff)
downloadrails-363545aa20014c56f6da223acc4a46de5c873143.tar.gz
rails-363545aa20014c56f6da223acc4a46de5c873143.tar.bz2
rails-363545aa20014c56f6da223acc4a46de5c873143.zip
Different nested validations should not be ignore [#3638 status:resolved]
Diffstat (limited to 'activerecord/test/cases/autosave_association_test.rb')
-rw-r--r--activerecord/test/cases/autosave_association_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb
index 7be605ed95..cc36a6dc5b 100644
--- a/activerecord/test/cases/autosave_association_test.rb
+++ b/activerecord/test/cases/autosave_association_test.rb
@@ -794,6 +794,14 @@ class TestAutosaveAssociationOnAHasOneAssociation < ActiveRecord::TestCase
assert @pirate.errors[:catchphrase].any?
end
+ def test_should_not_ignore_different_error_messages_on_the_same_attribute
+ Ship.validates_format_of :name, :with => /\w/
+ @pirate.ship.name = ""
+ @pirate.catchphrase = nil
+ assert @pirate.invalid?
+ assert_equal ["can't be blank", "is invalid"], @pirate.errors[:"ship.name"]
+ end
+
def test_should_still_allow_to_bypass_validations_on_the_associated_model
@pirate.catchphrase = ''
@pirate.ship.name = ''