in 'require': no such file to load -- spec_helper in 'require': no such file to load -- spec_helper windows windows

in 'require': no such file to load -- spec_helper


After running

rails generate rspec:install

Place your *_spec.rb files under (in your example) c:\rails_projects\sample_app\spec\model. Then specify relative path with require_relative

require_relative '../spec_helper'


Run the following command

c:\rails_projects\sample_app>rails generate rspec:install

This will put the spec_helper.rb file in your /spec directory


When you execute 'rails generate rspec:install', if you see 'Could not find generator rspec:install' error message, add gem 'rspec-rails' within :developnent, :test group in your project Gemfile as shown below.

group :development, :test do  gem 'rspec-rails'end

After this, execute 'bundle install' and continue with 'rails generate rspec:install'