By setting:
FactoryGirl.duplicate_attribute_assignment_from_initialize_with =
false
This turns off duplicate assignment of attributes accessed from
initialize_with. This means any attributes accessed from the factory and
assigned in the initialize_with block won't be subsequently set after
the object has been instantiated.
This will be the default functionality in 4.0.
Closes#345
This allows users to define initialize_with for every factory run through
factory_girl.
FactoryGirl.define do
initialize_with { new("John Doe") }
end
If you want to override this default, set it per factory or in a trait
(and include the trait).
Closes#342
This allows users to define to_create for every factory run through
factory_girl.
FactoryGirl.define do
to_create {|instance| instance.persist! }
end
If you want to override this default, set it per factory or in a trait
(and include the trait).
Closes#341