Hi,
My test case has two fixtures and eight methods. But one of the eight
methods need one more fixture. How do I solve this? Okay, I put the
additional fixture in common place so every method has additional access
to the additional fixture. The problem is the additional fixture depend
on that two fixtures (foreign key). When I run the test, it complains
something like this:
ActiveRecord::StatementInvalid: PGError: ERROR: update or delete on
“quartz_heater_order_letters” violates foreign key constraint
“quartz_heater_jobs_quartz_heater_order_letter_id_fkey” on
“quartz_heater_jobs”
DETAIL: Key (id)=(1) is still referenced from table
“quartz_heater_jobs”.
: DELETE FROM quartz_heater_order_letters
So how do I create fixture manually and destroy it manually in method?
Something like this:
def test_blabla
create_fixture for quartz_heater_jobs
blablabla
destroy fixture for quartz_heater_jobs
end