diff options
author | Luca Guidi <guidi.luca@gmail.com> | 2009-03-12 15:24:37 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-03-12 15:24:37 +0000 |
commit | 47bdf3bf40ec17e1f8ca1c0e3d7f697d0c4cd1bf (patch) | |
tree | f51d913ccb78d87f47cc93a4c6c17e450013d9d3 /activerecord/test/cases/associations/has_many_through_associations_test.rb | |
parent | 91b98cf0a5417ce4042a0b3cd1930d5a221b737f (diff) | |
download | rails-47bdf3bf40ec17e1f8ca1c0e3d7f697d0c4cd1bf.tar.gz rails-47bdf3bf40ec17e1f8ca1c0e3d7f697d0c4cd1bf.tar.bz2 rails-47bdf3bf40ec17e1f8ca1c0e3d7f697d0c4cd1bf.zip |
Ensure AutosaveAssociation runs remove callbacks [#2146 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/cases/associations/has_many_through_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 18 |
1 files changed, 18 insertions, 0 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 c3ad0ee6de..97efca7891 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -92,6 +92,24 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase assert posts(:welcome).reload.people(true).empty? end + def test_destroy_association + assert_difference "Person.count", -1 do + posts(:welcome).people.destroy(people(:michael)) + end + + assert posts(:welcome).reload.people.empty? + assert posts(:welcome).people(true).empty? + end + + def test_destroy_all + assert_difference "Person.count", -1 do + posts(:welcome).people.destroy_all + end + + assert posts(:welcome).reload.people.empty? + assert posts(:welcome).people(true).empty? + end + def test_replace_association assert_queries(4){posts(:welcome);people(:david);people(:michael); posts(:welcome).people(true)} |