Permalink
Browse files

test case on has_one :through after a destroy

[#6037 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
jhawthorn authored and josevalim committed Nov 29, 2010
1 parent e444439 commit 28896a9f4ae0830726619bc479f69263acb80e4b
Showing with 17 additions and 0 deletions.
  1. +17 −0 activerecord/test/cases/associations/has_one_through_associations_test.rb
@@ -206,6 +206,23 @@ def test_save_of_record_with_loaded_has_one_through
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

0 comments on commit 28896a9

Please sign in to comment.