ruby-on-railsrspecirbscript-consolespork

'script/console test' with spork and rspec not loading the whole environment?


I'm trying to load up console to interact with some of my rspec mocking helpers. I expected that running script/console test would load an env similar to when I run spec. However, this doesn't appear to be the case. It looks like spec_helper is never loaded. Or, if it is, it's not actually running through the logic because spork has polluted it a bit.

In short, is there a quick and easy way to get an interactive rspec party going?


Solution

  • You can load rspec with the following once the console is loaded:

    require "#{RAILS_ROOT}/spec/spec_helper"