ruby-on-railstestingspork

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


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

Gems:

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


Solution

  • 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