diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-30 19:07:08 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-02-07 23:35:05 +0000 |
commit | d55406d2e991056b08f69eb68bcf9b17da807b6c (patch) | |
tree | 239edd0fef82a334309734b92639740a7e7c73db /activerecord/test/cases/associations/has_many_through_associations_test.rb | |
parent | 5f1ea2a26b6e29f235e132d565b53f12e0234c66 (diff) | |
download | rails-d55406d2e991056b08f69eb68bcf9b17da807b6c.tar.gz rails-d55406d2e991056b08f69eb68bcf9b17da807b6c.tar.bz2 rails-d55406d2e991056b08f69eb68bcf9b17da807b6c.zip |
Make record.association.destroy(*records) on habtm and hm:t only delete records in the join table. This is to make the destroy method more consistent across the different types of associations. For more details see the CHANGELOG entry.
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 | 12 |
1 files changed, 8 insertions, 4 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 96f4597726..6830478107 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -128,8 +128,10 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase end def test_destroy_association - assert_difference ["Person.count", "Reader.count"], -1 do - posts(:welcome).people.destroy(people(:michael)) + assert_no_difference "Person.count" do + assert_difference "Reader.count", -1 do + posts(:welcome).people.destroy(people(:michael)) + end end assert posts(:welcome).reload.people.empty? @@ -137,8 +139,10 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase end def test_destroy_all - assert_difference ["Person.count", "Reader.count"], -1 do - posts(:welcome).people.destroy_all + assert_no_difference "Person.count" do + assert_difference "Reader.count", -1 do + posts(:welcome).people.destroy_all + end end assert posts(:welcome).reload.people.empty? |