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 ff79919..1d3feea 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -85,6 +85,17 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase assert posts(:thinking).reload.people(true).collect(&:first_name).include?("Ted") end + def test_associate_by_saving_association + person1 = posts(:thinking).people.build(:first_name=>"Bob") + person2 = posts(:thinking).people.new(:first_name=>"Ted") + + person1.save + person2.save + + assert posts(:thinking).reload.people(true).collect(&:first_name).include?("Bob") + assert posts(:thinking).reload.people(true).collect(&:first_name).include?("Ted") + end + def test_delete_association assert_queries(2){posts(:welcome);people(:michael); }