(LoadError) no such file to load when using rspec 2.0.0.beta.7, rails 3.0.0.beta3 and ruby 1.9.2 wi

I am trying to run a test for a controller with the “spec” command
like this: spec spec/controllers/account_controller_spec.rb and this
is the result:

damselem@logicmail$ spec spec/controllers/accounts_controller_spec.rb
/Users/damselem/.rvm/gems/ruby-1.9.2-head@rails3/gems/rspec-
core-2.0.0.beta.7/lib/rspec/core/configuration.rb:233:in require': no such file to load -- spec/controllers/accounts_controller_spec.rb (LoadError) from /Users/damselem/.rvm/gems/ruby-1.9.2-head@rails3/gems/rspec- core-2.0.0.beta.7/lib/rspec/core/configuration.rb:233:inblock in
require_files_to_run’
from /Users/damselem/.rvm/gems/ruby-1.9.2-head@rails3/gems/rspec-
core-2.0.0.beta.7/lib/rspec/core/configuration.rb:233:in map' from /Users/damselem/.rvm/gems/ruby-1.9.2-head@rails3/gems/rspec- core-2.0.0.beta.7/lib/rspec/core/configuration.rb:233:inrequire_files_to_run’
from /Users/damselem/.rvm/gems/ruby-1.9.2-head@rails3/gems/rspec-
core-2.0.0.beta.7/lib/rspec/core/runner.rb:37:in configure' from /Users/damselem/.rvm/gems/ruby-1.9.2-head@rails3/gems/rspec- core-2.0.0.beta.7/lib/rspec/core/runner.rb:24:inrun’
from /Users/damselem/.rvm/gems/ruby-1.9.2-head@rails3/gems/rspec-
core-2.0.0.beta.7/lib/rspec/core/runner.rb:12:in `block in autorun’

When using “ruby -Ispec spec/controllers/account_controller_spec.rb”
everything works fine. Then, I thought that could be a problem with
the path to the controller spec, so I tried:

“spec ~/Documents/Freelancing/Projects/logicmail/spec/controllers/
accounts_controller_spec.rb” which worked fine. Does anybody know why
is this happening? In the previous versions of rspec, I could run the
first command without any problem, but now I have to use either the
last command with an absolute path or:

“spec -I . spec/controllers/accounts_controller_spec.rb”

Any thought on this?

On Apr 23, 2010, at 8:25 AM, Daniel Salmeron A. wrote:

core-2.0.0.beta.7/lib/rspec/core/configuration.rb:233:in `block in
from /Users/damselem/.rvm/gems/ruby-1.9.2-head@rails3/gems/rspec-
last command with an absolute path or:

“spec -I . spec/controllers/accounts_controller_spec.rb”

Any thought on this?

ruby-1.9.2 does not add “.” to the load path, so you do need to either
add . yourself (with -I) or just prefix the path with ./

rspec ./spec/controllers/accounts_controller_spec.rb

HTH,
David