My migrations load in some default data into my database: a few
categories, a few items, etc.
However, when I test using rake, none of that data is there. I even
went and installed the migrate_test_db plug-in to build my test
database from the migrations rather than schema, but it doesn’t work
because all the data is wiped before each test.
It seems natural to me to run tests based on the same data that’s in
the development database… (or even the production database,
I can use fixtures, but it’s really hard to create them because the
models depend heavily on one another. For example, when I create a
category it automatically creates a statistic and chat box to go along
with it. It’s really hard to manually make sure that all your IDs line
up correctly in your fixtures.
Am I doing this the wrong way? Am I not supposed to load default data
using migrations? Do I have the wrong approach to testing?
Or is there a good way to run tests with existing data?