PageRenderTime 33ms CodeModel.GetById 16ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/bundle/jruby/2.1/gems/rspec-core-2.14.8/features/configuration/run_all_when_everything_filtered.feature

https://github.com/delowong/logstash
Gherkin Specification | 76 lines | 64 code | 12 blank | 0 comment | 6 complexity | f3301385483671184540a77788501d6d MD5 | raw file
 1Feature: run all when everything filtered
 2
 3  Use the run_all_when_everything_filtered option to tell RSpec to run all the
 4  specs in the case where you try to run a filtered list of specs but no specs
 5  match that filter. This works well when paired with an inclusion filter like
 6  `:focus => true`, as it will run all the examples when none match the
 7  inclusion filter.
 8
 9    RSpec.configure { |c| c.run_all_when_everything_filtered = true }
10
11  Background:
12    Given a file named "spec/spec_helper.rb" with:
13      """ruby
14      RSpec.configure {|c| c.run_all_when_everything_filtered = true}
15      """
16
17  Scenario: by default, no specs are run if they are all filtered out by an inclusion tag
18    Given a file named "spec/example_spec.rb" with:
19      """ruby
20      describe "examples" do
21        it "with no tag" do
22        end
23
24        it "with no tag as well" do
25        end
26      end
27      """
28    When I run `rspec spec/example_spec.rb --tag some_tag`
29    Then the output should contain "0 examples, 0 failures"
30
31  Scenario: specs are still run if they are filtered out by an exclusion tag
32    Given a file named "spec/example_spec.rb" with:
33      """ruby
34      describe "examples" do
35        it "with no tag" do
36        end
37
38        it "with no tag as well" do
39        end
40      end
41      """
42    When I run `rspec spec/example_spec.rb --tag ~some_tag`
43    Then the output should contain "2 examples, 0 failures"
44
45  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
46    Given a file named "spec/example_spec.rb" with:
47      """ruby
48      require "spec_helper"
49      describe "examples" do
50        it "with no tag", :some_tag => true do
51        end
52
53        it "with no tag as well" do
54        end
55      end
56      """
57    When I run `rspec spec/example_spec.rb --tag some_tag`
58    Then the output should contain "1 example, 0 failures"
59    And the output should contain "Run options: include {:some_tag=>true}"
60
61  Scenario: when the run_all_when_everything_filtered option is turned on, all the specs are run when the tag has no matches
62    Given a file named "spec/example_spec.rb" with:
63      """ruby
64      require "spec_helper"
65      describe "examples" do
66        it "with no tag" do
67        end
68
69        it "with no tag as well" do
70        end
71      end
72      """
73    When I run `rspec spec/example_spec.rb --tag some_tag`
74    Then the output should contain "2 examples, 0 failures"
75    And the output should contain "All examples were filtered out; ignoring {:some_tag=>true}"
76