I've been playing a bit with some patches to make the fixture loading
and management code a little bit easier to maintain. If I were to
start chopping out features, how would you feel about losing:
Never used, don't really care if that's gone.
Old school single-file fixtures,
Not sure what you mean here, is there some old-school fixture format
different from the usual tablename.yml fixtures or do you want to remove
the per-table yaml fixtures?
Never used, but I could imagine those being useful to someone.
The ability to specify a subset of fixtures (everything's always
I have always preferred loading all fixtures together because I like
using foreign keys which make it hard to only load some of the tables.
The ability to disable transactional fixtures,
I've always used transactional fixtures, but the problem is that right
now there are no nested transactions in rails which makes it hard to
test something that uses a transaction if the test itself is already
inside a transaction. I use a plugin, that allows nested transactions,
which should work with both postgresql and mysql but I don't think
all databases can even support nested transactions so removing the
ability to turn transactions off for some tests may not be a good idea.
or intrafixture ordering (OMap).
I've only used this a couple of times to be able to load fixtures for
a table that had a self-referential foreign key. Now that we have
the ability to load fixtures while ignoring foreign keys there does
not seem to be much value in ordered fixtures.
I'm not suggesting that any of these should necessarily disappear: I'm
just interested in hearing what you think. Fire away.
One thing that currently annoys me is that if you have a lot of fixture
data (in my case 4MB, a lot of small rows) it takes a couple of seconds
to load the data before the tests start. When just running all the tests
the time is not that long but when running just a single file it takes
more time to load the fixtures than it takes to run the tests.
When using autotest it becomes quite annoying to wait a couple of
seconds before each test run.
Since fixtures and database schema do not change that often it should
be possible to just load the fixtures once to the database and, if all
the tests run inside a transaction, on the next test run just load some
cache where only the fixture keys are held because technically that is
the only data that the database at that point does not already have.
Any ideas on the feasability of something like this?