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

9 commits

Author SHA1 Message Date
Joshua Clayton
6c29b11477 Use 1.9 hash syntax 2012-03-16 16:43:23 -04:00
Joshua Clayton
3114dcd935 Wrap up DeclarationList
DeclarationList knows how to generate an attribute
list, which never really made sense outside of being generated from
declarations. Now, the declaration list builds a list of attributes
which is combined in Factory#attributes with attributes from traits and
its parents.
2011-10-31 19:05:34 -04:00
Joshua Clayton
41bc3ac5ff Add FactoryGirl::Definition
Both Factory and Trait have similar methods and interact with a
DefinitionProxy. The idea here is to move the interface DefinitionProxy
expects to a separate class and both Factory and Trait can delegate to
an instance of Definition.
2011-10-30 23:17:03 -04:00
Joshua Clayton
f721bc6b83 Initial work on DeclarationList and cleaning up AttributeList 2011-10-30 23:17:02 -04:00
Joshua Clayton
180eb8bec7 Refactor definition_proxy_spec
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.
2011-10-14 17:21:29 -04:00
Joe Ferris and Josh Clayton
a154e64da1 Introduce declarations
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
2011-09-23 13:14:02 -04:00
Joe Ferris
0f87ca3aa9 Use objects, not structs 2011-09-16 17:48:06 -04:00
Joe Ferris
4d30663a5b Callbacks aren't attributes 2011-09-16 17:48:06 -04:00
Joshua Clayton
1c74d9d6ec Rename attribute groups to traits 2011-08-12 16:24:58 -04:00
Renamed from lib/factory_girl/attribute_group.rb (Browse further)