Factory Girl now allows factories to override object instantiation. This
means factories can use factory methods (e.g. methods other than new) as
well as pass arguments explicitly.
factory :user do
ignore do
things { ["thing 1", "thing 2"] }
end
initialize_with { User.construct_with_things(things) }
end
factory :report_generator do
ignore do
name { "Generic Report" }
data { {:foo => "bar", :baz => "buzz"} }
end
initialize_with { ReportGenerator.new(name, data) }
end
Whitespace
Code recommendations