From a08bd23131ba28ae6b03cae737f9a4c10758d533 Mon Sep 17 00:00:00 2001 From: Martin Andert Date: Mon, 16 Mar 2009 10:10:09 +0100 Subject: [PATCH] Add failing test for has_many :through association --- .../has_many_through_associations_test.rb | 13 +++++++++++++ 1 files changed, 13 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 97efca7..7261c51 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -276,4 +276,17 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase def test_has_many_association_through_a_has_many_association_with_nonstandard_primary_keys assert_equal 1, owners(:blackbeard).toys.count end + + def test_destroy_should_delete_through_reflection_record + post = posts(:welcome) + person = people(:david) + + assert_difference "Reader.count", +1 do + post.people << person + end + + assert_difference "Reader.count", -1 do + post.people.destroy << person + end + end end -- 1.5.4.3