[rspec-users] (LoadError) no such file to load when using rspec 2.0.0.beta.7, rails 3.0.0.beta3 and ruby 1.9.2 with RVM

David Chelimsky dchelimsky at gmail.com
Tue Apr 27 18:42:04 EDT 2010


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

> 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 at logicmail$ spec spec/controllers/accounts_controller_spec.rb
> /Users/damselem/.rvm/gems/ruby-1.9.2-head at 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 at rails3/gems/rspec-
> core-2.0.0.beta.7/lib/rspec/core/configuration.rb:233:in `block in
> require_files_to_run'
> 	from /Users/damselem/.rvm/gems/ruby-1.9.2-head at 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 at rails3/gems/rspec-
> core-2.0.0.beta.7/lib/rspec/core/configuration.rb:233:in
> `require_files_to_run'
> 	from /Users/damselem/.rvm/gems/ruby-1.9.2-head at 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 at rails3/gems/rspec-
> core-2.0.0.beta.7/lib/rspec/core/runner.rb:24:in `run'
> 	from /Users/damselem/.rvm/gems/ruby-1.9.2-head at 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?

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

> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list