/usr/share/doc/ruby-rspec-core/features/configuration/run_all_when_everything_filtered.feature is in ruby-rspec-core 3.5.0c3e0m0s0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | Feature: run all when everything filtered
Note: this feature has been superseded by
[filter_run_when_matching](../filtering/filter-run-when-matching) and will be
removed in a future version of RSpec.
Use the `run_all_when_everything_filtered` option to tell RSpec to run all the
specs in the case where you try to run a filtered list of specs but no specs
match that filter. This works well when paired with an inclusion filter like
`:focus => true`, as it will run all the examples when none match the
inclusion filter.
```ruby
RSpec.configure { |c| c.run_all_when_everything_filtered = true }
```
Background:
Given a file named "spec/spec_helper.rb" with:
"""ruby
RSpec.configure {|c| c.run_all_when_everything_filtered = true}
"""
Scenario: By default, no specs are run if they are all filtered out by an inclusion tag
Given a file named "spec/example_spec.rb" with:
"""ruby
RSpec.describe "examples" do
it "with no tag" do
end
it "with no tag as well" do
end
end
"""
When I run `rspec spec/example_spec.rb --tag some_tag`
Then the output should contain "0 examples, 0 failures"
Scenario: Specs are still run if they are filtered out by an exclusion tag
Given a file named "spec/example_spec.rb" with:
"""ruby
RSpec.describe "examples" do
it "with no tag" do
end
it "with no tag as well" do
end
end
"""
When I run `rspec spec/example_spec.rb --tag ~some_tag`
Then the output should contain "2 examples, 0 failures"
Scenario: When the `run_all_when_everything_filtered` option is turned on, if there are any matches for the filtering tag, only those features are run
Given a file named "spec/example_spec.rb" with:
"""ruby
require "spec_helper"
RSpec.describe "examples" do
it "with no tag", :some_tag => true do
end
it "with no tag as well" do
end
end
"""
When I run `rspec spec/example_spec.rb --tag some_tag`
Then the output should contain "1 example, 0 failures"
And the output should contain "Run options: include {:some_tag=>true}"
Scenario: When the `run_all_when_everything_filtered` option is turned on, all the specs are run when the tag has no matches
Given a file named "spec/example_spec.rb" with:
"""ruby
require "spec_helper"
RSpec.describe "examples" do
it "with no tag" do
end
it "with no tag as well" do
end
end
"""
When I run `rspec spec/example_spec.rb --tag some_tag`
Then the output should contain "2 examples, 0 failures"
And the output should contain "All examples were filtered out; ignoring {:some_tag=>true}"
|