Maybe I’m not getting fixtures, but… I’m having problems as I start
fixtures in functional tests.
Data is left in my test database after running functional tests. Not the
created by the test-method (I’m using transactional fixtures), but data
fixtures themselves. Fixture loading will delete & reload the data again
the test is re-run, but that doesn’t solve the problems.
Example: Say you have fixture data for tables customers, addresses, and
Addresses and phones both belong to customers. I run a functional test
loads fixtures for customers and addresses; it works great. However, the
data still remains in the database (Postgres 8.1, BTW) after the test
Now let’s say I run write a test for customer’s phones. It loads
phones and customers. Except that it will fail trying to delete the
customers, because they still have dependent addresses tied to them in
database. End of test. Crash & burn.
I could add :addresses to the fixtures call in the phone functional
test. But 1)
addresses have nothing to do with phones except that they both belong to
customer, and 2) following this logic, I’ll soon have to load nearly
fixture in the system for most functional tests.
Am I doing something wrong here? This seems like such a glaringly
that my assumption is that I’m using fixtures wrong. What’s the proper
use fixtures and insulate test cases from each other?