I would like to get machinist, machinist_mongo, mongo_mapper, cucumber and pickle to play nice together.
Currently I have machinist with all my blueprints configured and am using cucumber to do BDD. So far so good. My problem is I am having to write custom cucumber steps for all of my machinist blueprints. It is not really a problem per se, since it is not stopping me in my tracks, but as a .NET dev checking out rails, it feels really dirty to have to write a step for each blueprint whereas in .NET I could probably use reflection.
Is there any way I can get pickle's built in capture_model
, capture_plural_factory
, etc, to recognize my machinist blueprints?
I am pretty confident I have machinist configured and set up correctly, because when I use blueprintname.make
, in a custom cucumber step, everything works out correctly.
Gem versions:
rails 2.3.8
cucumber 0.8.3
cucumber-rails 0.3.2
mongo 1.0.5
mongo_mapper 0.8.2
pickle 0.3.0
machinist 1.0.6
machinist_mongo 1.1.1
features/support/pickle.rb:
require 'pickle/world'
Pickle.configure do |config|
config.adapters = [:machinist]
end
I tried using config.adapters = [:machinist, Machinist::MongoMapperAdapter]
but I get an error stating that there is no method factories
for Machinist::MongoMapperAdapter
.
features/support/machinist.rb:undefined method `factories' for Machinist::MongoMapperAdapter:Class (NoMethodError) /usr/local/lib/ruby/gems/1.8/gems/pickle-0.3.0/lib/pickle/config.rb:25:in `factories'
require 'machinist'
require 'machinist/mongo_mapper'
require "#{Rails.root}/spec/blueprints"
require 'database_cleaner'
Before { Sham.reset } # reset Shams in between scenarios
spec/blueprints.rb (truncated for clarity)
require 'sham'
require 'faker'
Sham.code { Faker::Lorem.words 1 }
AccessCode.blueprint do
code
end
app/models/access_code.rb
class AccessCode
include MongoMapper::Document
key :code, String, :required => true
end