Why don''t you forget about having it as a fixture and just create it
with ActiveRecord in your test method?
On 12/14/06, Akbar Home
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> 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
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---