diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2010-11-28 20:07:59 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-29 10:48:48 +0100 |
commit | 28896a9f4ae0830726619bc479f69263acb80e4b (patch) | |
tree | 660ac50d9548f7b34349a29648cd2603f2590a6f /activerecord/test/cases/associations | |
parent | e444439fe28f873c783a4b99b1c9f29a7405dd0d (diff) | |
download | rails-28896a9f4ae0830726619bc479f69263acb80e4b.tar.gz rails-28896a9f4ae0830726619bc479f69263acb80e4b.tar.bz2 rails-28896a9f4ae0830726619bc479f69263acb80e4b.zip |
test case on has_one :through after a destroy
[#6037 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_one_through_associations_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_one_through_associations_test.rb b/activerecord/test/cases/associations/has_one_through_associations_test.rb index 5d153147f5..ac43e571cb 100644 --- a/activerecord/test/cases/associations/has_one_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_through_associations_test.rb @@ -206,6 +206,23 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase end end + def test_through_belongs_to_after_destroy + @member_detail = MemberDetail.new(:extra_data => 'Extra') + @member.member_detail = @member_detail + @member.save! + + assert_not_nil @member_detail.member_type + @member_detail.destroy + assert_queries(1) do + assert_not_nil @member_detail.member_type(true) + end + + @member_detail.member.destroy + assert_queries(1) do + assert_nil @member_detail.member_type(true) + end + end + def test_value_is_properly_quoted minivan = Minivan.find('m1') assert_nothing_raised do |