Browse Source

Maintenance: Enable rspec persistent state for failure only testing.

Tobias Schäfer 2 years ago
parent
commit
665f3a3088

+ 5 - 0
doc/developer_manual/cookbook/how-to-test-with-rspec-and-capybara.md

@@ -30,6 +30,11 @@ If you would like to specify the used browser for Capybara end-to-end tests, sim
 ```sh
 BROWSER=firefox bundle exec rspec spec/system/ticket/zoom_spec.rb
 ```
+Also running failed tests only is possible with the option `--only-failures`.
+
+```sh
+$ bundle exec rspec --only-failures spec/system/ticket/zoom_spec.rb
+```
 
 ## Default RSpec Environment
 

+ 6 - 5
spec/spec_helper.rb

@@ -51,6 +51,12 @@ RSpec.configure do |config|
   # triggering implicit auto-inclusion in groups with matching metadata.
   config.shared_context_metadata_behavior = :apply_to_host_groups
 
+  # Allows RSpec to persist some state between runs in order to support
+  # the `--only-failures` and `--next-failure` CLI options.
+  if !ENV['CI']
+    config.example_status_persistence_file_path = 'tmp/rspec-state.txt'
+  end
+
 # The settings below are suggested to provide a good initial experience
 # with RSpec, but feel free to customize to your heart's content.
 =begin
@@ -61,11 +67,6 @@ RSpec.configure do |config|
   # 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"
-
   # Limits the available syntax to the non-monkey patched syntax that is
   # recommended. For more details, see:
   #   - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/