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

13 commits

Author SHA1 Message Date
Ken Collins
4b83b1e62e Factory overrides are applied before other attributes. Fixes #140. 2011-08-08 13:48:33 -04:00
Flavio Castelli
28f541eefc Ensure static attributes are executed before dynamic ones.
Static attributes must be executed first because dynamic attributes might
rely on them. This is really important when using the :parent relationship.

Previous code didn't work fine in situations like this one:
  Factory.define(:generic_user, :class => User) do |u|
    u.email { |user| "#{user.name}@example.com }
  end

  Factory.define(:flavio, :parent => :generic_user) do |u|
    u.name "flavio"
  end

When building a :user object the previous code would have set the email
attribute and then the name attribute. This results in a user object with
an invalid email address: the 'name' attribute is yet not set while the
'email' attribute is evaluated.

Closes #159
2011-08-05 11:11:34 -04:00
Joe Ferris
c59981de1b Split factories/sequences into separate registries most of the time;
Only use factories from step definitions
2011-05-25 20:08:59 -04:00
Joe Ferris
8b4a6a1c3a Moved definition loading syntax out of the factory class; moved everything into a FactoryGirl module 2010-07-06 20:22:02 -04:00
Tristan Dunn
3e577f3cd5 Clean up whitespace. 2010-06-07 15:51:18 -04:00
Peter Suschlik
263e7be9da Fix exception message when defining attr writer.
Before this patch the message looked like:
factory_girl uses 'f.test value' syntax rather than 'f.test= = value'

Signed-off-by: Nick Quaranto <nick@quaran.to>
2009-04-20 17:09:20 -04:00
Joe Ferris
deeed519d5 Updated and improved the documentation 2009-02-17 16:38:44 -05:00
Joe Ferris
56e31cae8c Split static and dynamic attributes into separate classes 2009-01-02 17:33:00 -05:00
Joe Ferris
cbdc2ae429 Renamed Strategy to Proxy 2009-01-02 16:39:24 -05:00
Joe Ferris
c6fdc94a75 Merged AttributeProxy with Strategy 2009-01-02 16:27:58 -05:00
Joe Ferris
a275fb53d4 Refactored Attribute to accept a Strategy instead of an AttributeProxy for value 2008-12-30 15:21:17 -05:00
Joe Ferris
38bc8965db Moved attribute validation into the Attribute class 2008-07-30 13:59:58 -04:00
Joe Ferris
03fa0d1180 Refactored attributes into their own class 2008-07-30 13:46:06 -04:00