test case on has_one :through after a destroy

[#6037 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
John Hawthorn 2010-11-28 20:07:59 -08:00 committed by José Valim
parent e444439fe2
commit 28896a9f4a
1 changed files with 17 additions and 0 deletions

View File

@ -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