diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-05-18 20:01:06 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-05-18 20:01:06 -0300 |
commit | 1cc44599397e061901cd59233397129625839a60 (patch) | |
tree | 235108ce6a9d270bdfe3264a8f5f5a7c99c3ae5c /activerecord/test/cases/associations | |
parent | 3db44e938fc6b5a5d272c4df4cf06dd6b5715782 (diff) | |
parent | ee5520a0a5ea83843ce88f6b9550e3c36b8cdd49 (diff) | |
download | rails-1cc44599397e061901cd59233397129625839a60.tar.gz rails-1cc44599397e061901cd59233397129625839a60.tar.bz2 rails-1cc44599397e061901cd59233397129625839a60.zip |
Merge commit 'rails/master'
Conflicts:
activerecord/lib/active_record.rb
Updated:
Arel submodule
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index b075db24e7..c9baef5f7e 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -93,7 +93,7 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase end def test_destroy_association - assert_difference "Person.count", -1 do + assert_difference ["Person.count", "Reader.count"], -1 do posts(:welcome).people.destroy(people(:michael)) end @@ -102,7 +102,7 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase end def test_destroy_all - assert_difference "Person.count", -1 do + assert_difference ["Person.count", "Reader.count"], -1 do posts(:welcome).people.destroy_all end @@ -110,6 +110,12 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase assert posts(:welcome).people(true).empty? end + def test_should_raise_exception_for_destroying_mismatching_records + assert_no_difference ["Person.count", "Reader.count"] do + assert_raise(ActiveRecord::AssociationTypeMismatch) { posts(:welcome).people.destroy(posts(:thinking)) } + end + end + def test_replace_association assert_queries(4){posts(:welcome);people(:david);people(:michael); posts(:welcome).people(true)} |