You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

fail_fast_spec.rb 2.3 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # frozen_string_literal: true
  2. require 'cucumber/formatter/fail_fast'
  3. require 'cucumber/core'
  4. require 'cucumber/core/gherkin/writer'
  5. require 'cucumber/core/test/result'
  6. require 'cucumber/core/filter'
  7. require 'cucumber'
  8. require 'support/standard_step_actions'
  9. module Cucumber::Formatter
  10. describe FailFast do
  11. include Cucumber::Core
  12. include Cucumber::Core::Gherkin::Writer
  13. let(:configuration) { Cucumber::Configuration.new }
  14. before { FailFast.new(configuration) }
  15. context 'failing scenario' do
  16. before(:each) do
  17. @gherkin = gherkin('foo.feature') do
  18. feature do
  19. scenario do
  20. step 'failing'
  21. end
  22. scenario do
  23. step 'failing'
  24. end
  25. end
  26. end
  27. end
  28. after(:each) do
  29. Cucumber.wants_to_quit = false
  30. end
  31. it 'sets Cucumber.wants_to_quit' do
  32. execute [@gherkin], [StandardStepActions.new], configuration.event_bus
  33. expect(Cucumber.wants_to_quit).to be true
  34. end
  35. end
  36. context 'passing scenario' do
  37. before(:each) do
  38. @gherkin = gherkin('foo.feature') do
  39. feature do
  40. scenario do
  41. step 'passing'
  42. end
  43. end
  44. end
  45. end
  46. it 'doesn\'t set Cucumber.wants_to_quit' do
  47. execute [@gherkin], [StandardStepActions.new], configuration.event_bus
  48. expect(Cucumber.wants_to_quit).to be_falsey
  49. end
  50. end
  51. context 'undefined scenario' do
  52. before(:each) do
  53. @gherkin = gherkin('foo.feature') do
  54. feature do
  55. scenario do
  56. step 'undefined'
  57. end
  58. end
  59. end
  60. end
  61. it 'doesn\'t set Cucumber.wants_to_quit' do
  62. execute [@gherkin], [StandardStepActions.new], configuration.event_bus
  63. expect(Cucumber.wants_to_quit).to be_falsey
  64. end
  65. context 'in strict mode' do
  66. let(:configuration) { Cucumber::Configuration.new strict: Cucumber::Core::Test::Result::StrictConfiguration.new([:undefined]) }
  67. it 'sets Cucumber.wants_to_quit' do
  68. execute [@gherkin], [StandardStepActions.new], configuration.event_bus
  69. expect(Cucumber.wants_to_quit).to be_truthy
  70. end
  71. end
  72. end
  73. end
  74. end

No Description

Contributors (1)