calling ignore on individual declarations.
Old syntax:
factory :user do
rockstar(true).ignore
four { 2 + 2 }.ignore
name { "John Doe#{" - Rockstar" if rockstar}" }
end
New syntax:
factory :user do
ignore do
rockstar true
four { 2 + 2 }
end
name { "John Doe#{" - Rockstar" if rockstar}" }
end
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
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>