How to force run all RSpec specs ignoring :focus tag

rspec, rspec2

Solution

You could remove the lines:

 config.filter_run :focus => true
 config.run_all_when_everything_filtered = true

and tell users to run focused tests with `rspec --tag focus`. That way the CI will always run the full test suite.

You might consider checking the environment in the configuration block and including/excluding the `filter_run` setting appropriately.

Another thought: if you are using git, set a pre-commit hook to prevent specs with `:focus` from creeping into the code base in the first place.

Problem

Given the following RSpec configuration (v2.12.0): ``` RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.filter_run :focus => true config.run_all_when_everything_filtered = true end ``` Sometimes people forget to remove the `:focus` tag from specs and in a continuous integration environment where we want all specs to be run, only the specs with the leftover `:focus` tag get run. I've tried: ``` rspec --tag ~focus ``` ... which runs all specs excluding those tagged with :focus Is there a way to force run ALL specs ignoring any tags using rspec's command line options?

Original source