How do you load Machinist's blueprints when using Spork?

2.3k views Asked by At

How do you load Machinist's blueprints when using Spork?

Gems:

  • mongoid (2.0.0.rc.6)
  • capybara (0.4.1.1)
  • steak (1.1.0)
  • spork (0.9.0.rc2)
  • rspec (2.4.0)
  • machinist (2.0.0.beta2)

I get this error in every acceptance test:

Machinist::NoBlueprintError:
   No master blueprint defined for class School

All test fail, because it doesn't find any blueprint. I some of these errors on V2(I still get a couple of No master blueprint..), but I get another error too:

Professor Create a new professor
 Failure/Error: click_link("Profesores")
 RangeError:
   0x000000821461e4 is recycled object

I got config.cache_classes = false in test environment for this one.

Both spec_helper versions:

https://gist.github.com/801814

1

There are 1 answers

4
2potatocakes On BEST ANSWER

Just to rule out the obvious have you included something like this in your application.rb file:

config.generators do |g|
  g.fixture_replacement :machinist      
end

Also have you set up your blueprints files in:

features/support/blueprints.rb for cucumber   
spec/support/blueprints.rb for rspec

and made sure you've included:

require 'machinist/active_record'

in the top of your blueprints.

Also just on another note for when you get it up and running. Machinist caches a lot of objects to make it run faster, but it may occasionally trip you up when constantly trying to clear out the database. If you run into problems you can turn off Machinists caching by adding this to your config/environments/test.rb file:

Machinist.configure do |config|
  config.cache_objects = false
end