mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
![]() 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 |
||
---|---|---|
.. | ||
attribute | ||
declaration | ||
proxy | ||
aliases_spec.rb | ||
attribute_list_spec.rb | ||
attribute_spec.rb | ||
callback_spec.rb | ||
declaration_list_spec.rb | ||
definition_proxy_spec.rb | ||
definition_spec.rb | ||
deprecated_spec.rb | ||
evaluator_class_definer_spec.rb | ||
factory_spec.rb | ||
find_definitions_spec.rb | ||
null_factory_spec.rb | ||
null_object_spec.rb | ||
proxy_spec.rb | ||
registry_spec.rb | ||
sequence_spec.rb |