Speeding up your tests by selectively persisting data
Aug 14, 2014
I follow the thoughtbot blog very closely, and today they posted about speeding up tests by selectively avoiding factory girl. This was enlightening on multiple levels.
Benchmarking their own gems
For me it was extremely enlightening to see a company, who does a lot of gem work, benchmark their own gem. It was great to see that they don’t always use FactoryGirl in their test suites.
Okay to not always be persisting data
It was awesome to see that a company so highly thought of say that it is okay to not persist data in your specs. I have been using FactoryGirl for a few years now, and admittedly probably too much. I thought that it was always necessary to persist the data, but to see that its 100% faster to not persist data is going to make me think twice next time I create a test.
Go test things and don’t always persisting data!