This introduces a couple of things: firstly, there's now a MockFactory
that allows for introspection instead of spying all over the place. This
should make tests a lot less brittle. Secondly, a couple of handy
matchers have been made available to perform assertions against the
mock.
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
Declarations are another layer of abstraction between defining the
factories via the DSL and compiling the factories and their attributes.
Declarations know how to return their attribute(s), and running a
factory compiles the declarations before building all attributes on the
factory. This moves all the attribute compilation logic into one
centralized location on the Factory instance, which means traits (and
potentially other features down the road) can have individual attributes
overridden within child factories or through FactoryGirl.modify
Closes#205