gaussd
gaussd

Reputation: 899

Ruby RSpec "no such file to load" Error

I'm struggeling with RSpec, I just can't get RSpec to work in my Ruby project. Not even in the easy example provided in the "Get Started Now" section of the official homepage of RSpec: http://rspec.info/

So I take the code from the official example and create bowling.rb and bowling_spec.rb. When i try to run rspec from the console with:

rspec bowling_spec.rb --format nested

I get this output:

require': no such file to load -- bowling (LoadError)
from C:/.../Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/.../bowling_spec.rb:2:in `<top (required)>'
from C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load'
from C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
from C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
from C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
from C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
from C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
from C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
from C:/.../Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun'

I tried to run RSpec on my own project with Netbans 7.0.1 as well as with Aptanda Studio 3. I always get this same error. The gem list show the following rspec gems:

Can anybody help me with this?

Upvotes: 3

Views: 9545

Answers (2)

davetron5000
davetron5000

Reputation: 24891

For posterity, I had this problem, too, and the issue was that I had accidentally require'ed spec_helper.rb in a non-spec class in a gem. That was fun to find.

Upvotes: 1

gaussd
gaussd

Reputation: 899

The Solution for getting it to work in Netbeans too is to maunally install Rspec, since Netbeans doesn't have RSpec Version 2 support:

gem install rspec -v 1.3.2

Upvotes: 1

Related Questions