Copied from the site http://github.com/notahat/machinist/
Machinist makes it easy to create test data within your tests. It generates data for the fields you don't care about, and constructs any necessary associated objects, leaving you to only specify the fields you do care about in your tests
A simple blueprint might look like this:
Post.blueprint do title { Sham.title } author { Sham.name } body { Sham.body } end
You can then construct a Post from this blueprint with:
Post.make
When you call make, Machinist calls Post.new, then runs through the attributes in your blueprint, calling the block for each attribute to generate a value. The Post is then saved and reloaded. An exception is thrown if Post can't be saved.