Rails 3 load issue
Closed this issue · 5 comments
I currently have the following setup:
- rails 3.0.0.beta4
- rspec 2.0.0.beta.12
- mongoid 2.0.0.beta7
- machinist 1.0.6
- machinist_mongo 1.1.0
When running any spec task, the mongo documents will be loaded with the Machinist::ObjectAdapter instead of the Mongoid one. However, running the rails console and requiring 'spec/spec_helper' creates the expected behavior.
I currently patched this (horribly) by changing my blueprints.rb file:
#require 'machinist/object'
require 'machinist/mongoid'
#more requires
class Object
include Machinist::Blueprints
include Machinist::MongoidExtensions::Document
end
#Blueprint definitions
This is clearly far from ideal. What could be causing this behavior?
Thanks!
I have this working here. I remember that I had to tweak something though.
Do you have this in your gemfile?
gem 'machinist_mongo', :require => 'machinist/mongoid'
That did it! Thanks a bunch.
Should this be mentioned in the readme, to avoid other people from stumbling on it?
Guess so :-)
Yep you're right, I will edit the README soon. For Rails 3 + RSpec 2 you should use machinist_mongo 2.0.0.pre or the git master.
Good point, I missed that one (maybe add a note in the README too?). Thanks for your help!