diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-02 06:59:08 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-02 06:59:08 +0000 |
commit | 9ac02777e7fc81369e5a837124aff51a7ca03d2b (patch) | |
tree | 9721adcbf76ca435b58479717c743812048a6649 /activerecord/test/validations_test.rb | |
parent | a53372c273a06681c3e4e51faa5b0f7757d35d0b (diff) | |
download | rails-9ac02777e7fc81369e5a837124aff51a7ca03d2b.tar.gz rails-9ac02777e7fc81369e5a837124aff51a7ca03d2b.tar.bz2 rails-9ac02777e7fc81369e5a837124aff51a7ca03d2b.zip |
Clarified intentions of validates_associated #870
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1602 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/validations_test.rb')
-rwxr-xr-x | activerecord/test/validations_test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb index 576d1f6c3d..8a918e2255 100755 --- a/activerecord/test/validations_test.rb +++ b/activerecord/test/validations_test.rb @@ -784,4 +784,14 @@ class ValidationsTest < Test::Unit::TestCase assert t.valid? assert !t.errors.on(:title) end -end + + def test_validates_associated_missing + Reply.validates_presence_of(:topic) + r = Reply.create("title" => "A reply", "content" => "with content!") + assert !r.valid? + assert r.errors.on(:topic) + + r.topic = Topic.find :first + assert r.valid? + end +end
\ No newline at end of file |