Search code examples
rubyrspec

Does .rspec file get run every time rspec runs?


Does the .rspec file you get when initializing the project, get run every time you run your tests (through rspec [file location]) ? Just curious because inside the .rspec file, using cat .rspec, I found that it contains require spec_helper. If it does get run every time, this would save me a lot of time from writing require spec_helper in each of my test files.


Solution

  • Yes. It gets called every time. You don't need to include it in every spec file.

    I have --require spec_helper in my .rspec file.

    Here's a link to the rspec docs, which includes a list of other options.