Search code examples
rubyrspecrspec-rails

rspec Cannot load such file after working the first time


When running through the rspec course in codeschool I keep running into the same problem. I will set up as requested and after creating zombie_spec.rb and running rspec I get the proper output listed below:

Justins-MacBook-Pro:rubyproject Justin$ rspec spec/lib/zombie_spec.rb 
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true} 
*

Pending: 
  A Zombie is named Ash 
    # Not yet implemented 
    # ./spec/lib/zombie_spec.rb:3

Finished in 0.00929 seconds 
1 example, 0 failures, 1 pending

Randomized with seed 7259

As I continue on with the first video and create the class Zombie as mentioned I receive this error when running rspec again:

Justins-MacBook-Pro:rubyproject Justin$ rspec spec/lib/zombie_spec.rb 
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- zombie (LoadError) 
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
from /Users/Justin/rubyproject/spec/lib/zombie_spec.rb:2:in `<top (required)>' 
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load' 
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files' 
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each' 
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files' 
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run' 
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run' 
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

After this I removed everything and uninstalled and reinstalled rspec. Retried it again and returned the same results.

Any clue what is going on?

Thank you in advance for your help!


Solution

  • I had pretty much the same issue, though mine never worked even once at first. Updating the zombie_spec.rb file to show the full path of my zombie.rb file seemed to get it working properly.

    Eg:require "/home/me/ruby/spec/lib/zombie"