diff options
author | Mislav Marohnić <mislav.marohnic@gmail.com> | 2010-07-08 13:58:23 +0200 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-07-08 11:35:17 -0700 |
commit | 00f1cd71a97bfa79e6b62a870b09ca914c48e421 (patch) | |
tree | 9345dfb3da419b80e32ce8c0d22c90dd70a49983 /activerecord/test/cases/associations | |
parent | 951dbf06b4177b1c3d912213166ca0b14374a48b (diff) | |
download | rails-00f1cd71a97bfa79e6b62a870b09ca914c48e421.tar.gz rails-00f1cd71a97bfa79e6b62a870b09ca914c48e421.tar.bz2 rails-00f1cd71a97bfa79e6b62a870b09ca914c48e421.zip |
fix ActiveRecord `destroy_all` so it returns destroyed records
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 5e3ba778f3..a52cedd8c2 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -817,8 +817,11 @@ class HasManyAssociationsTest < ActiveRecord::TestCase def test_destroy_all force_signal37_to_load_all_clients_of_firm - assert !companies(:first_firm).clients_of_firm.empty?, "37signals has clients after load" - companies(:first_firm).clients_of_firm.destroy_all + clients = companies(:first_firm).clients_of_firm.to_a + assert !clients.empty?, "37signals has clients after load" + destroyed = companies(:first_firm).clients_of_firm.destroy_all + assert_equal clients.sort_by(&:id), destroyed.sort_by(&:id) + assert destroyed.all? { |client| client.frozen? }, "destroyed clients should be frozen" assert companies(:first_firm).clients_of_firm.empty?, "37signals has no clients after destroy all" assert companies(:first_firm).clients_of_firm(true).empty?, "37signals has no clients after destroy all and refresh" end |