Error when trying to run rspec: `require': cannot load such file -- rails_helper (LoadError)

There is some problem with rspec V3. But in your case you are using V2.

change

require 'rails_helper'

to

require 'spec_helper'

Other description find here https://teamtreehouse.com/forum/problem-with-rspec

For V3 :

If someone using rspec V3 then similar error occurs when generator not run. So before trying anything run generator.

rails generate rspec:install

If you are getting a huge list of warning on your console. Then you need to remove --warnings from .rspec file.


I actually just had this error on rails 4 with rspec 3, but in my case I forgot to run the generator:

rails generate rspec:install

Also I had to remove warnings from .rspec, as stated by one of rpsec developers


For me, the problem was due to a different "rspec-support" version loaded and activated. I solved by prepending a "bundle exec":

bundle exec rspec

For newer versions (3.5), if you need to run the generator, rails generate rspec:install doesn't work for me. I used:

rspec --init

Creates .rspec and spec/spec_helper.rb.

EDIT: Just in case, I found out that I installed rspec gem for ruby, not the one for Rails, so rspec:install wasn't available. Should use https://github.com/rspec/rspec-rails.


Sometimes you need to run rspec command from Project's parent directory