PageRenderTime 21ms CodeModel.GetById 8ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/delowong/logstash
Gherkin Specification | 77 lines | 66 code | 11 blank | 0 comment | 0 complexity | cd2cfc86ee50dcd9cb1b424a5b1ea9f4 MD5 | raw file
 1Feature: fail fast
 2
 3  Use the fail_fast option to tell RSpec to abort the run on first failure:
 4
 5      RSpec.configure {|c| c.fail_fast = true}
 6
 7  Background:
 8    Given a file named "spec/spec_helper.rb" with:
 9      """ruby
10      RSpec.configure {|c| c.fail_fast = true}
11      """
12
13  Scenario: fail_fast with no failures (runs all examples)
14    Given a file named "spec/example_spec.rb" with:
15      """ruby
16      describe "something" do
17        it "passes" do
18        end
19
20        it "passes too" do
21        end
22      end
23      """
24    When I run `rspec spec/example_spec.rb`
25    Then the examples should all pass
26
27  Scenario: fail_fast with first example failing (only runs the one example)
28    Given a file named "spec/example_spec.rb" with:
29      """ruby
30      require "spec_helper"
31      describe "something" do
32        it "fails" do
33          fail
34        end
35
36        it "passes" do
37        end
38      end
39      """
40    When I run `rspec spec/example_spec.rb -fd`
41    Then the output should contain "1 example, 1 failure"
42
43  Scenario: fail_fast with multiple files, second example failing (only runs the first two examples)
44    Given a file named "spec/example_1_spec.rb" with:
45      """ruby
46      require "spec_helper"
47      describe "something" do
48        it "passes" do
49        end
50
51        it "fails" do
52          fail
53        end
54      end
55
56      describe "something else" do
57        it "fails" do
58          fail
59        end
60      end
61      """
62    And a file named "spec/example_2_spec.rb" with:
63      """ruby
64      require "spec_helper"
65      describe "something" do
66        it "passes" do
67        end
68      end
69
70      describe "something else" do
71        it "fails" do
72          fail
73        end
74      end
75      """
76    When I run `rspec spec`
77    Then the output should contain "2 examples, 1 failure"