hotsh/rstat.us — pull request #727 by carols10cents (2012-11-21 02:52:51+00:00)
Title: Faster tests

This follows the recommendation in the first fastrailstests.com newsletter i've gotten that we should avoid fabricating objects whenever possible. Especially avoiding saving objects to the database, but also avoid building associated objects that aren't needed for the test.

I also took this opportunity to minimize the number of fabricated objects in some of the tests.

Before this change:

$ time rake test:models
real 1m41.507s

$ time rake test:decorators
real 0m27.177s

After this change:

$ time rake test:models
real	1m34.589s

$ time rake test:decorators
real	0m29.138s

Soooo... meh, not that big a difference, but I think these improvements are good regardless.