[rspec-users] Calling script/spec from directories other than RAILS_ROOT

samullen samullen at gmail.com
Wed Aug 11 12:56:34 EDT 2010


I've written a simple shell function which, depending on where it is
called, will ascend the directory tree until it finds ./script/spec
or, failing that, the spec first found in $PATH. What I'm running into
is that although my tests pass when I call script/spec from
RAILS_ROOT, they do not pass when it's called from any other location.
This happens regardless of whether I use my function or call spec
directly.

Examples:
from RAILS_ROOT -
script/spec spec/controllers/actors_controller_spec.rb # Passes

from /home/fooman/rails_project/spec/controllers -
/home/fooman/rails_project/script/spec actors_controller_spec.rb #
FAILS because it can't find 'request'

What do I need to do to run spec for a rails project in a directory
other than RAILS_ROOT?

Thank you,
Samuel Mullen


More information about the rspec-users mailing list