Rails how to configure rspec so you do not need to require "rails_helper"

Viewed 134

title says it all mostly. Given new Rails app and rspec-rails. If I app an app/lib/foo.rb class. How do I configure rspec to be loaded so I do not have to do this:

# spec/lib/foo_spec.rb
require "rails_helper"

describe Foo do
end
1 Answers

In the .rspec file at the root of the project, add

--require rspec_helper

on its own line. The rspec command adds any options in this file automatically when run.

Related