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
  module RbSupport
3
4
  # This module defines the methods you can use to define pure Ruby
@@ -11,8 +12,8 @@ module Cucumber
11
12
  alias_method adverb, :register_rb_step_definition
12
13
  end
13
14
 
14
- def build_rb_world_factory(world_modules, proc)
15
- @rb_language.build_rb_world_factory(world_modules, proc)
15
+ def build_rb_world_factory(world_modules, namespaced_world_modules, proc)
16
+ @rb_language.build_rb_world_factory(world_modules, namespaced_world_modules, proc)
16
17
  end
17
18
 
18
19
  def register_rb_hook(phase, tag_names, proc)
@@ -33,6 +34,10 @@ module Cucumber
33
34
  # Object that the scenario's steps will run within. Any +world_modules+
34
35
  # will be mixed into this Object (via Object#extend).
35
36
  #
37
+ # By default the +world modules+ are added to a global namespace. It is
38
+ # possible to create a namespaced World by using an hash, where the
39
+ # symbols are the namespaces.
40
+ #
36
41
  # This method is typically called from one or more Ruby scripts under
37
42
  # <tt>features/support</tt>. You can call this method as many times as you
38
43
  # like (to register more modules), but if you try to register more than
@@ -46,8 +51,10 @@ module Cucumber
46
51
  #
47
52
  # World(MyModule)
48
53
  #
49
- def World(*world_modules, &proc)
50
- RbDsl.build_rb_world_factory(world_modules, proc)
54
+ # World(my_module: MyModule)
55
+ #
56
+ def World(*world_modules, **namespaced_world_modules, &proc)
57
+ RbDsl.build_rb_world_factory(world_modules, namespaced_world_modules, proc)
51
58
  end
52
59
 
53
60
  # Registers a proc that will run before each Scenario. You can register as many
@@ -83,11 +90,6 @@ module Cucumber
83
90
  # provided proc. The return value of the proc is consequently yielded to the
84
91
  # step definition.
85
92
  def Transform(regexp, &proc)
86
- Cucumber.deprecate(
87
- "\n Please follow the upgrade instructions at https://cucumber.io/blog/2017/09/21/upgrading-to-cucumber-3",
88
- "Transform",
89
- "3.0.0"
90
- )
91
93
  RbDsl.register_rb_transform(regexp, proc)
92
94
  end
93
95
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  module RbSupport
3
4
  # Wrapper for Before, After and AfterStep hooks
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/core_ext/instance_exec'
2
3
  require 'cucumber/rb_support/rb_dsl'
3
4
  require 'cucumber/rb_support/rb_world'
@@ -9,6 +10,7 @@ require 'cucumber/gherkin/i18n'
9
10
  require 'multi_test'
10
11
  require 'cucumber/step_match'
11
12
  require 'cucumber/step_definition_light'
13
+ require 'cucumber/events/step_definition_registered'
12
14
 
13
15
  module Cucumber
14
16
  module RbSupport
@@ -22,7 +24,8 @@ module Cucumber
22
24
  # Raised if there are 2 or more World blocks.
23
25
  class MultipleWorld < StandardError
24
26
  def initialize(first_proc, second_proc)
25
- message = "You can only pass a proc to #World once, but it's happening\n"
27
+ message = String.new
28
+ message << "You can only pass a proc to #World once, but it's happening\n"
26
29
  message << "in 2 places:\n\n"
27
30
  message << RbSupport.backtrace_line(first_proc, 'World') << "\n"
28
31
  message << RbSupport.backtrace_line(second_proc, 'World') << "\n\n"
@@ -46,11 +49,11 @@ module Cucumber
46
49
  end
47
50
 
48
51
  def initialize(runtime, configuration)
49
- @runtime = runtime
52
+ @runtime, @configuration = runtime, configuration
50
53
  @step_definitions = []
51
54
  RbDsl.rb_language = self
52
55
  @world_proc = @world_modules = nil
53
- configuration.register_snippet_generator(Snippet::Generator.new)
56
+ @configuration.register_snippet_generator(Snippet::Generator.new)
54
57
  end
55
58
 
56
59
  def step_matches(name_to_match)
@@ -79,16 +82,24 @@ module Cucumber
79
82
  def register_rb_step_definition(regexp, proc_or_sym, options)
80
83
  step_definition = RbStepDefinition.new(self, regexp, proc_or_sym, options)
81
84
  @step_definitions << step_definition
85
+ @configuration.notify :step_definition_registered, step_definition
82
86
  step_definition
83
87
  end
84
88
 
85
- def build_rb_world_factory(world_modules, proc)
86
- if(proc)
89
+ def build_rb_world_factory(world_modules, namespaced_world_modules, proc)
90
+ if proc
87
91
  raise MultipleWorld.new(@world_proc, proc) if @world_proc
88
92
  @world_proc = proc
89
93
  end
90
94
  @world_modules ||= []
91
95
  @world_modules += world_modules
96
+
97
+ @namespaced_world_modules ||= Hash.new { |h, k| h[k] = [] }
98
+ namespaced_world_modules.each do |namespace, world_module|
99
+ unless @namespaced_world_modules[namespace].include?(world_module)
100
+ @namespaced_world_modules[namespace] << world_module
101
+ end
102
+ end
92
103
  end
93
104
 
94
105
  def load_code_file(code_file)
@@ -177,9 +188,9 @@ module Cucumber
177
188
  def extend_world
178
189
  @current_world.extend(RbWorld)
179
190
  MultiTest.extend_with_best_assertion_library(@current_world)
180
- (@world_modules || []).each do |mod|
181
- @current_world.extend(mod)
182
- end
191
+
192
+ @current_world.add_modules!(@world_modules || [],
193
+ @namespaced_world_modules || {})
183
194
  end
184
195
 
185
196
  def connect_world(scenario)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/step_match'
2
3
  require 'cucumber/step_argument'
3
4
  require 'cucumber/core_ext/string'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  module RbSupport
3
4
  # A Ruby Transform holds a Regexp and a Proc, and is created
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/gherkin/formatter/ansi_escapes'
2
3
 
3
4
  module Cucumber
@@ -20,6 +21,12 @@ module Cucumber
20
21
  # @private
21
22
  attr_writer :__cucumber_runtime, :__natural_language
22
23
 
24
+ # Extend the World with user-defined modules
25
+ def add_modules!(world_modules, namespaced_world_modules)
26
+ add_world_modules!(world_modules)
27
+ add_namespaced_modules!(namespaced_world_modules)
28
+ end
29
+
23
30
  # Run a single Gherkin step
24
31
  # @example Call another step
25
32
  # step "I am logged in"
@@ -66,26 +73,6 @@ module Cucumber
66
73
  @__cucumber_runtime.table(text_or_table, file, line_offset)
67
74
  end
68
75
 
69
- # Create an {Cucumber::Ast::DocString} object
70
- #
71
- # Useful in conjunction with the #step method, when
72
- # want to specify a content type.
73
- # @example Create a multiline string
74
- # code = multiline_string(%{
75
- # puts "this is ruby code"
76
- # %}, 'ruby')
77
- def doc_string(string_without_triple_quotes, content_type='', line_offset=0)
78
- STDERR.puts AnsiEscapes.failed + "WARNING: #doc_string is deprecated. Just pass a regular String instead:" + caller[0] + AnsiEscapes.reset
79
- # TODO: rename this method to multiline_string
80
- @__cucumber_runtime.doc_string(string_without_triple_quotes, content_type, line_offset)
81
- end
82
-
83
- # @deprecated Use {#puts} instead.
84
- def announce(*messages)
85
- STDERR.puts AnsiEscapes.failed + "WARNING: #announce is deprecated. Use #puts instead:" + caller[0] + AnsiEscapes.reset
86
- puts(*messages)
87
- end
88
-
89
76
  # Print a message to the output.
90
77
  #
91
78
  # @note Cucumber might surprise you with the behaviour of this method. Instead
@@ -137,6 +124,7 @@ module Cucumber
137
124
  (class << self; self; end).instance_eval do
138
125
  modules += included_modules
139
126
  end
127
+ modules << stringify_namespaced_modules
140
128
  sprintf("#<%s:0x%x>", modules.join('+'), self.object_id)
141
129
  end
142
130
 
@@ -144,6 +132,40 @@ module Cucumber
144
132
  def to_s
145
133
  inspect
146
134
  end
135
+
136
+ private
137
+
138
+ # @private
139
+ def add_world_modules!(modules)
140
+ modules.each do |world_module|
141
+ extend(world_module)
142
+ end
143
+ end
144
+
145
+ # @private
146
+ def add_namespaced_modules!(modules)
147
+ @__namespaced_modules = modules
148
+ modules.each do |namespace, world_modules|
149
+ world_modules.each do |world_module|
150
+ variable_name = "@__#{namespace}_world"
151
+
152
+ inner_world = if self.class.respond_to?(namespace)
153
+ instance_variable_get(variable_name)
154
+ else
155
+ Object.new
156
+ end
157
+ instance_variable_set(variable_name,
158
+ inner_world.extend(world_module))
159
+ self.class.send(:define_method, namespace) do
160
+ instance_variable_get(variable_name)
161
+ end
162
+ end
163
+ end
164
+ end
165
+
166
+ def stringify_namespaced_modules
167
+ @__namespaced_modules.map { |k, v| "#{v.join(',')} (as #{k})" }.join('+')
168
+ end
147
169
  end
148
170
  end
149
171
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  module RbSupport
3
4
  module Snippet
@@ -56,7 +57,7 @@ module Cucumber
56
57
  end
57
58
 
58
59
  def do_block
59
- do_block = ""
60
+ do_block = String.new
60
61
  do_block << "do#{arguments}\n"
61
62
  multiline_argument.append_comment_to(do_block)
62
63
  do_block << " pending # Write code here that turns the phrase above into concrete actions\n"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'optparse'
2
3
 
3
4
  module Spec #:nodoc:
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspec/mocks'
2
3
 
3
4
  World(RSpec::Mocks::ExampleMethods)
@@ -1,5 +1,5 @@
1
+ # frozen_string_literal: true
1
2
  require 'delegate'
2
- require 'cucumber/deprecate'
3
3
 
4
4
  module Cucumber
5
5
  # Represents the current status of a running test case.
@@ -80,34 +80,10 @@ module Cucumber
80
80
  !failed?
81
81
  end
82
82
 
83
- def title
84
- Cucumber.deprecate(
85
- "Call #name instead",
86
- "RunningTestCase#title",
87
- "2.9.9")
88
- name
89
- end
90
-
91
- def source_tags
92
- Cucumber.deprecate(
93
- "Call #tags instead",
94
- "RunningTestCase#source_tags",
95
- "2.9.9")
96
- tags
97
- end
98
-
99
83
  def source_tag_names
100
84
  tags.map &:name
101
85
  end
102
86
 
103
- def skip_invoke!
104
- Cucumber.deprecate(
105
- "Call #skip_this_scenario directly (not on any object)",
106
- "RunningTestCase#skip_invoke!",
107
- "2.9.9")
108
- raise Cucumber::Core::Test::Result::Skipped
109
- end
110
-
111
87
  def outline?
112
88
  false
113
89
  end
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  require 'fileutils'
3
4
  require 'multi_json'
4
5
  require 'cucumber/configuration'
@@ -7,7 +8,6 @@ require 'cucumber/formatter/duration'
7
8
  require 'cucumber/file_specs'
8
9
  require 'cucumber/filters'
9
10
  require 'cucumber/formatter/fanout'
10
- require 'cucumber/formatter/event_bus_report'
11
11
  require 'cucumber/gherkin/i18n'
12
12
  require 'cucumber/step_match_search'
13
13
 
@@ -58,13 +58,16 @@ module Cucumber
58
58
 
59
59
  require 'cucumber/wire/plugin'
60
60
  def run!
61
- load_step_definitions
62
61
  install_wire_plugin
62
+ load_support_files
63
63
  fire_after_configuration_hook
64
+ formatters
65
+ load_step_definitions
64
66
  self.visitor = report
65
67
 
66
- receiver = Test::Runner.new(report)
68
+ receiver = Test::Runner.new(@configuration.event_bus)
67
69
  compile features, receiver, filters
70
+ @configuration.notify :test_run_finished
68
71
  end
69
72
 
70
73
  def features_paths
@@ -169,17 +172,13 @@ module Cucumber
169
172
  require 'cucumber/core/report/summary'
170
173
  def report
171
174
  return @report if @report
172
- reports = [summary_report, event_bus_report] + formatters
175
+ reports = [summary_report] + formatters
173
176
  reports << fail_fast_report if @configuration.fail_fast?
174
177
  @report ||= Formatter::Fanout.new(reports)
175
178
  end
176
179
 
177
180
  def summary_report
178
- @summary_report ||= Core::Report::Summary.new
179
- end
180
-
181
- def event_bus_report
182
- @event_bus_report ||= Formatter::EventBusReport.new(@configuration)
181
+ @summary_report ||= Core::Report::Summary.new(@configuration.event_bus)
183
182
  end
184
183
 
185
184
  def fail_fast_report
@@ -231,6 +230,7 @@ module Cucumber
231
230
  filters << Cucumber::Core::Test::LocationsFilter.new(filespecs.locations)
232
231
  filters << Filters::Randomizer.new(@configuration.seed) if @configuration.randomize?
233
232
  filters << Filters::Quit.new
233
+ filters << Filters::Retry.new(@configuration)
234
234
  # TODO: can we just use RbLanguages's step definitions directly?
235
235
  step_match_search = StepMatchSearch.new(@support_code.ruby.method(:step_matches), @configuration)
236
236
  filters << Filters::ActivateSteps.new(step_match_search, @configuration)
@@ -248,8 +248,13 @@ module Cucumber
248
248
  end
249
249
  end
250
250
 
251
+ def load_support_files
252
+ files = @configuration.support_to_load
253
+ @support_code.load_files!(files)
254
+ end
255
+
251
256
  def load_step_definitions
252
- files = @configuration.support_to_load + @configuration.step_defs_to_load
257
+ files = @configuration.step_defs_to_load
253
258
  @support_code.load_files!(files)
254
259
  end
255
260
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  class Runtime
3
4
  class AfterHooks
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/hooks'
2
3
 
3
4
  module Cucumber
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'forwardable'
2
3
  require 'cucumber/core/ast/doc_string'
3
4
  require 'cucumber/core/ast/data_table'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  class Runtime
3
4
  class StepHooks
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/constantize'
2
3
  require 'cucumber/runtime/for_programming_languages'
3
4
  require 'cucumber/runtime/step_hooks'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'timeout'
2
3
 
3
4
  module Cucumber
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  # Defines the location and value of a captured argument from the step
3
4
  # text
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  # Only used for keeping track of available and invoked step definitions
3
4
  # in a way that also works for other programming languages (i.e. cuke4duke)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  class StepDefinitions
3
4
  def initialize(configuration = Configuration.default)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'cucumber/multiline_argument'
2
3
 
3
4
  module Cucumber
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  module StepMatchSearch
3
4
  def self.new(search, configuration)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Cucumber
2
3
  module Term
3
4
  # The ANSIColor module can be used for namespacing and mixed into your own