diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-10-17 02:47:38 -0700 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2012-10-17 02:47:38 -0700 |
commit | bf876af7b33b8f6a4c91353e2751686f1d0fa934 (patch) | |
tree | 48baee2cc9088c4eed11696e9c280718cf175211 /activerecord/test | |
parent | c432c74cd34d4230bfda6fa008f2af9dbc33e523 (diff) | |
parent | 25262bc280e8c9c0e875315958f82230b67cbf35 (diff) | |
download | rails-bf876af7b33b8f6a4c91353e2751686f1d0fa934.tar.gz rails-bf876af7b33b8f6a4c91353e2751686f1d0fa934.tar.bz2 rails-bf876af7b33b8f6a4c91353e2751686f1d0fa934.zip |
Merge pull request #7972 from scottwillson/fix-double-presence-of-errors-2
Fix bug with presence validation of associations.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/validations/presence_validation_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/validations/presence_validation_test.rb b/activerecord/test/cases/validations/presence_validation_test.rb index cd9175f454..1de8934406 100644 --- a/activerecord/test/cases/validations/presence_validation_test.rb +++ b/activerecord/test/cases/validations/presence_validation_test.rb @@ -18,6 +18,13 @@ class PresenceValidationTest < ActiveRecord::TestCase assert b.valid? end + def test_validates_presence_of_has_one + Boy.validates_presence_of(:face) + b = Boy.new + assert b.invalid?, "should not be valid if has_one association missing" + assert_equal 1, b.errors[:face].size, "validates_presence_of should only add one error" + end + def test_validates_presence_of_has_one_marked_for_destruction Boy.validates_presence_of(:face) b = Boy.new |