/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

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