redding/mr — pull request #128 by jcredding (2013-11-18 20:59:31+00:00)
Title: Re-design the test DB schema, for better tests and bench script

This redesigns the test DB schema to be better setup for using it
with the bench script and for expanding the system tests. This is
prep for using the same DB schema and ActiveRecord in the test
suite and bench script. This was done mostly by:

* Adding a column for each AR column type. These are spread on
different tables, but will allow testing read model's type
casting vs active records.
* Making the associations more "sane". This create a new table
`images`, that is used to define a `has_one` relationship
for users. This is a simpler association than the previous
"favorite comment" one.

This also includes a few cleanups:

* Condense the models, records and fake records into a single
file. This is less "noise" when requiring them, and there
isn't a large need to access the objects individually.
Essentially, the fake's are not used in the unit tests, so
it's fine for them to live with there real records.
* Use factories for creating models/records outside of the
factory tests.
* Don't use the models/records/fake records for the schema in
the unit tests. This unecessarily couples the unit tests to
the schema, which means they have to change if it does.

**Note** This involved a large number of changes because of the
"coupling" between the system tests. Though this is like the
anti-pattern mentioned previously (having specific support
files/logic for multiple tests), this is mostly a necessary evil
when interacting with the DB. Though it is probably possible to
re-design the DB for different tests, I don't think the overhead
and speed hit to the test suite is worth it.