mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
![]() 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 |
||
---|---|---|
.. | ||
acceptance | ||
factory_girl | ||
factory_girl_spec.rb | ||
spec_helper.rb |