Rails endorses fixtures to build and maintain test data in our web apps. Fixtures look very easy at first. Just a YAML file and we auto-magically get users(:john) in our tests.
As our requirements grow, we start fighting with fixtures. How to get ordered records. How to use my own values for ids, timestamps? How to maintain associations? How to generate on the fly dynamic data?
Lets seek answers to these questions by going deep down fixtures internals. In the process we will also see how others like FactoryGirl are doing this task of generating and maintaining test data.