Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Machinist 2

notahat edited this page · 16 revisions

What’s New?

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.

Upgrading

- 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.

What’s Changed?

- 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.

What’s Missing?

- Sham has gone away
- There’s no make method on ActiveRecord associations (yet)
- There’s no support for ORMs other than ActiveRecord (yet)

What’s Still to Come?

- 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

Something went wrong with that request. Please try again.