Postgres, Foriegn Key constraints causing too many fixtures

Hey there,

Basically since we’re using postgres and have FKEY constraints on the
tables, unit testing a model will require at bunch of fixtures to be
included for other models. I understand why that’s needed. It just
smell’s funny that I have 10 fixtures included in a unit test for a
model. I’m wondering if anyone else has figured out a way around this?
Is there a way to disable FKEY constraints on postgres when the db is
loaded with fixtures or some other solution?

Thanks,
Alex

On 9/12/06, [email protected] [email protected] wrote:

Basically since we’re using postgres and have FKEY constraints on the
tables, unit testing a model will require at bunch of fixtures to be
included for other models. I understand why that’s needed. It just
smell’s funny that I have 10 fixtures included in a unit test for a
model. I’m wondering if anyone else has figured out a way around this?
Is there a way to disable FKEY constraints on postgres when the db is
loaded with fixtures or some other solution?

If you’re using transactional fixtures (on by default) you don’t incur
the
insert/delete penalty between tests, so no worries. Consider declaring
all
your fixtures at once in test/test_helper.rb and omitting the per-test
declarations.

jeremy