cucumber 2.99.0 → 3.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +22 -10
  3. data/CONTRIBUTING.md +13 -0
  4. data/Gemfile +11 -4
  5. data/History.md +19 -1
  6. data/README.md +1 -1
  7. data/cucumber.gemspec +2 -2
  8. data/cucumber.yml +2 -2
  9. data/features/docs/api/listen_for_events.feature +7 -6
  10. data/features/docs/cli/help.feature +8 -0
  11. data/features/docs/cli/retry_failing_tests.feature +51 -16
  12. data/features/docs/defining_steps/nested_steps_i18n.feature +2 -0
  13. data/features/docs/defining_steps/printing_messages.feature +0 -1
  14. data/features/docs/defining_steps/skip_scenario.feature +0 -34
  15. data/features/docs/extending_cucumber/custom_formatter.feature +2 -30
  16. data/features/docs/formatters/summary_formatter.feature +34 -0
  17. data/features/docs/gherkin/unicode_table.feature +1 -1
  18. data/features/docs/post_configuration_hook.feature +0 -16
  19. data/features/docs/writing_support_code/world.feature +129 -0
  20. data/features/lib/step_definitions/aruba_steps.rb +1 -0
  21. data/features/lib/step_definitions/cli_steps.rb +4 -0
  22. data/features/lib/step_definitions/cucumber_steps.rb +1 -0
  23. data/features/lib/step_definitions/iso-8859-1_steps.rb +1 -0
  24. data/features/lib/step_definitions/json_steps.rb +1 -0
  25. data/features/lib/step_definitions/junit_steps.rb +1 -0
  26. data/features/lib/step_definitions/language_steps.rb +1 -0
  27. data/features/lib/step_definitions/profile_steps.rb +1 -0
  28. data/features/lib/step_definitions/retry_steps.rb +32 -12
  29. data/features/lib/step_definitions/ruby_steps.rb +1 -0
  30. data/features/lib/step_definitions/wire_steps.rb +1 -0
  31. data/features/lib/support/env.rb +2 -1
  32. data/features/lib/support/fake_wire_server.rb +1 -0
  33. data/features/lib/support/feature_factory.rb +1 -0
  34. data/features/lib/support/normalise_output.rb +1 -0
  35. data/gem_tasks/contributors.rake +1 -0
  36. data/gem_tasks/cov.rake +1 -0
  37. data/gem_tasks/cucumber.rake +1 -0
  38. data/gem_tasks/downloads.rb +1 -0
  39. data/gem_tasks/environment.rake +1 -0
  40. data/gem_tasks/examples.rake +2 -1
  41. data/gem_tasks/fix_cr_lf.rake +2 -1
  42. data/gem_tasks/flog.rake +2 -1
  43. data/gem_tasks/rspec.rake +1 -0
  44. data/gem_tasks/sass.rake +2 -1
  45. data/lib/autotest/cucumber.rb +1 -0
  46. data/lib/autotest/cucumber_mixin.rb +1 -0
  47. data/lib/autotest/cucumber_rails.rb +1 -0
  48. data/lib/autotest/cucumber_rails_rspec.rb +1 -0
  49. data/lib/autotest/cucumber_rails_rspec2.rb +1 -0
  50. data/lib/autotest/cucumber_rspec.rb +1 -0
  51. data/lib/autotest/cucumber_rspec2.rb +1 -0
  52. data/lib/autotest/discover.rb +1 -0
  53. data/lib/cucumber.rb +1 -13
  54. data/lib/cucumber/cli/configuration.rb +3 -6
  55. data/lib/cucumber/cli/main.rb +2 -1
  56. data/lib/cucumber/cli/options.rb +239 -173
  57. data/lib/cucumber/cli/profile_loader.rb +1 -0
  58. data/lib/cucumber/cli/rerun_file.rb +1 -0
  59. data/lib/cucumber/configuration.rb +40 -19
  60. data/lib/cucumber/constantize.rb +1 -0
  61. data/lib/cucumber/core_ext/instance_exec.rb +1 -0
  62. data/lib/cucumber/core_ext/string.rb +1 -0
  63. data/lib/cucumber/deprecate.rb +1 -0
  64. data/lib/cucumber/encoding.rb +1 -0
  65. data/lib/cucumber/errors.rb +3 -1
  66. data/lib/cucumber/events.rb +13 -3
  67. data/lib/cucumber/events/step_definition_registered.rb +24 -0
  68. data/lib/cucumber/events/step_match.rb +4 -1
  69. data/lib/cucumber/events/test_run_finished.rb +12 -0
  70. data/lib/cucumber/file_specs.rb +1 -0
  71. data/lib/cucumber/filters.rb +2 -0
  72. data/lib/cucumber/filters/activate_steps.rb +2 -1
  73. data/lib/cucumber/filters/apply_after_hooks.rb +1 -0
  74. data/lib/cucumber/filters/apply_after_step_hooks.rb +1 -0
  75. data/lib/cucumber/filters/apply_around_hooks.rb +1 -0
  76. data/lib/cucumber/filters/apply_before_hooks.rb +1 -0
  77. data/lib/cucumber/filters/gated_receiver.rb +1 -0
  78. data/lib/cucumber/filters/prepare_world.rb +1 -0
  79. data/lib/cucumber/filters/quit.rb +1 -0
  80. data/lib/cucumber/filters/randomizer.rb +1 -0
  81. data/lib/cucumber/filters/retry.rb +3 -3
  82. data/lib/cucumber/filters/tag_limits.rb +1 -0
  83. data/lib/cucumber/filters/tag_limits/test_case_index.rb +1 -0
  84. data/lib/cucumber/filters/tag_limits/verifier.rb +1 -0
  85. data/lib/cucumber/formatter/ansicolor.rb +1 -0
  86. data/lib/cucumber/formatter/backtrace_filter.rb +3 -2
  87. data/lib/cucumber/formatter/console.rb +61 -52
  88. data/lib/cucumber/formatter/console_counts.rb +57 -0
  89. data/lib/cucumber/formatter/console_issues.rb +37 -0
  90. data/lib/cucumber/formatter/debug.rb +1 -0
  91. data/lib/cucumber/formatter/duration.rb +1 -0
  92. data/lib/cucumber/formatter/duration_extractor.rb +1 -0
  93. data/lib/cucumber/formatter/fail_fast.rb +4 -2
  94. data/lib/cucumber/formatter/fanout.rb +1 -0
  95. data/lib/cucumber/formatter/hook_query_visitor.rb +1 -0
  96. data/lib/cucumber/formatter/html.rb +6 -5
  97. data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -0
  98. data/lib/cucumber/formatter/interceptor.rb +1 -0
  99. data/lib/cucumber/formatter/io.rb +1 -0
  100. data/lib/cucumber/formatter/json.rb +15 -13
  101. data/lib/cucumber/formatter/json_pretty.rb +1 -0
  102. data/lib/cucumber/formatter/junit.rb +13 -11
  103. data/lib/cucumber/formatter/legacy_api/adapter.rb +28 -32
  104. data/lib/cucumber/formatter/legacy_api/ast.rb +1 -0
  105. data/lib/cucumber/formatter/legacy_api/results.rb +1 -0
  106. data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +1 -0
  107. data/lib/cucumber/formatter/pretty.rb +7 -1
  108. data/lib/cucumber/formatter/progress.rb +56 -13
  109. data/lib/cucumber/formatter/rerun.rb +15 -18
  110. data/lib/cucumber/formatter/stepdefs.rb +1 -0
  111. data/lib/cucumber/formatter/steps.rb +1 -0
  112. data/lib/cucumber/formatter/summary.rb +43 -20
  113. data/lib/cucumber/formatter/unicode.rb +1 -0
  114. data/lib/cucumber/formatter/usage.rb +26 -21
  115. data/lib/cucumber/gherkin/data_table_parser.rb +1 -0
  116. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +1 -0
  117. data/lib/cucumber/gherkin/formatter/escaping.rb +1 -0
  118. data/lib/cucumber/gherkin/i18n.rb +1 -0
  119. data/lib/cucumber/gherkin/steps_parser.rb +1 -0
  120. data/lib/cucumber/hooks.rb +1 -0
  121. data/lib/cucumber/load_path.rb +1 -0
  122. data/lib/cucumber/multiline_argument.rb +1 -2
  123. data/lib/cucumber/multiline_argument/data_table.rb +3 -1
  124. data/lib/cucumber/multiline_argument/doc_string.rb +1 -0
  125. data/lib/cucumber/platform.rb +1 -0
  126. data/lib/cucumber/project_initializer.rb +2 -1
  127. data/lib/cucumber/rake/task.rb +1 -0
  128. data/lib/cucumber/rb_support/rb_dsl.rb +11 -9
  129. data/lib/cucumber/rb_support/rb_hook.rb +1 -0
  130. data/lib/cucumber/rb_support/rb_language.rb +19 -8
  131. data/lib/cucumber/rb_support/rb_step_definition.rb +1 -0
  132. data/lib/cucumber/rb_support/rb_transform.rb +1 -0
  133. data/lib/cucumber/rb_support/rb_world.rb +42 -20
  134. data/lib/cucumber/rb_support/snippet.rb +2 -1
  135. data/lib/cucumber/rspec/disable_option_parser.rb +1 -0
  136. data/lib/cucumber/rspec/doubles.rb +1 -0
  137. data/lib/cucumber/running_test_case.rb +1 -25
  138. data/lib/cucumber/runtime.rb +15 -10
  139. data/lib/cucumber/runtime/after_hooks.rb +1 -0
  140. data/lib/cucumber/runtime/before_hooks.rb +1 -0
  141. data/lib/cucumber/runtime/for_programming_languages.rb +1 -0
  142. data/lib/cucumber/runtime/step_hooks.rb +1 -0
  143. data/lib/cucumber/runtime/support_code.rb +1 -0
  144. data/lib/cucumber/runtime/user_interface.rb +1 -0
  145. data/lib/cucumber/step_argument.rb +1 -0
  146. data/lib/cucumber/step_definition_light.rb +1 -0
  147. data/lib/cucumber/step_definitions.rb +1 -0
  148. data/lib/cucumber/step_match.rb +1 -0
  149. data/lib/cucumber/step_match_search.rb +1 -0
  150. data/lib/cucumber/term/ansicolor.rb +1 -0
  151. data/lib/cucumber/unit.rb +1 -0
  152. data/lib/cucumber/version +1 -1
  153. data/lib/simplecov_setup.rb +1 -0
  154. data/spec/cucumber/cli/configuration_spec.rb +1 -0
  155. data/spec/cucumber/cli/main_spec.rb +1 -0
  156. data/spec/cucumber/cli/options_spec.rb +1 -0
  157. data/spec/cucumber/cli/profile_loader_spec.rb +1 -0
  158. data/spec/cucumber/cli/rerun_spec.rb +1 -0
  159. data/spec/cucumber/configuration_spec.rb +1 -0
  160. data/spec/cucumber/constantize_spec.rb +1 -0
  161. data/spec/cucumber/core_ext/instance_exec_spec.rb +1 -0
  162. data/spec/cucumber/file_specs_spec.rb +1 -0
  163. data/spec/cucumber/filters/activate_steps_spec.rb +9 -6
  164. data/spec/cucumber/filters/gated_receiver_spec.rb +1 -0
  165. data/spec/cucumber/filters/retry_spec.rb +27 -21
  166. data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +1 -0
  167. data/spec/cucumber/filters/tag_limits/verifier_spec.rb +1 -0
  168. data/spec/cucumber/filters/tag_limits_spec.rb +1 -0
  169. data/spec/cucumber/formatter/ansicolor_spec.rb +1 -0
  170. data/spec/cucumber/formatter/console_counts_spec.rb +14 -0
  171. data/spec/cucumber/formatter/debug_spec.rb +1 -0
  172. data/spec/cucumber/formatter/duration_spec.rb +1 -0
  173. data/spec/cucumber/formatter/fail_fast_spec.rb +5 -5
  174. data/spec/cucumber/formatter/html_spec.rb +6 -1
  175. data/spec/cucumber/formatter/interceptor_spec.rb +1 -0
  176. data/spec/cucumber/formatter/json_spec.rb +29 -28
  177. data/spec/cucumber/formatter/junit_spec.rb +1 -0
  178. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +8 -3
  179. data/spec/cucumber/formatter/pretty_spec.rb +1 -0
  180. data/spec/cucumber/formatter/progress_spec.rb +2 -1
  181. data/spec/cucumber/formatter/rerun_spec.rb +70 -64
  182. data/spec/cucumber/formatter/spec_helper.rb +8 -7
  183. data/spec/cucumber/hooks_spec.rb +1 -0
  184. data/spec/cucumber/multiline_argument/data_table_spec.rb +1 -0
  185. data/spec/cucumber/project_initializer_spec.rb +2 -1
  186. data/spec/cucumber/rake/forked_spec.rb +1 -0
  187. data/spec/cucumber/rake/task_spec.rb +1 -0
  188. data/spec/cucumber/rb_support/rb_language_spec.rb +81 -3
  189. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +1 -0
  190. data/spec/cucumber/rb_support/rb_transform_spec.rb +1 -0
  191. data/spec/cucumber/rb_support/rb_world_spec.rb +2 -1
  192. data/spec/cucumber/rb_support/snippet_spec.rb +1 -0
  193. data/spec/cucumber/running_test_case_spec.rb +1 -0
  194. data/spec/cucumber/runtime/for_programming_languages_spec.rb +1 -0
  195. data/spec/cucumber/runtime/support_code_spec.rb +1 -0
  196. data/spec/cucumber/runtime_spec.rb +1 -0
  197. data/spec/cucumber/step_argument_spec.rb +1 -0
  198. data/spec/cucumber/step_match_search_spec.rb +1 -0
  199. data/spec/cucumber/step_match_spec.rb +1 -0
  200. data/spec/cucumber/world/pending_spec.rb +1 -0
  201. data/spec/spec_helper.rb +1 -0
  202. data/spec/support/standard_step_actions.rb +1 -0
  203. metadata +24 -23
  204. data/lib/cucumber/ast.rb +0 -13
  205. data/lib/cucumber/events/after_test_case.rb +0 -25
  206. data/lib/cucumber/events/after_test_step.rb +0 -30
  207. data/lib/cucumber/events/before_test_case.rb +0 -18
  208. data/lib/cucumber/events/before_test_step.rb +0 -23
  209. data/lib/cucumber/events/bus.rb +0 -86
  210. data/lib/cucumber/events/finished_testing.rb +0 -9
  211. data/lib/cucumber/formatter/event_bus_report.rb +0 -38
  212. data/spec/cucumber/events/bus_spec.rb +0 -94
  213. data/spec/cucumber/formatter/event_bus_report_spec.rb +0 -88
  214. data/spec/cucumber_spec.rb +0 -39
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  class Unit
3
4
  def initialize(step_collection)
@@ -1 +1 @@
1
- 2.99.0
1
+ 3.0.0.pre.1
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  if ENV['SIMPLECOV']
2
3
  begin
3
4
  # Suppress warnings in order not to pollute stdout which tests expectations rely on
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'yaml'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'yaml'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'yaml'
3
4
  require 'cucumber/cli/options'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'yaml'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  module Cucumber
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  module Cucumber
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  module Html end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/core_ext/instance_exec'
2
3
 
3
4
  describe 'cucumber_instance_exec' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/file_specs'
2
3
 
3
4
  module Cucumber
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/filters/activate_steps'
2
3
  require 'cucumber/core/gherkin/writer'
3
4
  require 'cucumber/core'
@@ -32,9 +33,10 @@ describe Cucumber::Filters::ActivateSteps do
32
33
  end
33
34
 
34
35
  it "notifies with a StepMatch event" do
35
- expect(configuration).to receive(:notify) do |event|
36
- expect(event.test_step.name).to eq 'a passing step'
37
- expect(event.step_match).to eq step_match
36
+ expect(configuration).to receive(:notify) do |message, test_step, step_match|
37
+ expect(message).to eq :step_match
38
+ expect(test_step.name).to eq 'a passing step'
39
+ expect(step_match).to eq step_match
38
40
  end
39
41
  compile [doc], receiver, [filter]
40
42
  end
@@ -111,9 +113,10 @@ describe Cucumber::Filters::ActivateSteps do
111
113
  end
112
114
 
113
115
  it "notifies with a StepMatch event" do
114
- expect(configuration).to receive(:notify) do |event|
115
- expect(event.test_step.name).to eq 'a passing step'
116
- expect(event.step_match).to eq step_match
116
+ expect(configuration).to receive(:notify) do |message, test_step, step_match|
117
+ expect(message).to eq :step_match
118
+ expect(test_step.name).to eq 'a passing step'
119
+ expect(step_match).to eq step_match
117
120
  end
118
121
  compile [doc], receiver, [filter]
119
122
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "cucumber/filters/gated_receiver"
2
3
 
3
4
  describe Cucumber::Filters::GatedReceiver do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber'
2
3
  require 'cucumber/filters/retry'
3
4
  require 'cucumber/core/gherkin/writer'
@@ -22,29 +23,22 @@ describe Cucumber::Filters::Retry do
22
23
  it { is_expected.to respond_to(:with_receiver) }
23
24
  it { is_expected.to respond_to(:done) }
24
25
 
25
- context "general" do
26
- before(:each) do
27
- filter.with_receiver(receiver)
28
- end
29
-
30
- it "registers the :after_test_case event" do
31
- expect(configuration).to receive(:on_event).with(:after_test_case)
32
- filter.test_case(test_case)
33
- end
34
- end
35
-
36
26
  context "passing test case" do
27
+ let(:result) { Cucumber::Core::Test::Result::Passed.new(0) }
28
+
37
29
  it "describes the test case once" do
38
- expect(test_case).to receive(:describe_to).with(receiver)
39
- filter.test_case(test_case)
40
- configuration.notify(pass)
30
+ expect(receiver).to receive(:test_case).with(test_case).once
31
+ test_case.describe_to filter
32
+ configuration.notify :test_case_finished, test_case, result
41
33
  end
42
34
  end
43
35
 
44
- context "failing test case" do
36
+ context "consistently failing test case" do
37
+ let(:result) { Cucumber::Core::Test::Result::Failed.new(0, StandardError.new) }
38
+
45
39
  it "describes the test case the specified number of times" do
46
40
  expect(receiver).to receive(:test_case) {|test_case|
47
- configuration.notify(fail)
41
+ configuration.notify :test_case_finished, test_case, result
48
42
  }.exactly(3).times
49
43
 
50
44
  filter.test_case(test_case)
@@ -54,10 +48,16 @@ describe Cucumber::Filters::Retry do
54
48
  context "flaky test cases" do
55
49
 
56
50
  context "a little flaky" do
51
+ let(:results) {
52
+ [
53
+ Cucumber::Core::Test::Result::Failed.new(0, StandardError.new),
54
+ Cucumber::Core::Test::Result::Passed.new(0)
55
+ ]
56
+ }
57
+
57
58
  it "describes the test case twice" do
58
- results = [fail, pass]
59
59
  expect(receiver).to receive(:test_case) {|test_case|
60
- configuration.notify(results.shift)
60
+ configuration.notify :test_case_finished, test_case, results.shift
61
61
  }.exactly(2).times
62
62
 
63
63
  filter.test_case(test_case)
@@ -65,11 +65,17 @@ describe Cucumber::Filters::Retry do
65
65
  end
66
66
 
67
67
  context "really flaky" do
68
- it "describes the test case 3 times" do
69
- results = [fail, fail, pass]
68
+ let(:results) {
69
+ [
70
+ Cucumber::Core::Test::Result::Failed.new(0, StandardError.new),
71
+ Cucumber::Core::Test::Result::Failed.new(0, StandardError.new),
72
+ Cucumber::Core::Test::Result::Passed.new(0)
73
+ ]
74
+ }
70
75
 
76
+ it "describes the test case 3 times" do
71
77
  expect(receiver).to receive(:test_case) {|test_case|
72
- configuration.notify(results.shift)
78
+ configuration.notify :test_case_finished, test_case, results.shift
73
79
  }.exactly(3).times
74
80
 
75
81
  filter.test_case(test_case)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "cucumber/filters/tag_limits"
2
3
 
3
4
  describe Cucumber::Filters::TagLimits::TestCaseIndex do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "cucumber/filters/tag_limits"
2
3
 
3
4
  describe Cucumber::Filters::TagLimits::Verifier do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "cucumber/filters/tag_limits"
2
3
 
3
4
  describe Cucumber::Filters::TagLimits do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'cucumber/formatter/ansicolor'
3
4
 
@@ -0,0 +1,14 @@
1
+ require 'cucumber/configuration'
2
+ require 'cucumber/formatter/console_counts'
3
+
4
+ module Cucumber
5
+ module Formatter
6
+ describe ConsoleCounts do
7
+ it "works for zero" do
8
+ config = Configuration.new
9
+ counts = ConsoleCounts.new(config)
10
+ expect(counts.to_s).to eq "0 scenarios\n0 steps"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'cucumber/formatter/spec_helper'
3
4
  require 'cucumber/formatter/debug'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'cucumber/formatter/duration'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/formatter/fail_fast'
2
3
  require 'cucumber/core'
3
4
  require 'cucumber/core/gherkin/writer'
@@ -14,7 +15,6 @@ module Cucumber::Formatter
14
15
 
15
16
  let(:configuration) { Cucumber::Configuration.new }
16
17
  before { FailFast.new(configuration) }
17
- let(:report) { EventBusReport.new(configuration) }
18
18
 
19
19
  context 'failing scenario' do
20
20
  before(:each) do
@@ -36,7 +36,7 @@ module Cucumber::Formatter
36
36
  end
37
37
 
38
38
  it 'sets Cucumber.wants_to_quit' do
39
- execute([@gherkin], report, [StandardStepActions.new])
39
+ execute [@gherkin], [StandardStepActions.new], configuration.event_bus
40
40
  expect(Cucumber.wants_to_quit).to be true
41
41
  end
42
42
  end
@@ -53,7 +53,7 @@ module Cucumber::Formatter
53
53
  end
54
54
 
55
55
  it 'doesn\'t set Cucumber.wants_to_quit' do
56
- execute([@gherkin], report, [StandardStepActions.new])
56
+ execute [@gherkin], [StandardStepActions.new], configuration.event_bus
57
57
  expect(Cucumber.wants_to_quit).to be_falsey
58
58
  end
59
59
  end
@@ -70,7 +70,7 @@ module Cucumber::Formatter
70
70
  end
71
71
 
72
72
  it 'doesn\'t set Cucumber.wants_to_quit' do
73
- execute([@gherkin], report, [StandardStepActions.new])
73
+ execute [@gherkin], [StandardStepActions.new], configuration.event_bus
74
74
  expect(Cucumber.wants_to_quit).to be_falsey
75
75
  end
76
76
 
@@ -78,7 +78,7 @@ module Cucumber::Formatter
78
78
  let(:configuration) { Cucumber::Configuration.new strict: true }
79
79
 
80
80
  it 'sets Cucumber.wants_to_quit' do
81
- execute([@gherkin], report, [StandardStepActions.new])
81
+ execute [@gherkin], [StandardStepActions.new], configuration.event_bus
82
82
  expect(Cucumber.wants_to_quit).to be_truthy
83
83
  end
84
84
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'cucumber/formatter/spec_helper'
3
4
  require 'cucumber/formatter/html'
@@ -31,7 +32,6 @@ module Cucumber
31
32
 
32
33
  describe "when writing the report to a file" do
33
34
  before(:each) do
34
- allow(@out).to receive(:respond_to?).with(:path, false).and_return(true)
35
35
  allow(@out).to receive(:respond_to?).with(:path).and_return(true)
36
36
  expect(@out).to receive(:path).and_return('out/file.html')
37
37
  run_defined_feature
@@ -267,6 +267,11 @@ module Cucumber
267
267
 
268
268
  it { expect(@doc).to have_css_node('.feature .scenario .step.failed .message', /eek/) }
269
269
  it { expect(@doc).to have_css_node('.feature .scenario .step.failed .message', /StandardError/) }
270
+ it 'has the backtrace embeded in the output once and only once' do
271
+ html_str = @doc.to_s
272
+ expect(html_str).not_to match(%r{<pre\b.*html_spec.rb:.*html_spec.rb:.*</pre>}m)
273
+ expect(html_str).to match(%r{<pre\b.*html_spec.rb:.*</pre>}m)
274
+ end
270
275
  end
271
276
 
272
277
  describe "with a step that fails in the background" do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'cucumber/formatter/interceptor'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'cucumber/formatter/spec_helper'
3
4
  require 'cucumber/formatter/json'
@@ -105,7 +106,7 @@ module Cucumber
105
106
  [{"keyword": "Given ",
106
107
  "name": "there are bananas",
107
108
  "line": 4,
108
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:86"},
109
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:87"},
109
110
  "result": {"status": "passed",
110
111
  "duration": 1}}]}]}]})
111
112
  end
@@ -142,9 +143,9 @@ module Cucumber
142
143
  [{"keyword": "Given ",
143
144
  "name": "there are bananas",
144
145
  "line": 4,
145
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:123"},
146
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:124"},
146
147
  "result": {"status": "failed",
147
- "error_message": "no bananas (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:123:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
148
+ "error_message": "no bananas (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:124:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
148
149
  "duration": 1}}]}]}]})
149
150
  end
150
151
  end
@@ -180,9 +181,9 @@ module Cucumber
180
181
  [{"keyword": "Given ",
181
182
  "name": "there are bananas",
182
183
  "line": 4,
183
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:161"},
184
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:162"},
184
185
  "result": {"status": "pending",
185
- "error_message": "TODO (Cucumber::Pending)\\n./spec/cucumber/formatter/json_spec.rb:161:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
186
+ "error_message": "TODO (Cucumber::Pending)\\n./spec/cucumber/formatter/json_spec.rb:162:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
186
187
  "duration": 1}}]}]}]})
187
188
  end
188
189
  end
@@ -222,7 +223,7 @@ module Cucumber
222
223
  [{"keyword": "Given ",
223
224
  "name": "there are bananas",
224
225
  "line": 8,
225
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:203"},
226
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:204"},
226
227
  "result": {"status": "passed",
227
228
  "duration": 1}}]}]}]})
228
229
  end
@@ -276,7 +277,7 @@ module Cucumber
276
277
  [{"keyword": "Given ",
277
278
  "name": "there are bananas",
278
279
  "line": 6,
279
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:251"},
280
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:252"},
280
281
  "result": {"status": "passed",
281
282
  "duration": 1}}]},
282
283
  {"id": "banana-party;monkey-eats-bananas;fruit-table;2",
@@ -295,7 +296,7 @@ module Cucumber
295
296
  [{"keyword": "Given ",
296
297
  "name": "there are bananas",
297
298
  "line": 15,
298
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:251"},
299
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:252"},
299
300
  "result": {"status": "passed",
300
301
  "duration": 1}}]}]}]})
301
302
  end
@@ -354,7 +355,7 @@ module Cucumber
354
355
  [{"keyword": "Given ",
355
356
  "name": "there are bananas",
356
357
  "line": 6,
357
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:331"},
358
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:332"},
358
359
  "result": {"status": "passed",
359
360
  "duration": 1}}]},
360
361
  {"id": "banana-party;monkey-eats-bananas",
@@ -371,7 +372,7 @@ module Cucumber
371
372
  "line": 11,
372
373
  "comments": [{"value": "#step comment1",
373
374
  "line": 10}],
374
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:332"},
375
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:333"},
375
376
  "result": {"status": "passed",
376
377
  "duration": 1}}]},
377
378
  {"keyword": "Background",
@@ -385,7 +386,7 @@ module Cucumber
385
386
  [{"keyword": "Given ",
386
387
  "name": "there are bananas",
387
388
  "line": 6,
388
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:331"},
389
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:332"},
389
390
  "result": {"status": "passed",
390
391
  "duration": 1}}]},
391
392
  {"id": "banana-party;monkey-eats-bananas;fruit-table;2",
@@ -406,7 +407,7 @@ module Cucumber
406
407
  "line": 22,
407
408
  "comments": [{"value": "#step comment2",
408
409
  "line": 15}],
409
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:332"},
410
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:333"},
410
411
  "result": {"status": "passed",
411
412
  "duration": 1}}]}]}]})
412
413
  end
@@ -449,7 +450,7 @@ module Cucumber
449
450
  "doc_string": {"value": "the doc string",
450
451
  "content_type": "",
451
452
  "line": 5},
452
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:427"},
453
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:428"},
453
454
  "result": {"status": "passed",
454
455
  "duration": 1}}]}]}]})
455
456
  end
@@ -487,7 +488,7 @@ module Cucumber
487
488
  "name": "there are bananas",
488
489
  "line": 4,
489
490
  "output": ["from step"],
490
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:467"},
491
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:468"},
491
492
  "result": {"status": "passed",
492
493
  "duration": 1}}]}]}]})
493
494
  end
@@ -599,7 +600,7 @@ module Cucumber
599
600
  "line": 4,
600
601
  "embeddings": [{"mime_type": "mime-type",
601
602
  "data": "YWJj"}],
602
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:577"},
603
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:578"},
603
604
  "result": {"status": "passed",
604
605
  "duration": 1}}]}]}]})
605
606
  end
@@ -644,7 +645,7 @@ module Cucumber
644
645
  "line": 4,
645
646
  "embeddings": [{"mime_type": "image/png",
646
647
  "data": "Zm9v"}],
647
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:617"},
648
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:618"},
648
649
  "result": {"status": "passed",
649
650
  "duration": 1}}]}]}]})
650
651
  end
@@ -685,31 +686,31 @@ module Cucumber
685
686
  "description": "",
686
687
  "type": "scenario",
687
688
  "before":
688
- [{"match": {"location": "spec/cucumber/formatter/json_spec.rb:662"},
689
+ [{"match": {"location": "spec/cucumber/formatter/json_spec.rb:663"},
689
690
  "result": {"status": "passed",
690
691
  "duration": 1}},
691
- {"match": {"location": "spec/cucumber/formatter/json_spec.rb:663"},
692
+ {"match": {"location": "spec/cucumber/formatter/json_spec.rb:664"},
692
693
  "result": {"status": "passed",
693
694
  "duration": 1}}],
694
695
  "steps":
695
696
  [{"keyword": "Given ",
696
697
  "name": "there are bananas",
697
698
  "line": 4,
698
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:669"},
699
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:670"},
699
700
  "result": {"status": "passed",
700
701
  "duration": 1},
701
702
  "after":
702
- [{"match": {"location": "spec/cucumber/formatter/json_spec.rb:666"},
703
+ [{"match": {"location": "spec/cucumber/formatter/json_spec.rb:667"},
703
704
  "result": {"status": "passed",
704
705
  "duration": 1}},
705
- {"match": {"location": "spec/cucumber/formatter/json_spec.rb:667"},
706
+ {"match": {"location": "spec/cucumber/formatter/json_spec.rb:668"},
706
707
  "result": {"status": "passed",
707
708
  "duration": 1}}]}],
708
709
  "after":
709
- [{"match": {"location": "spec/cucumber/formatter/json_spec.rb:665"},
710
+ [{"match": {"location": "spec/cucumber/formatter/json_spec.rb:666"},
710
711
  "result": {"status": "passed",
711
712
  "duration": 1}},
712
- {"match": {"location": "spec/cucumber/formatter/json_spec.rb:664"},
713
+ {"match": {"location": "spec/cucumber/formatter/json_spec.rb:665"},
713
714
  "result": {"status": "passed",
714
715
  "duration": 1}}]}]}]})
715
716
  end
@@ -747,13 +748,13 @@ module Cucumber
747
748
  [{"keyword": "Given ",
748
749
  "name": "there are bananas",
749
750
  "line": 4,
750
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:728"},
751
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:729"},
751
752
  "result": {"status": "passed",
752
753
  "duration": 1}}],
753
754
  "around":
754
755
  [{"match": {"location": "unknown_hook_location:1"},
755
756
  "result": {"status": "failed",
756
- "error_message": "error (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:727:in `Around'",
757
+ "error_message": "error (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:728:in `Around'",
757
758
  "duration": 1}}]}]}]})
758
759
  end
759
760
  end
@@ -791,10 +792,10 @@ module Cucumber
791
792
  [{"keyword": "Given ",
792
793
  "name": "there are bananas",
793
794
  "line": 4,
794
- "rows":
795
- [{"cells": ["aa", "bb"]},
795
+ "rows":
796
+ [{"cells": ["aa", "bb"]},
796
797
  {"cells": ["cc", "dd"]}],
797
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:772"},
798
+ "match": {"location": "spec/cucumber/formatter/json_spec.rb:773"},
798
799
  "result": {"status": "passed",
799
800
  "duration": 1}}]}]}]})
800
801
  end