Skip to content
notahat edited this page Aug 23, 2010 · 7 revisions

Rails 3

In your app’s Gemfile, in the group :test section, add:

gem 'machinist', '>= 2.0.0.beta1'

Then run:

bundle install
rails generate machinist:install

If you want Machinist to automatically add a blueprint to your blueprints file whenever you generate a model, add the following to your config/application.rb in the config.generators section:

g.fixture_replacement :machinist

Rails 2

First, install the Machinist 2 gem:

gem install machinist --pre

…with RSpec

Create a blueprints.rb file to hold your blueprints in your spec/support directory. It should start with:

require 'machinist/active_record'

In your spec/spec_helper.rb, add this inside the Spec::Runner.configure block:

config.before(:each) { Machinist.reset_before_test }

…with Test::Unit

Create a blueprints.rb file to hold your blueprints in your test directory. It should start with:

require 'machinist/active_record'

In your test/test_helper.rb, add this to the requires at the top of the file:

require File.expand_path(File.dirname(__FILE__) + "/blueprints")

and add this inside class ActiveSupport::TestCase:

setup { Machinist.reset_before_test }
Clone this wiki locally