I\'m writing tests on Rspec for my models in Ruby on Rails application. And I receive this error while starting \'rspec spec\'
command:
/spec/models/client_spec
Your spec_helper file is missing some important commands. Specifically, it's not including config/environment and initializing rspec-rails.
You can add the following lines to the start of your spec/spec_helper.rb file
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
or you can just run
rails generate rspec:install
and overwrite your spec_helper with one generated for use with rspec-rails.