Setting up the data for my rails server is non trivial, it includes
schema creation, seeding the database with seed data, running indexing
I want to write functional tests that use the seed data and indices.
However, each time I run the functional tests, the db schema gets
dropped and re-created. Is there a way to preserve existing schema
and not re-create it each time?
Then it wouldn’t be a test.
You need to test by running each step in the setup for the test for the
subsequent step. Test seeding by asserting the DB is empty (or by
fixtures out!), call the seed method, and assert the database is seeded.
indexing by seeding the database, asserting ferret is unindexed, calling
indexer, and asserting ferret can find data. And so on.
Test isolation is very important, and ActiveRecord will fight
you to preserve it. AR will think that you have simply neglected to tear
some database detail, and will diligently tear it down for you!