/usr/share/doc/ruby-rspec-core/features/filtering/exclusion_filters.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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | Feature: exclusion filters
You can exclude examples from a run by declaring an exclusion filter and then
tagging examples, or entire groups, with that filter. You can also specify
metadata using only symbols.
Scenario: Exclude an example
Given a file named "spec/sample_spec.rb" with:
"""ruby
RSpec.configure do |c|
# declare an exclusion filter
c.filter_run_excluding :broken => true
end
RSpec.describe "something" do
it "does one thing" do
end
# tag example for exclusion by adding metadata
it "does another thing", :broken => true do
end
end
"""
When I run `rspec ./spec/sample_spec.rb --format doc`
Then the output should contain "does one thing"
And the output should not contain "does another thing"
Scenario: Exclude a group
Given a file named "spec/sample_spec.rb" with:
"""ruby
RSpec.configure do |c|
c.filter_run_excluding :broken => true
end
RSpec.describe "group 1", :broken => true do
it "group 1 example 1" do
end
it "group 1 example 2" do
end
end
RSpec.describe "group 2" do
it "group 2 example 1" do
end
end
"""
When I run `rspec ./spec/sample_spec.rb --format doc`
Then the output should contain "group 2 example 1"
And the output should not contain "group 1 example 1"
And the output should not contain "group 1 example 2"
Scenario: Exclude multiple groups
Given a file named "spec/sample_spec.rb" with:
"""ruby
RSpec.configure do |c|
c.filter_run_excluding :broken => true
end
RSpec.describe "group 1", :broken => true do
before(:context) do
raise "you should not see me"
end
it "group 1 example 1" do
end
it "group 1 example 2" do
end
end
RSpec.describe "group 2", :broken => true do
before(:example) do
raise "you should not see me"
end
it "group 2 example 1" do
end
end
"""
When I run `rspec ./spec/sample_spec.rb --format doc`
Then the process should succeed even though no examples were run
And the output should not contain "group 1"
And the output should not contain "group 2"
Scenario: `before`/`after(:context)` hooks in excluded example group are not run
Given a file named "spec/before_after_context_exclusion_filter_spec.rb" with:
"""ruby
RSpec.configure do |c|
c.filter_run_excluding :broken => true
end
RSpec.describe "group 1" do
before(:context) { puts "before context in included group" }
after(:context) { puts "after context in included group" }
it "group 1 example" do
end
end
RSpec.describe "group 2", :broken => true do
before(:context) { puts "before context in excluded group" }
after(:context) { puts "after context in excluded group" }
context "context 1" do
it "group 2 context 1 example 1" do
end
end
end
"""
When I run `rspec ./spec/before_after_context_exclusion_filter_spec.rb`
Then the output should contain "before context in included group"
And the output should contain "after context in included group"
And the output should not contain "before context in excluded group"
And the output should not contain "after context in excluded group"
Scenario: Use symbols as metadata
Given a file named "symbols_as_metadata_spec.rb" with:
"""ruby
RSpec.configure do |c|
c.filter_run_excluding :broken
end
RSpec.describe "something" do
it "does one thing" do
end
# tag example for exclusion by adding metadata
it "does another thing", :broken do
end
end
"""
When I run `rspec symbols_as_metadata_spec.rb --format doc`
Then the output should contain "does one thing"
And the output should not contain "does another thing"
|