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

后端 未结 13 780
青春惊慌失措
青春惊慌失措 2020-12-13 03:13

I am trying to run rspec for Ruby on Rails. I am running Rails 4.1.1. I have installed the gem, have established a spec folder with some tests. I have created a directory

13条回答
  •  一个人的身影
    2020-12-13 03:55

    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.

提交回复
热议问题