Question

How do you prefer to organize your test data in Ruby On Rails: fixtures, object factories or anything else? Why?

Was it helpful?

Solution

Object factories are far less brittle than fixtures, and when they break because you've been mucking around with the database schema, there's much less work to do to fix them. Some gems also know how to intelligently auto-construct associations between factory objects.

Factory Girl and Machinist are currently in vogue right now. I use Faker, too, to generate random strings; not strictly necessary, but kind of fun.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top