cucumber 3.0.0.pre.2 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +32 -0
  3. data/.github/ISSUE_TEMPLATE.md +1 -1
  4. data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
  5. data/.rubocop_todo.yml +1 -85
  6. data/.travis.yml +3 -2
  7. data/{History.md → CHANGELOG.md} +77 -13
  8. data/appveyor.yml +2 -1
  9. data/bin/cucumber +2 -1
  10. data/cucumber.gemspec +2 -2
  11. data/examples/i18n/ar/features/step_definitions/calculator_steps.rb +6 -1
  12. data/examples/i18n/bg/features/support/env.rb +6 -1
  13. data/examples/i18n/bg/lib/calculator.rb +2 -1
  14. data/examples/i18n/ca/features/step_definitions/calculator_steps.rb +6 -1
  15. data/examples/i18n/cs/features/step_definitions/calculator_steps.rb +6 -1
  16. data/examples/i18n/da/features/step_definitions/lommeregner_steps.rb +6 -1
  17. data/examples/i18n/de/features/step_definitions/calculator_steps.rb +6 -1
  18. data/examples/i18n/el/features/step_definitions/calculator_steps.rb +6 -1
  19. data/examples/i18n/en-lol/features/support/env.rb +6 -2
  20. data/examples/i18n/en/features/step_definitions/calculator_steps.rb +6 -1
  21. data/examples/i18n/eo/features/step_definitions/calculator_steps.rb +6 -1
  22. data/examples/i18n/es/features/step_definitions/calculador_steps.rb +6 -1
  23. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +6 -1
  24. data/examples/i18n/fi/features/step_definitions/laskin_steps.rb +6 -1
  25. data/examples/i18n/fr/features/support/env.rb +6 -1
  26. data/examples/i18n/he/features/step_definitions/calculator_steps.rb +6 -1
  27. data/examples/i18n/hi/features/step_definitions/calculator_steps.rb +6 -1
  28. data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +6 -2
  29. data/examples/i18n/hu/features/step_definitions/calculator_steps.rb +6 -1
  30. data/examples/i18n/id/features/step_definitions/calculator_steps.rb +6 -1
  31. data/examples/i18n/it/features/step_definitions/calcolatrice_steps.rb +6 -1
  32. data/examples/i18n/ja/features/support/env.rb +6 -1
  33. data/examples/i18n/ko/features/step_definitions/calculator_steps.rb +6 -1
  34. data/examples/i18n/lt/features/step_definitions/calculator_steps.rb +6 -1
  35. data/examples/i18n/lv/features/step_definitions/calculator_steps.rb +6 -1
  36. data/examples/i18n/no/features/support/env.rb +6 -1
  37. data/examples/i18n/pl/features/step_definitions/calculator_steps.rb +6 -1
  38. data/examples/i18n/pl/features/support/env.rb +6 -1
  39. data/examples/i18n/pt/features/support/env.rb +6 -1
  40. data/examples/i18n/ro/features/step_definitions/calculator_steps.rb +6 -1
  41. data/examples/i18n/ru/features/support/env.rb +6 -1
  42. data/examples/i18n/ru/lib/calculator.rb +2 -1
  43. data/examples/i18n/sk/features/step_definitions/calculator_steps.rb +6 -1
  44. data/examples/i18n/sr-Cyrl/features/support/env.rb +6 -1
  45. data/examples/i18n/sr-Latn/features/step_definitions/calculator_steps.rb +6 -1
  46. data/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb +6 -1
  47. data/examples/i18n/tr/features/step_definitions/hesap_makinesi_adimlari.rb +6 -1
  48. data/examples/i18n/uk/features/support/env.rb +6 -1
  49. data/examples/i18n/uk/lib/calculator.rb +2 -1
  50. data/examples/i18n/uz/features/support/env.rb +6 -1
  51. data/examples/i18n/uz/lib/calculator.rb +2 -1
  52. data/examples/i18n/zh-CN/features/step_definitions/calculator_steps.rb +6 -1
  53. data/examples/i18n/zh-TW/features/step_definitions/calculator_steps.rb +6 -1
  54. data/examples/sinatra/features/support/env.rb +6 -1
  55. data/examples/tcl/features/support/env.rb +2 -1
  56. data/examples/watir/features/step_definitions/search_steps.rb +4 -3
  57. data/examples/watir/features/support/env.rb +5 -1
  58. data/features/docs/api/listen_for_events.feature +2 -2
  59. data/features/docs/cli/execute_with_tag_filter.feature +4 -2
  60. data/features/docs/defining_steps/ambiguous_steps.feature +89 -0
  61. data/features/docs/events/{test_case_starting_event.feature → test_case_started_event.feature} +3 -3
  62. data/features/docs/events/{test_run_starting_event.feature → test_run_started_event.feature} +5 -5
  63. data/features/docs/events/test_step_finished_event.feature +1 -1
  64. data/features/docs/events/{test_step_starting_event.feature → test_step_started_event.feature} +3 -3
  65. data/features/docs/extending_cucumber/custom_formatter.feature +5 -33
  66. data/features/docs/gherkin/outlines.feature +2 -4
  67. data/features/docs/writing_support_code/parameter_types.feature +12 -18
  68. data/features/lib/step_definitions/iso-8859-1_steps.rb +6 -3
  69. data/features/lib/support/fake_wire_server.rb +9 -1
  70. data/features/lib/support/parameter_types.rb +1 -4
  71. data/gem_tasks/fix_cr_lf.rake +17 -6
  72. data/lib/autotest/cucumber_mixin.rb +1 -1
  73. data/lib/cucumber/cli/configuration.rb +2 -2
  74. data/lib/cucumber/cli/options.rb +62 -41
  75. data/lib/cucumber/cli/profile_loader.rb +1 -1
  76. data/lib/cucumber/configuration.rb +3 -2
  77. data/lib/cucumber/deprecate.rb +2 -2
  78. data/lib/cucumber/events.rb +3 -3
  79. data/lib/cucumber/events/test_case_finished.rb +1 -1
  80. data/lib/cucumber/events/{test_case_starting.rb → test_case_started.rb} +1 -1
  81. data/lib/cucumber/events/{test_run_starting.rb → test_run_started.rb} +1 -1
  82. data/lib/cucumber/events/{test_step_starting.rb → test_step_started.rb} +1 -1
  83. data/lib/cucumber/filters.rb +1 -1
  84. data/lib/cucumber/filters/activate_steps.rb +6 -2
  85. data/lib/cucumber/filters/{broadcast_test_run_starting_event.rb → broadcast_test_run_started_event.rb} +2 -2
  86. data/lib/cucumber/formatter/console.rb +1 -1
  87. data/lib/cucumber/formatter/console_issues.rb +2 -2
  88. data/lib/cucumber/formatter/fail_fast.rb +1 -1
  89. data/lib/cucumber/formatter/html.rb +9 -10
  90. data/lib/cucumber/formatter/html_builder.rb +21 -11
  91. data/lib/cucumber/formatter/io.rb +1 -1
  92. data/lib/cucumber/formatter/json.rb +13 -12
  93. data/lib/cucumber/formatter/junit.rb +7 -7
  94. data/lib/cucumber/formatter/legacy_api/adapter.rb +30 -14
  95. data/lib/cucumber/formatter/legacy_api/ast.rb +10 -2
  96. data/lib/cucumber/formatter/progress.rb +2 -2
  97. data/lib/cucumber/formatter/rerun.rb +1 -1
  98. data/lib/cucumber/formatter/summary.rb +1 -1
  99. data/lib/cucumber/glue/dsl.rb +11 -25
  100. data/lib/cucumber/glue/proto_world.rb +0 -5
  101. data/lib/cucumber/hooks.rb +4 -4
  102. data/lib/cucumber/multiline_argument.rb +3 -11
  103. data/lib/cucumber/multiline_argument/data_table.rb +5 -3
  104. data/lib/cucumber/project_initializer.rb +1 -1
  105. data/lib/cucumber/rake/task.rb +8 -4
  106. data/lib/cucumber/runtime.rb +2 -2
  107. data/lib/cucumber/runtime/support_code.rb +1 -1
  108. data/lib/cucumber/runtime/user_interface.rb +5 -5
  109. data/lib/cucumber/step_match.rb +13 -0
  110. data/lib/cucumber/version +1 -1
  111. data/scripts/{update-history → update-changelog} +14 -11
  112. data/spec/cucumber/cli/configuration_spec.rb +13 -1
  113. data/spec/cucumber/cli/options_spec.rb +1 -1
  114. data/spec/cucumber/filters/activate_steps_spec.rb +4 -4
  115. data/spec/cucumber/formatter/fail_fast_spec.rb +1 -1
  116. data/spec/cucumber/formatter/html_spec.rb +1 -1
  117. data/spec/cucumber/formatter/json_spec.rb +26 -51
  118. data/spec/cucumber/formatter/junit_spec.rb +4 -4
  119. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +86 -98
  120. data/spec/cucumber/formatter/pretty_spec.rb +0 -13
  121. data/spec/cucumber/glue/snippet_spec.rb +2 -2
  122. data/spec/cucumber/hooks_spec.rb +2 -2
  123. data/spec/cucumber/multiline_argument/data_table_spec.rb +10 -5
  124. data/spec/cucumber/rake/forked_spec.rb +15 -11
  125. data/spec/cucumber/world/pending_spec.rb +1 -1
  126. data/spec/support/standard_step_actions.rb +1 -1
  127. metadata +25 -25
  128. data/features/docs/formatters/formatter_step_file_colon_line.feature +0 -44
@@ -5,20 +5,18 @@ require 'pathname'
5
5
  module Cucumber
6
6
  module Formatter
7
7
  class HtmlBuilder < Builder::XmlMarkup
8
- def embed_text(src: nil, label: nil, id: nil)
9
- raise ArgumentError, 'missing required argument' unless src && label && id # for Ruby 2.0 compatibility
8
+ VALID_EMBED_TYPES = [:text, :image].freeze
10
9
 
11
- prepend_to_span('embed', %{<a id="#{id}" href="#{src}" title="#{label}">#{label}</a>})
12
- end
10
+ class InvalidEmbedTypeError < ::StandardError
11
+ MESSAGE = 'Invalid embed type. Valid types are :text and :image.'.freeze
13
12
 
14
- def embed_image(src: nil, label: nil, id: nil)
15
- raise ArgumentError, 'missing required argument' unless src && label && id # for Ruby 2.0 compatibility
13
+ def initialize(message=MESSAGE)
14
+ super(message)
15
+ end
16
+ end
16
17
 
17
- prepend_to_span(
18
- 'embed',
19
- %{<a href="" onclick="img=document.getElementById('#{id}'); img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false">#{label}</a><br>&nbsp;
20
- <img id="#{id}" style="display: none" src="#{src}"/>}
21
- )
18
+ def embed(type: nil, src: nil, label: nil, id: nil)
19
+ prepend_to_span('embed', string_to_embed(type: type, src: src, label: label, id: id))
22
20
  end
23
21
 
24
22
  def declare!
@@ -51,6 +49,18 @@ module Cucumber
51
49
 
52
50
  private
53
51
 
52
+ def string_to_embed(type: nil, src: nil, label: nil, id: nil)
53
+ raise ::ArgumentError, 'missing required argument' unless type && src && label && id # for Ruby 2.0 compatibility
54
+ raise InvalidEmbedTypeError unless VALID_EMBED_TYPES.include?(type)
55
+
56
+ if type == :image
57
+ %{<a href="" onclick="img=document.getElementById('#{id}'); img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false">#{label}</a><br>&nbsp;
58
+ <img id="#{id}" style="display: none" src="#{src}"/>}
59
+ else
60
+ %{<a id="#{id}" href="#{src}" title="#{label}">#{label}</a>}
61
+ end
62
+ end
63
+
54
64
  def summary_div
55
65
  div(id: 'summary') do
56
66
  p('', id: 'totals')
@@ -28,7 +28,7 @@ module Cucumber
28
28
  raise "You *must* specify --out DIR for the #{name} formatter" unless String === path
29
29
  raise "I can't write #{name} reports to a file - it has to be a directory" if File.file?(path)
30
30
  FileUtils.mkdir_p(path) unless File.directory?(path)
31
- path
31
+ File.absolute_path path
32
32
  end
33
33
  end
34
34
  end
@@ -14,14 +14,15 @@ module Cucumber
14
14
  def initialize(config)
15
15
  @io = ensure_io(config.out_stream)
16
16
  @feature_hashes = []
17
- config.on_event :test_case_starting, &method(:on_test_case_starting)
17
+ @step_or_hook_hash = {}
18
+ config.on_event :test_case_started, &method(:on_test_case_started)
18
19
  config.on_event :test_case_finished, &method(:on_test_case_finished)
19
- config.on_event :test_step_starting, &method(:on_test_step_starting)
20
+ config.on_event :test_step_started, &method(:on_test_step_started)
20
21
  config.on_event :test_step_finished, &method(:on_test_step_finished)
21
22
  config.on_event :test_run_finished, &method(:on_test_run_finished)
22
23
  end
23
24
 
24
- def on_test_case_starting(event)
25
+ def on_test_case_started(event)
25
26
  test_case = event.test_case
26
27
  builder = Builder.new(test_case)
27
28
  unless same_feature_as_previous_test_case?(test_case.feature)
@@ -39,7 +40,7 @@ module Cucumber
39
40
  @any_step_failed = false
40
41
  end
41
42
 
42
- def on_test_step_starting(event)
43
+ def on_test_step_started(event)
43
44
  test_step = event.test_step
44
45
  return if internal_hook?(test_step)
45
46
  hook_query = HookQueryVisitor.new(test_step)
@@ -101,7 +102,7 @@ module Cucumber
101
102
  end
102
103
 
103
104
  def first_step_after_background?(test_step)
104
- test_step.source[1].name != @element_hash[:name]
105
+ test_step.source[1].to_s != @element_hash[:name]
105
106
  end
106
107
 
107
108
  def internal_hook?(test_step)
@@ -129,7 +130,7 @@ module Cucumber
129
130
  when :after_step
130
131
  return after_step_hooks
131
132
  else
132
- fail 'Unkown hook type ' + hook_query.type.to_s
133
+ fail 'Unknown hook type ' + hook_query.type.to_s
133
134
  end
134
135
  end
135
136
 
@@ -160,7 +161,7 @@ module Cucumber
160
161
  def create_step_hash(step_source)
161
162
  step_hash = {
162
163
  keyword: step_source.keyword,
163
- name: step_source.name,
164
+ name: step_source.to_s,
164
165
  line: step_source.location.line
165
166
  }
166
167
  step_hash[:comments] = Formatter.create_comments_array(step_source.comments) unless step_source.comments.empty?
@@ -239,7 +240,7 @@ module Cucumber
239
240
  uri: feature.file,
240
241
  id: create_id(feature),
241
242
  keyword: feature.keyword,
242
- name: feature.name,
243
+ name: feature.to_s,
243
244
  description: feature.description,
244
245
  line: feature.location.line
245
246
  }
@@ -258,7 +259,7 @@ module Cucumber
258
259
  def background(background)
259
260
  @background_hash = {
260
261
  keyword: background.keyword,
261
- name: background.name,
262
+ name: background.to_s,
262
263
  description: background.description,
263
264
  line: background.location.line,
264
265
  type: 'background'
@@ -270,7 +271,7 @@ module Cucumber
270
271
  @test_case_hash = {
271
272
  id: create_id(scenario),
272
273
  keyword: scenario.keyword,
273
- name: scenario.name,
274
+ name: scenario.to_s,
274
275
  description: scenario.description,
275
276
  line: scenario.location.line,
276
277
  type: 'scenario'
@@ -283,7 +284,7 @@ module Cucumber
283
284
  @test_case_hash = {
284
285
  id: create_id(scenario) + ';' + @example_id,
285
286
  keyword: scenario.keyword,
286
- name: scenario.name,
287
+ name: scenario.to_s,
287
288
  description: scenario.description,
288
289
  line: @row.location.line,
289
290
  type: 'scenario'
@@ -316,7 +317,7 @@ module Cucumber
316
317
  private
317
318
 
318
319
  def create_id(element)
319
- element.name.downcase.tr(' ', '-')
320
+ element.to_s.downcase.tr(' ', '-')
320
321
  end
321
322
 
322
323
  def create_tags_array(tags)
@@ -19,7 +19,7 @@ module Cucumber
19
19
  end
20
20
 
21
21
  def initialize(config)
22
- config.on_event :test_case_starting, &method(:on_test_case_starting)
22
+ config.on_event :test_case_started, &method(:on_test_case_started)
23
23
  config.on_event :test_case_finished, &method(:on_test_case_finished)
24
24
  config.on_event :test_step_finished, &method(:on_test_step_finished)
25
25
  config.on_event :test_run_finished, &method(:on_test_run_finished)
@@ -36,7 +36,7 @@ module Cucumber
36
36
  }}
37
37
  end
38
38
 
39
- def on_test_case_starting(event)
39
+ def on_test_case_started(event)
40
40
  test_case = event.test_case
41
41
  unless same_feature_as_previous_test_case?(test_case.feature)
42
42
  start_feature(test_case.feature)
@@ -52,7 +52,7 @@ module Cucumber
52
52
  test_step, result = *event.attributes
53
53
  return if @failing_step_source
54
54
 
55
- @failing_step_source = test_step.source.last unless result.ok?(@config.strict?)
55
+ @failing_step_source = test_step.source.last unless result.ok?(@config.strict)
56
56
  end
57
57
 
58
58
  def on_test_case_finished(event)
@@ -102,10 +102,10 @@ module Cucumber
102
102
 
103
103
  def create_output_string(test_case, scenario, result, row_name)
104
104
  output = "#{test_case.keyword}: #{scenario}\n\n"
105
- return output if result.ok?(@config.strict?)
105
+ return output if result.ok?(@config.strict)
106
106
  if test_case.keyword == 'Scenario'
107
107
  output += @failing_step_source.keyword.to_s unless hook?(@failing_step_source)
108
- output += "#{@failing_step_source.name}\n"
108
+ output += "#{@failing_step_source}\n"
109
109
  else
110
110
  output += "Example row: #{row_name}\n"
111
111
  end
@@ -113,7 +113,7 @@ module Cucumber
113
113
  end
114
114
 
115
115
  def hook?(step)
116
- ['Before hook', 'After hook', 'AfterStep hook'].include? step.name
116
+ ['Before hook', 'After hook', 'AfterStep hook'].include? step.text
117
117
  end
118
118
 
119
119
  def build_testcase(result, scenario_designation, output)
@@ -123,7 +123,7 @@ module Cucumber
123
123
  name = scenario_designation
124
124
 
125
125
  @current_feature_data[:builder].testcase(:classname => classname, :name => name, :time => format('%.6f', duration)) do
126
- if !result.passed? && result.ok?(@config.strict?)
126
+ if !result.passed? && result.ok?(@config.strict)
127
127
  @current_feature_data[:builder].skipped
128
128
  @current_feature_data[:skipped] += 1
129
129
  elsif !result.passed?
@@ -15,12 +15,14 @@ module Cucumber
15
15
 
16
16
  def initialize(*)
17
17
  super
18
+ emit_deprecation_warning
19
+
18
20
  @matches = collect_matches
19
- config.on_event(:test_case_starting) do |event|
21
+ config.on_event(:test_case_started) do |event|
20
22
  formatter.before_test_case(event.test_case)
21
23
  printer.before_test_case(event.test_case)
22
24
  end
23
- config.on_event(:test_step_starting) do |event|
25
+ config.on_event(:test_step_started) do |event|
24
26
  formatter.before_test_step(event.test_step)
25
27
  printer.before_test_step(event.test_step)
26
28
  end
@@ -50,6 +52,20 @@ module Cucumber
50
52
 
51
53
  private
52
54
 
55
+ def emit_deprecation_warning
56
+ parent_name = formatter_class_name =~ /::[^:]+\Z/ ? $`.freeze : nil
57
+ return if parent_name == 'Cucumber::Formatter'
58
+ return if !config.out_stream # some unit tests don't set it
59
+ config.out_stream.puts "WARNING: The formatter #{formatter.class.name} is using the deprecated formatter API which will be removed in v4.0 of Cucumber."
60
+ config.out_stream.puts
61
+ end
62
+
63
+ def formatter_class_name
64
+ formatter.class.name
65
+ rescue NoMethodError # when we use the Fanout, things get gnarly
66
+ formatter.class[0].class.name
67
+ end
68
+
53
69
  def printer
54
70
  @printer ||= FeaturesPrinter.new(formatter, results, config, @matches).before
55
71
  end
@@ -185,7 +201,7 @@ module Cucumber
185
201
  class StepSource < OpenStruct
186
202
  def build_step_invocation(indent, matches, config, messages, embeddings)
187
203
  step_result.step_invocation(
188
- matches.fetch(step) { NoStepMatch.new(step, step.name) },
204
+ matches.fetch(step) { NoStepMatch.new(step, step.text) },
189
205
  step,
190
206
  indent,
191
207
  background,
@@ -330,7 +346,7 @@ module Cucumber
330
346
  elsif source.scenario
331
347
  ScenarioPrinter.new(formatter, source.scenario, before_hook_results)
332
348
  elsif source.scenario_outline
333
- if same_scenario_outline_as_previous_test_case?(source) and @previous_outline_child
349
+ if same_scenario_outline_as_previous_test_case?(source) && @previous_outline_child
334
350
  @previous_outline_child
335
351
  else
336
352
  ScenarioOutlinePrinter.new(formatter, config, source.scenario_outline)
@@ -388,19 +404,19 @@ module Cucumber
388
404
  @previous_outline_child.after unless same_scenario_outline_as_previous_test_case?(source)
389
405
  end
390
406
  end
391
- if from_scenario_outline_to_hidden_backgroud(@child, child)
407
+ if from_scenario_outline_to_hidden_background(@child, child)
392
408
  @previous_outline_child = @child
393
409
  else
394
410
  @child.after
395
411
  @previous_outline_child = nil
396
412
  end
397
413
  end
398
- child.before unless to_scenario_outline(child) and same_scenario_outline_as_previous_test_case?(source)
414
+ child.before unless to_scenario_outline(child) && same_scenario_outline_as_previous_test_case?(source)
399
415
  @child = child
400
416
  end
401
417
 
402
- def from_scenario_outline_to_hidden_backgroud(from, to)
403
- from.class.name == ScenarioOutlinePrinter.name and
418
+ def from_scenario_outline_to_hidden_background(from, to)
419
+ from.class.name == ScenarioOutlinePrinter.name &&
404
420
  to.class.name == HiddenBackgroundPrinter.name
405
421
  end
406
422
 
@@ -612,7 +628,7 @@ module Cucumber
612
628
 
613
629
  def after
614
630
  @child.after if @child
615
- # TODO - the last step result might not accurately reflect the
631
+ # TODO: the last step result might not accurately reflect the
616
632
  # overall scenario result.
617
633
  scenario_outline = last_step_result.scenario_outline(node.name, node.location)
618
634
  formatter.after_feature_element(scenario_outline)
@@ -641,7 +657,7 @@ module Cucumber
641
657
  end
642
658
 
643
659
  def outline_step(step)
644
- step_match = NoStepMatch.new(step, step.name)
660
+ step_match = NoStepMatch.new(step, step.text)
645
661
  step_invocation = LegacyResultBuilder.new(Core::Test::Result::Skipped.new).
646
662
  step_invocation(step_match, step, indent, nil, configuration, [], [])
647
663
  steps_printer.step_invocation step_invocation
@@ -914,11 +930,11 @@ module Cucumber
914
930
  def of(node)
915
931
  # The length of the instantiated steps in --expand mode are currently
916
932
  # not included in the calculation of max => make sure to return >= 1
917
- [1, max - node.name.length - node.keyword.length].max
933
+ [1, max - node.to_s.length - node.keyword.length].max
918
934
  end
919
935
 
920
936
  def record_width_of(node)
921
- @widths << node.keyword.length + node.name.length + 1
937
+ @widths << node.keyword.length + node.to_s.length + 1
922
938
  end
923
939
 
924
940
  private
@@ -989,8 +1005,8 @@ module Cucumber
989
1005
 
990
1006
  def step_exception(step, configuration)
991
1007
  return filtered_step_exception(step) if @exception
992
- return nil unless @status == :undefined && configuration.strict?
993
- @exception = Cucumber::Undefined.from(@result, step.name)
1008
+ return nil unless @status == :undefined && configuration.strict.strict?(:undefined)
1009
+ @exception = Cucumber::Undefined.from(@result, step.text)
994
1010
  @exception.backtrace << step.backtrace_line
995
1011
  filtered_step_exception(step)
996
1012
  end
@@ -103,7 +103,7 @@ module Cucumber
103
103
  :embeddings) do
104
104
  extend Forwardable
105
105
 
106
- def_delegators :step, :keyword, :name, :multiline_arg, :location
106
+ def_delegators :step, :keyword, :text, :multiline_arg, :location
107
107
 
108
108
  def accept(formatter)
109
109
  formatter.before_step(self)
@@ -119,7 +119,7 @@ module Cucumber
119
119
  end
120
120
 
121
121
  def step_result_attributes
122
- legacy_multiline_arg = if multiline_arg.kind_of?(Core::Ast::EmptyMultilineArgument)
122
+ legacy_multiline_arg = if multiline_arg.is_a?(Core::Ast::EmptyMultilineArgument)
123
123
  nil
124
124
  else
125
125
  step.multiline_arg
@@ -155,6 +155,10 @@ module Cucumber
155
155
  self
156
156
  end
157
157
 
158
+ def to_s
159
+ text
160
+ end
161
+
158
162
  private
159
163
 
160
164
  def source_indent
@@ -240,6 +244,10 @@ module Cucumber
240
244
  '| ' + cells.join(' | ') + ' |'
241
245
  end
242
246
 
247
+ def to_s
248
+ name
249
+ end
250
+
243
251
  def failed?
244
252
  status == :failed
245
253
  end
@@ -31,7 +31,7 @@ module Cucumber
31
31
  @counts = ConsoleCounts.new(config)
32
32
  @issues = ConsoleIssues.new(config)
33
33
  config.on_event :step_activated, &method(:on_step_activated)
34
- config.on_event :test_case_starting, &method(:on_test_case_starting)
34
+ config.on_event :test_case_started, &method(:on_test_case_started)
35
35
  config.on_event :test_step_finished, &method(:on_test_step_finished)
36
36
  config.on_event :test_case_finished, &method(:on_test_case_finished)
37
37
  config.on_event :test_run_finished, &method(:on_test_run_finished)
@@ -41,7 +41,7 @@ module Cucumber
41
41
  @matches[event.test_step.source] = event.step_match
42
42
  end
43
43
 
44
- def on_test_case_starting(_event)
44
+ def on_test_case_started(_event)
45
45
  unless @profile_information_printed
46
46
  do_print_profile_information(config.profiles) unless config.skip_profile_information? || config.profiles.nil? || config.profiles.empty?
47
47
  @profile_information_printed = true
@@ -12,7 +12,7 @@ module Cucumber
12
12
  @failures = {}
13
13
  config.on_event :test_case_finished do |event|
14
14
  test_case, result = *event.attributes
15
- next if result.ok?(@config.strict?)
15
+ next if result.ok?(@config.strict)
16
16
  @failures[test_case.location.file] ||= []
17
17
  @failures[test_case.location.file] << test_case.location.line
18
18
  end
@@ -19,7 +19,7 @@ module Cucumber
19
19
  @issues = ConsoleIssues.new(@config)
20
20
  @start_time = Time.now
21
21
 
22
- @config.on_event :test_case_starting do |event|
22
+ @config.on_event :test_case_started do |event|
23
23
  print_feature event.test_case
24
24
  print_test_case event.test_case
25
25
  end
@@ -86,40 +86,26 @@ module Cucumber
86
86
  Dsl.register_rb_hook('after_step', tag_expressions, proc)
87
87
  end
88
88
 
89
- # Registers a proc that will be called with a step definition argument if it
90
- # matches the pattern passed as the first argument to Transform. Alternatively, if
91
- # the pattern contains captures then they will be yielded as arguments to the
92
- # provided proc. The return value of the proc is consequently yielded to the
93
- # step definition.
94
- def Transform(regexp, &proc)
95
- Cucumber.deprecate(
96
- 'Use ParameterType(...) instead',
97
- 'Transform',
98
- '2.6.0'
99
- )
100
- parameter_type = CucumberExpressions::ParameterType.new(
101
- regexp.to_s,
102
- regexp,
103
- Object,
104
- proc,
105
- false,
106
- true
107
- )
108
- Dsl.define_parameter_type(parameter_type)
109
- end
110
-
111
89
  def ParameterType(options)
90
+ type = options[:type] || Object
91
+ use_for_snippets = if_nil(options[:use_for_snippets], true)
92
+ prefer_for_regexp_match = if_nil(options[:prefer_for_regexp_match], false)
93
+
112
94
  parameter_type = CucumberExpressions::ParameterType.new(
113
95
  options[:name],
114
96
  options[:regexp],
115
- options[:type],
97
+ type,
116
98
  options[:transformer],
117
- options[:use_for_snippets],
118
- options[:prefer_for_regexp_match]
99
+ use_for_snippets,
100
+ prefer_for_regexp_match
119
101
  )
120
102
  Dsl.define_parameter_type(parameter_type)
121
103
  end
122
104
 
105
+ def if_nil(value, default)
106
+ value.nil? ? default : value
107
+ end
108
+
123
109
  # Registers a proc that will run after Cucumber is configured. You can register as
124
110
  # as you want (typically from ruby scripts under <tt>support/hooks.rb</tt>).
125
111
  def AfterConfiguration(&proc)