-
Notifications
You must be signed in to change notification settings - Fork 134
Machinist 2
Machinist 2 gives you the convenience of Machinist, with the performance of fixtures.
When you make an object, Machinist 2 keeps the object around in the database. If, in a later test, you request an identical object, Machinist will give you the cached copy.
See the page on Object Caching for more information.
Other features:
- Simpler API and simpler implementation
- Better handling of has_many and has_and_belongs_to_many relationships
Machinist 2 is not a drop-in replacement for Machinist 1. Implementing caching has required substantial changes to the API.
- Replace calls to make
with calls to make!
, except within your blueprints.
- Replace calls to make_unsaved
with calls to make
.
- Delete all your Sham definitions, and provide explicit attribute values in all your blueprints. See Serial Numbers for information on handling unique attributes.
- make
has become make!
, and make_unsaved
has become make
.
- You can no longer refer directly to other attributes when defining an attribute in a blueprint; use object
instead.
- Sham has gone away
- There’s no make
method on ActiveRecord associations (yet)
- There’s no support for ORMs other than ActiveRecord (yet)
- Easy support for different construction strategies, e.g. generating all the attributes and passing them to new as a hash (see the strategies branch)
- Support for constructing (and caching) complete graphs of objects in one hit