6

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?

John Topley
  • 113,588
  • 46
  • 195
  • 237
Dane O'Connor
  • 75,180
  • 37
  • 119
  • 173

2 Answers2

2

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

require "#{RAILS_ROOT}/spec/spec_helper"

vrish88
  • 20,047
  • 8
  • 38
  • 56
0

RAILS_ROOT is long-since deprecated. You can now load rspec in the console thus:

require "#{Rails.root}/spec/spec_helper"
MrTheWalrus
  • 9,670
  • 2
  • 42
  • 66