In RSpec, the run_all_when_everything_filtered
option is used to automatically run all examples in the test suite when a filtering condition is applied that includes all the examples.
By default, when you run RSpec with a filter, it only runs the examples that match the filter. For example, if you have a test suite with 100 examples and you run rspec spec --tag foo
, it will only run the examples that have been tagged with :foo
.
However, if you enable the run_all_when_everything_filtered
option, when you apply a filter that includes all examples, RSpec will automatically run all examples in the test suite. For example, if you have a test suite with 100 examples and you run rspec spec --tag ~foo
, it will run all 100 examples, even though none of them have been tagged with :foo
.
To enable this option, you can add the following line to your RSpec configuration:
RSpec.configure do |config|
config.run_all_when_everything_filtered = true
end
This can be useful in situations where you want to run the entire test suite, but also want to be able to filter it down to specific examples or groups of examples for debugging or other purposes.
For more info, see the Configuration section.