A couple of months back, I wrote a minimal install guide for machinist_mongo by @nmerouze and @shingara. Back then it was called machinist_mongomapper, it didn’t support Mongoid yet and the Rails beta hadn’t even been released yet, so I think it’s about time for an update.
You know Machinist, right? Here’s the short explanation:
“Fixtures aren’t fun. Machinist is.
Machinist makes it easy to create test data within your tests. It generates data for the fields you don’t care about, and constructs any necessary associated objects, leaving you to only specify the fields you do care about in your tests.”
I’m not going to go into Machinist itself here, so be sure to read the README.
On to installing machinist_mongo. Put this in your
$ bundle install
Or — if you’re using Rails 2.x — put this in
$ rake gems:install
require 'machinist/mongo_mapper' # or mongoid require 'sham'
Don’t forget to require the new
blueprints.rb file in your
require File.expand_path(File.dirname(__FILE__) + "/blueprints")
And you’re all set. Again, be sure read Machinist’s README to find out how to create your objects and get this thing running.
machinist_mongo aims to support all mongoDB ORMs, so If you’re using something other than MongoMapper or Mongoid, please be sure to write a adapter for it. Also, can anyone tell me why this isn’t merged into Machinist itself? Because I think it should.