cucumber 3.0.0.pre.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +2 -2
  7. data/{History.md → CHANGELOG.md} +69 -13
  8. data/appveyor.yml +2 -1
  9. data/bin/cucumber +2 -1
  10. data/cucumber.gemspec +1 -1
  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 +1 -23
  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 +7 -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
@@ -80,7 +80,7 @@ module Autotest::CucumberMixin
80
80
  begin
81
81
  open("| #{cmd}", 'r') do |f|
82
82
  until f.eof?
83
- c = f.getc or break
83
+ c = f.getc || break
84
84
  if RUBY_VERSION >= '1.9' then
85
85
  print c
86
86
  else
@@ -26,7 +26,7 @@ module Cucumber
26
26
  @args = args
27
27
  @options.parse!(args)
28
28
  arrange_formats
29
- raise("You can't use both --strict and --wip") if strict? && wip?
29
+ raise("You can't use both --strict and --wip") if strict.strict? && wip?
30
30
  set_environment_variables
31
31
  end
32
32
 
@@ -42,7 +42,7 @@ module Cucumber
42
42
  Integer(@options[:seed] || rand(0xFFFF))
43
43
  end
44
44
 
45
- def strict?
45
+ def strict
46
46
  @options[:strict]
47
47
  end
48
48
 
@@ -3,6 +3,7 @@ require 'cucumber/cli/profile_loader'
3
3
  require 'cucumber/formatter/ansicolor'
4
4
  require 'cucumber/glue/registry_and_more'
5
5
  require 'cucumber/project_initializer'
6
+ require 'cucumber/core/test/result'
6
7
 
7
8
  module Cucumber
8
9
  module Cli
@@ -24,20 +25,21 @@ module Cucumber
24
25
  'junit' => ['Cucumber::Formatter::Junit', 'Generates a report similar to Ant+JUnit.'],
25
26
  'json' => ['Cucumber::Formatter::Json', 'Prints the feature as JSON'],
26
27
  'json_pretty' => ['Cucumber::Formatter::JsonPretty', 'Prints the feature as prettified JSON'],
27
- 'summary' => ['Cucumber::Formatter::Summary', 'Summary output of feature and scenarios']
28
+ 'summary' => ['Cucumber::Formatter::Summary', 'Summary output of feature and scenarios']
28
29
  }
29
30
  max = BUILTIN_FORMATS.keys.map{|s| s.length}.max
30
- FORMAT_HELP_MSG = ['Use --format rerun --out rerun.txt to write out failing',
31
- 'features. You can rerun them with cucumber @rerun.txt.',
32
- 'FORMAT can also be the fully qualified class name of',
33
- "your own custom formatter. If the class isn't loaded,",
34
- 'Cucumber will attempt to require a file with a relative',
35
- 'file name that is the underscore name of the class name.',
36
- 'Example: --format Foo::BarZap -> Cucumber will look for',
37
- 'foo/bar_zap.rb. You can place the file with this relative',
38
- 'path underneath your features/support directory or anywhere',
39
- "on Ruby's LOAD_PATH, for example in a Ruby gem."
40
- ]
31
+ FORMAT_HELP_MSG = [
32
+ 'Use --format rerun --out rerun.txt to write out failing',
33
+ 'features. You can rerun them with cucumber @rerun.txt.',
34
+ 'FORMAT can also be the fully qualified class name of',
35
+ "your own custom formatter. If the class isn't loaded,",
36
+ 'Cucumber will attempt to require a file with a relative',
37
+ 'file name that is the underscore name of the class name.',
38
+ 'Example: --format Foo::BarZap -> Cucumber will look for',
39
+ 'foo/bar_zap.rb. You can place the file with this relative',
40
+ 'path underneath your features/support directory or anywhere',
41
+ "on Ruby's LOAD_PATH, for example in a Ruby gem."
42
+ ]
41
43
 
42
44
  FORMAT_HELP = (BUILTIN_FORMATS.keys.sort.map do |key|
43
45
  " #{key}#{' ' * (max - key.length)} : #{BUILTIN_FORMATS[key][1]}"
@@ -48,11 +50,12 @@ module Cucumber
48
50
  NO_PROFILE_LONG_FLAG = '--no-profile'
49
51
  FAIL_FAST_FLAG = '--fail-fast'
50
52
  RETRY_FLAG = '--retry'
51
- OPTIONS_WITH_ARGS = ['-r', '--require', '--i18n-keywords', '-f', '--format', '-o', '--out',
52
- '-t', '--tags', '-n', '--name', '-e', '--exclude',
53
- PROFILE_SHORT_FLAG, PROFILE_LONG_FLAG, RETRY_FLAG,
54
- '-l', '--lines', '--port',
55
- '-I', '--snippet-type']
53
+ OPTIONS_WITH_ARGS = [
54
+ '-r', '--require', '--i18n-keywords', '-f', '--format', '-o',
55
+ '--out', '-t', '--tags', '-n', '--name', '-e', '--exclude',
56
+ PROFILE_SHORT_FLAG, PROFILE_LONG_FLAG, RETRY_FLAG, '-l',
57
+ '--lines', '--port', '-I', '--snippet-type'
58
+ ]
56
59
  ORDER_TYPES = %w{defined random}
57
60
  TAG_LIMIT_MATCHER = /(?<tag_name>\@\w+):(?<limit>\d+)/x
58
61
 
@@ -119,7 +122,10 @@ module Cucumber
119
122
  opts.on('-q', '--quiet', 'Alias for --no-snippets --no-source.') { shut_up }
120
123
  opts.on('--no-duration', "Don't print the duration at the end of the summary") { set_option :duration, false }
121
124
  opts.on('-b', '--backtrace', 'Show full backtrace for all errors.') { Cucumber.use_full_backtrace = true }
122
- opts.on('-S', '--strict', 'Fail if there are any undefined or pending steps.') { set_option :strict }
125
+ opts.on('-S', '--[no-]strict', *strict_msg) { |setting| set_strict(setting) }
126
+ opts.on('--[no-]strict-undefined', 'Fail if there are any undefined results.') { |setting| set_strict(setting, :undefined) }
127
+ opts.on('--[no-]strict-pending', 'Fail if there are any pending results.') { |setting| set_strict(setting, :pending) }
128
+ opts.on('--[no-]strict-flaky', 'Fail if there are any flaky results.') { |setting| set_strict(setting, :flaky) }
123
129
  opts.on('-w', '--wip', 'Fail if there are any passing scenarios.') { set_option :wip }
124
130
  opts.on('-v', '--verbose', 'Show the files and features loaded.') { set_option :verbose }
125
131
  opts.on('-g', '--guess', 'Guess best match for Ambiguous steps.') { set_option :guess }
@@ -254,6 +260,13 @@ TEXT
254
260
  ]
255
261
  end
256
262
 
263
+ def strict_msg
264
+ [
265
+ 'Fail if there are any strict affected results ',
266
+ '(that is undefined, pending or flaky results).'
267
+ ]
268
+ end
269
+
257
270
  def parse_formats(v)
258
271
  formatter, *formatter_options = v.split(',')
259
272
  options_hash = Hash[formatter_options.map { |s| s.split('=') }]
@@ -318,12 +331,13 @@ TEXT
318
331
  end
319
332
 
320
333
  def banner
321
- ['Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+', '',
322
- 'Examples:',
323
- 'cucumber examples/i18n/en/features',
324
- 'cucumber @rerun.txt (See --format rerun)',
325
- 'cucumber examples/i18n/it/features/somma.feature:6:98:113',
326
- 'cucumber -s -i http://rubyurl.com/eeCl', '', ''
334
+ [
335
+ 'Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+', '',
336
+ 'Examples:',
337
+ 'cucumber examples/i18n/en/features',
338
+ 'cucumber @rerun.txt (See --format rerun)',
339
+ 'cucumber examples/i18n/it/features/somma.feature:6:98:113',
340
+ 'cucumber -s -i http://rubyurl.com/eeCl', '', ''
327
341
  ].join("\n")
328
342
  end
329
343
 
@@ -409,6 +423,10 @@ TEXT
409
423
  @options[:duration] = false
410
424
  end
411
425
 
426
+ def set_strict(setting, type = nil)
427
+ @options[:strict].set_strict(setting, type)
428
+ end
429
+
412
430
  def stdout_formats
413
431
  @options[:formats].select { |_, _, output| output == @out_stream }
414
432
  end
@@ -477,7 +495,7 @@ TEXT
477
495
  @options[:source] &= other_options[:source]
478
496
  @options[:snippets] &= other_options[:snippets]
479
497
  @options[:duration] &= other_options[:duration]
480
- @options[:strict] |= other_options[:strict]
498
+ @options[:strict] = other_options[:strict].merge!(@options[:strict])
481
499
  @options[:dry_run] |= other_options[:dry_run]
482
500
 
483
501
  @profiles += other_options.profiles
@@ -506,21 +524,24 @@ TEXT
506
524
  require 'gherkin/dialect'
507
525
  language = ::Gherkin::Dialect.for(lang)
508
526
  data = Cucumber::MultilineArgument::DataTable.from(
509
- [['feature', to_keywords_string(language.feature_keywords)],
510
- ['background', to_keywords_string(language.background_keywords)],
511
- ['scenario', to_keywords_string(language.scenario_keywords)],
512
- ['scenario_outline', to_keywords_string(language.scenario_outline_keywords)],
513
- ['examples', to_keywords_string(language.examples_keywords)],
514
- ['given', to_keywords_string(language.given_keywords)],
515
- ['when', to_keywords_string(language.when_keywords)],
516
- ['then', to_keywords_string(language.then_keywords)],
517
- ['and', to_keywords_string(language.and_keywords)],
518
- ['but', to_keywords_string(language.but_keywords)],
519
- ['given (code)', to_code_keywords_string(language.given_keywords)],
520
- ['when (code)', to_code_keywords_string(language.when_keywords)],
521
- ['then (code)', to_code_keywords_string(language.then_keywords)],
522
- ['and (code)', to_code_keywords_string(language.and_keywords)],
523
- ['but (code)', to_code_keywords_string(language.but_keywords)]])
527
+ [
528
+ ['feature', to_keywords_string(language.feature_keywords)],
529
+ ['background', to_keywords_string(language.background_keywords)],
530
+ ['scenario', to_keywords_string(language.scenario_keywords)],
531
+ ['scenario_outline', to_keywords_string(language.scenario_outline_keywords)],
532
+ ['examples', to_keywords_string(language.examples_keywords)],
533
+ ['given', to_keywords_string(language.given_keywords)],
534
+ ['when', to_keywords_string(language.when_keywords)],
535
+ ['then', to_keywords_string(language.then_keywords)],
536
+ ['and', to_keywords_string(language.and_keywords)],
537
+ ['but', to_keywords_string(language.but_keywords)],
538
+ ['given (code)', to_code_keywords_string(language.given_keywords)],
539
+ ['when (code)', to_code_keywords_string(language.when_keywords)],
540
+ ['then (code)', to_code_keywords_string(language.then_keywords)],
541
+ ['and (code)', to_code_keywords_string(language.and_keywords)],
542
+ ['but (code)', to_code_keywords_string(language.but_keywords)]
543
+ ]
544
+ )
524
545
  @out_stream.write(data.to_s({ color: false, prefixes: Hash.new('') }))
525
546
  Kernel.exit(0)
526
547
  end
@@ -545,7 +566,7 @@ TEXT
545
566
 
546
567
  def default_options
547
568
  {
548
- :strict => false,
569
+ :strict => Cucumber::Core::Test::Result::StrictConfiguration.new,
549
570
  :require => [],
550
571
  :dry_run => false,
551
572
  :formats => [],
@@ -72,7 +72,7 @@ Defined profiles in cucumber.yml:
72
72
  end
73
73
 
74
74
  begin
75
- @cucumber_yml = YAML::load(@cucumber_erb)
75
+ @cucumber_yml = YAML.load(@cucumber_erb)
76
76
  rescue StandardError
77
77
  raise(YmlLoadError,"cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.\n")
78
78
  end
@@ -3,6 +3,7 @@ require 'cucumber/constantize'
3
3
  require 'cucumber/cli/rerun_file'
4
4
  require 'cucumber/events'
5
5
  require 'cucumber/core/event_bus'
6
+ require 'cucumber/core/test/result'
6
7
  require 'forwardable'
7
8
  require 'cucumber'
8
9
 
@@ -71,7 +72,7 @@ module Cucumber
71
72
  @options[:guess]
72
73
  end
73
74
 
74
- def strict?
75
+ def strict
75
76
  @options[:strict]
76
77
  end
77
78
 
@@ -243,7 +244,7 @@ module Cucumber
243
244
  {
244
245
  :autoload_code_paths => ['features/support', 'features/step_definitions'],
245
246
  :filters => [],
246
- :strict => false,
247
+ :strict => Cucumber::Core::Test::Result::StrictConfiguration.new,
247
248
  :require => [],
248
249
  :dry_run => false,
249
250
  :fail_fast => false,
@@ -20,11 +20,11 @@ module Cucumber
20
20
  end
21
21
  end
22
22
 
23
- Strategy = $0.match(/rspec$/) ? ForDevelopers : ForUsers
23
+ STRATEGY = $0.match(/rspec$/) ? ForDevelopers : ForUsers
24
24
  end
25
25
 
26
26
  def self.deprecate(*args)
27
- Deprecate::Strategy.call(*args)
27
+ Deprecate::STRATEGY.call(*args)
28
28
  end
29
29
 
30
30
  end
@@ -24,15 +24,15 @@ module Cucumber
24
24
 
25
25
  def self.registry
26
26
  Core::Events.build_registry(
27
- TestCaseStarting,
27
+ TestCaseStarted,
28
28
  TestCaseFinished,
29
29
  TestStepFinished,
30
- TestStepStarting,
30
+ TestStepStarted,
31
31
  StepDefinitionRegistered,
32
32
  StepActivated,
33
33
  TestRunFinished,
34
34
  GherkinSourceRead,
35
- TestRunStarting
35
+ TestRunStarted
36
36
  )
37
37
  end
38
38
  end
@@ -9,7 +9,7 @@ module Cucumber
9
9
  # @return [Cucumber::Core::Test::Case] that was executed
10
10
  attr_reader :test_case
11
11
 
12
- # @return [Cucumber::Core::Test::Result] the result of running the {Cucumber::Core::Test::Step}
12
+ # @return [Cucumber::Core::Test::Result] the result of running the {Cucumber::Core::Test::Case}
13
13
  attr_reader :result
14
14
 
15
15
  end
@@ -4,7 +4,7 @@ module Cucumber
4
4
  module Events
5
5
 
6
6
  # Signals that a {Cucumber::Core::Test::Case} is about to be executed
7
- class TestCaseStarting < Core::Events::TestCaseStarting
7
+ class TestCaseStarted < Core::Events::TestCaseStarted
8
8
 
9
9
  # @return [Cucumber::Core::Test::Case] the test case to be executed
10
10
  attr_reader :test_case
@@ -6,7 +6,7 @@ module Cucumber
6
6
 
7
7
  # Event fired once all test cases have been filtered before
8
8
  # the first one is executed.
9
- class TestRunStarting < Core::Event.new(:test_cases)
9
+ class TestRunStarted < Core::Event.new(:test_cases)
10
10
 
11
11
  # @return [Array<Cucumber::Core::Test::Case>] the test cases to be executed
12
12
  attr_reader :test_cases
@@ -4,7 +4,7 @@ module Cucumber
4
4
  module Events
5
5
 
6
6
  # Signals that a {Cucumber::Core::Test::Step} is about to be executed
7
- class TestStepStarting < Core::Events::TestStepStarting
7
+ class TestStepStarted < Core::Events::TestStepStarted
8
8
 
9
9
  # @return [Cucumber::Core::Test::Step] the test step to be executed
10
10
  attr_reader :test_step
@@ -4,7 +4,7 @@ require 'cucumber/filters/apply_after_step_hooks'
4
4
  require 'cucumber/filters/apply_before_hooks'
5
5
  require 'cucumber/filters/apply_after_hooks'
6
6
  require 'cucumber/filters/apply_around_hooks'
7
- require 'cucumber/filters/broadcast_test_run_starting_event'
7
+ require 'cucumber/filters/broadcast_test_run_started_event'
8
8
  require 'cucumber/filters/prepare_world'
9
9
  require 'cucumber/filters/quit'
10
10
  require 'cucumber/filters/randomizer'
@@ -43,7 +43,11 @@ module Cucumber
43
43
  end
44
44
 
45
45
  def result
46
- return NoStepMatch.new(test_step.source.last, test_step.name) unless matches.any?
46
+ begin
47
+ return NoStepMatch.new(test_step.source.last, test_step.text) unless matches.any?
48
+ rescue Cucumber::Ambiguous => e
49
+ return AmbiguousStepMatch.new(e)
50
+ end
47
51
  configuration.notify :step_activated, test_step, match
48
52
  return SkippingStepMatch.new if configuration.dry_run?
49
53
  match
@@ -59,7 +63,7 @@ module Cucumber
59
63
  end
60
64
 
61
65
  def matches
62
- step_match_search.call(test_step.name)
66
+ step_match_search.call(test_step.text)
63
67
  end
64
68
  end
65
69
  end
@@ -3,7 +3,7 @@ module Cucumber
3
3
  module Filters
4
4
  # Added at the end of the filter chain to broadcast a list of
5
5
  # all of the test cases that have made it through the filters.
6
- class BroadcastTestRunStartingEvent < Core::Filter.new(:config)
6
+ class BroadcastTestRunStartedEvent < Core::Filter.new(:config)
7
7
  def initialize(config, receiver=nil)
8
8
  super
9
9
  @test_cases = []
@@ -15,7 +15,7 @@ module Cucumber
15
15
  end
16
16
 
17
17
  def done
18
- config.notify :test_run_starting, @test_cases
18
+ config.notify :test_run_started, @test_cases
19
19
  @test_cases.map do |test_case|
20
20
  test_case.describe_to(@receiver)
21
21
  end
@@ -135,7 +135,7 @@ module Cucumber
135
135
 
136
136
  def do_print_snippets(snippet_text_proc)
137
137
  snippets = @snippets_input.map do |data|
138
- snippet_text_proc.call(data.actual_keyword, data.step.name, data.step.multiline_arg)
138
+ snippet_text_proc.call(data.actual_keyword, data.step.text, data.step.multiline_arg)
139
139
  end.uniq
140
140
 
141
141
  text = "\nYou can implement step definitions for undefined steps with these snippets:\n\n"
@@ -12,9 +12,9 @@ module Cucumber
12
12
  @config.on_event(:test_case_finished) do |event|
13
13
  if event.test_case != @previous_test_case
14
14
  @previous_test_case = event.test_case
15
- @issues[event.result.to_sym] << event.test_case unless event.result.ok?(@config.strict?)
15
+ @issues[event.result.to_sym] << event.test_case unless event.result.ok?(@config.strict)
16
16
  elsif event.result.passed?
17
- @issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?(@config.strict?)
17
+ @issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?(@config.strict)
18
18
  @issues[:failed].delete(event.test_case)
19
19
  end
20
20
  end
@@ -10,7 +10,7 @@ module Cucumber
10
10
  def initialize(configuration)
11
11
  configuration.on_event :test_case_finished do |event|
12
12
  _test_case, result = *event.attributes
13
- Cucumber.wants_to_quit = true unless result.ok?(configuration.strict?)
13
+ Cucumber.wants_to_quit = true unless result.ok?(configuration.strict)
14
14
  end
15
15
  end
16
16
 
@@ -42,15 +42,14 @@ module Cucumber
42
42
  def embed(src, mime_type, label)
43
43
  if image?(mime_type)
44
44
  src = src_is_file_or_data?(src) ? src : "data:#{standardize_mime_type(mime_type)},#{src}"
45
-
46
- builder.embed_image(src: set_path(src), label: label, id: next_id(:img))
45
+ builder.embed(type: :image, src: set_path(src), label: label, id: next_id(:img))
47
46
  else
48
- builder.embed_text(src: src, label: label, id: next_id(:text))
47
+ builder.embed(type: :text, src: src, label: label, id: next_id(:text))
49
48
  end
50
49
  end
51
50
 
52
51
  def set_path(src)
53
- if @io.respond_to?(:path) and File.file?(src)
52
+ if @io.respond_to?(:path) && File.file?(src)
54
53
  out_dir = Pathname.new(File.dirname(File.absolute_path(@io.path)))
55
54
  src = Pathname.new(File.absolute_path(src)).relative_path_from(out_dir)
56
55
  end
@@ -63,7 +62,7 @@ module Cucumber
63
62
  end
64
63
 
65
64
  def src_is_file_or_data?(src)
66
- File.file?(src) or src =~ /^data:image\/(png|gif|jpg|jpeg);base64,/
65
+ File.file?(src) || src =~ /^data:image\/(png|gif|jpg|jpeg);base64,/
67
66
  end
68
67
 
69
68
  def image?(mime_type)
@@ -222,7 +221,7 @@ module Cucumber
222
221
 
223
222
  def after_steps(_steps)
224
223
  print_messages
225
- builder << '</ol>' if @in_background or @in_scenario_outline
224
+ builder << '</ol>' if @in_background || @in_scenario_outline
226
225
  end
227
226
 
228
227
  def before_step(step)
@@ -366,7 +365,7 @@ module Cucumber
366
365
  def print_messages
367
366
  return if @delayed_messages.empty?
368
367
 
369
- #builder.ol do
368
+ #builder.ol do
370
369
  @delayed_messages.each do |ann|
371
370
  builder.li(:class => 'step message') do
372
371
  builder << ann
@@ -390,7 +389,7 @@ module Cucumber
390
389
  end
391
390
 
392
391
  def after_test_case(_test_case, result)
393
- if result.failed? and not @scenario_red
392
+ if result.failed? && !@scenario_red
394
393
  set_scenario_color_failed
395
394
  end
396
395
  end
@@ -438,7 +437,7 @@ module Cucumber
438
437
  end
439
438
 
440
439
  def set_scenario_color(status)
441
- if status.nil? or status == :undefined or status == :pending
440
+ if status.nil? || status == :undefined || status == :pending
442
441
  set_scenario_color_pending
443
442
  end
444
443
  if status == :failed
@@ -453,7 +452,7 @@ module Cucumber
453
452
  scenario_or_background = @in_background ? 'background' : 'scenario'
454
453
  builder.text!("makeRed('#{scenario_or_background}_#{@scenario_number}');") unless @scenario_red
455
454
  @scenario_red = true
456
- if @options[:expand] and @inside_outline
455
+ if @options[:expand] && @inside_outline
457
456
  builder.text!("makeRed('#{scenario_or_background}_#{@scenario_number}_#{@outline_row}');")
458
457
  end
459
458
  end