From c8dae7c37b0b79259d0449fa5a3ae3fa9c9f0432 Mon Sep 17 00:00:00 2001 From: Laurence de Bruxelles Date: Mon, 4 Dec 2023 11:23:51 +0200 Subject: [PATCH] Configure RSpec to allow the --only-failures CLI option The `--only-failures` and `--next-failure` options in RSpec make it much quicker to re-run tests that have failed, however they need the `example_status_persistence_file_path` configuration to be set [[1]]. This commit tells RSpec to save a file `examples.txt` into the a new folder in the Rails app's `tmp` folder; this seems like as good a place as any, as it's already ignored by git and docker, and is clearly named. [1]: https://rspec.info/features/3-12/rspec-core/command-line/only-failures/ --- spec/spec_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0ed607f0..dff5db70 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -64,10 +64,10 @@ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively. # config.filter_run_when_matching :focus # - # # Allows RSpec to persist some state between runs in order to support - # # the `--only-failures` and `--next-failure` CLI options. We recommend - # # you configure your source control system to ignore this file. - # config.example_status_persistence_file_path = "spec/examples.txt" + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "tmp/cache/spec/examples.txt" # # # Limits the available syntax to the non-monkey patched syntax that is # # recommended. For more details, see: