I’ve been working more on factories-and-workers
Yesterday I came up with the idea to make a rake task to ease the initial entry into factory-land. It grabs info from the schema, via the model.columns hash, and prints out a factory template, to be pasted and edited in your factories.rb file.
Check it out:
dfl% rake factory:generate MODEL=task_estimate
factory :task_estimate, {
:task => :belongs_to_model,
:date => lambda{ Time.zone.today - 7 },
:hours => 1.23,
}
If called without the MODEL argument, it will print factory templates for all models.

Leave a Reply