I really enjoy using Factory Girl to customize my tests. I can build association chains in one line. For instance:
Factory.create(:manuscript)
Automatically creates a magazine, magazine owner, manuscript author, etc. This allows me to keep my tuners really simple and fantastic.
However, of course, there is a cost. Creating multiple objects in the background means that my unit tests sometimes reach 0.8 seconds. This is great when your application is small, but now I have several hundred tests, and my specifications take a minute to work (not including the time it takes for the application to freeze). It starts to feel pain.
I'm not particularly interested in being as sharp as a mockery. At least while my application is relatively small, I would like to keep the abstractions of the Factory girls. I just want to figure out how to make them work a little faster.
Any suggestions?
source
share