Thought this may be of interest to some, as it means not editing the
generated spec_helper anymore.
With rspec 1.3.0 and rspec-rails 1.3.2 spec_helper now contains the
following:
> Requires supporting files with custom matchers and macros, etc,
> in ./support/ and its subdirectories.
>ir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
Which means you can do this:
spec/support/blueprints.rb
>require 'machinist/active_record'
>require 'sham'
>require 'faker'
>
>Spec::Runner.configure do |config|
> config.before(:all) { Sham.reset(:before_all) }
> config.before(:each) { Sham.reset(:before_each) }
>end
># blueprints follow…
and so on, and they will be auto-loaded when you run your specs.
The only snag I hit so far is if you have your blueprints in a
blueprints/ directory which you were requiring in then rspec may beat
you to it, and try to interpret them before machinist has been loaded.
Errors abound.
I expect this is easily fixed by putting require ../blueprints at the
top of said files, but I just stuck them back into the blueprints file
for now as it's a new project with only a couple of models.
I think this is kinda cool, it reminds me of how cucumber does this
now, and although I update rspec less frequently than cucumber it
still seems like a better option than customising the generated files
(which will then clash on update later).