1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
Commit graph

5 commits

Author SHA1 Message Date
Joshua Clayton
e8d32b9254 Move DisallowsDuplicatesRegistry to a decorator 2012-06-08 17:25:18 -04:00
Joshua Clayton
a5b3a97c9d Optionally disable duplicate assignment of attributes in initialize_with
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
2012-05-18 17:38:23 -04:00
Joshua Clayton
2f8731dd7e Allow initialize_with defined for all factories
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
2012-05-12 18:57:28 -04:00
Joshua Clayton
f7efc610fd Allow to_create defined for all factories
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
2012-05-12 18:10:02 -04:00
Joshua Clayton
49392a6a31 Move registries to configuration 2012-05-12 10:27:47 -04:00