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

2

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?

Chicalote answered 7/6, 2010 at 4:7 Comment(0)
A
2

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

require "#{RAILS_ROOT}/spec/spec_helper"

Amagasaki answered 21/1, 2011 at 6:36 Comment(2)
require "#{Rails::root.to_s}/spec/spec_helper"Fritzsche
FYI this answer is substantially out of date (no criticism of answerers, just warning newcomers :-)Paisano
S
0

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

require "#{Rails.root}/spec/spec_helper"
Sirloin answered 13/6, 2016 at 15:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.