aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_associations_test.rb
diff options
context:
space:
mode:
authorJan De Poorter <jan@defv.be>2008-06-11 13:08:35 +0200
committerPratik Naik <pratiknaik@gmail.com>2008-06-11 12:21:57 +0100
commit7f140bbddaf70abc61570f6cfdcbfba5771ffc78 (patch)
tree6c3622bd7951295b58ec5c5bbfceeb7ffb6def21 /activerecord/test/cases/associations/has_many_associations_test.rb
parentf728e57d2204a429f5282856ec89d4e047e72957 (diff)
downloadrails-7f140bbddaf70abc61570f6cfdcbfba5771ffc78.tar.gz
rails-7f140bbddaf70abc61570f6cfdcbfba5771ffc78.tar.bz2
rails-7f140bbddaf70abc61570f6cfdcbfba5771ffc78.zip
Add :validate option to associations. [#301 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index dbfa025efb..1f23ff256c 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -342,6 +342,17 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert new_firm.new_record?
end
+ def test_invalid_adding_with_validate_false
+ firm = Firm.find(:first)
+ client = Client.new
+ firm.unvalidated_clients_of_firm << Client.new
+
+ assert firm.valid?
+ assert !client.valid?
+ assert firm.save
+ assert client.new_record?
+ end
+
def test_build
company = companies(:first_firm)
new_client = assert_no_queries { company.clients_of_firm.build("name" => "Another Client") }