cucumber 3.0.2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +216 -17
  3. data/CONTRIBUTING.md +4 -21
  4. data/README.md +8 -10
  5. data/bin/cucumber +1 -1
  6. data/lib/autotest/cucumber.rb +1 -0
  7. data/lib/autotest/cucumber_mixin.rb +35 -39
  8. data/lib/autotest/cucumber_rails.rb +1 -0
  9. data/lib/autotest/cucumber_rails_rspec.rb +1 -0
  10. data/lib/autotest/cucumber_rails_rspec2.rb +1 -0
  11. data/lib/autotest/cucumber_rspec.rb +1 -0
  12. data/lib/autotest/cucumber_rspec2.rb +1 -0
  13. data/lib/autotest/discover.rb +1 -0
  14. data/lib/cucumber.rb +2 -1
  15. data/lib/cucumber/cli/configuration.rb +6 -5
  16. data/lib/cucumber/cli/main.rb +14 -14
  17. data/lib/cucumber/cli/options.rb +113 -116
  18. data/lib/cucumber/cli/profile_loader.rb +50 -29
  19. data/lib/cucumber/cli/rerun_file.rb +1 -0
  20. data/lib/cucumber/configuration.rb +38 -29
  21. data/lib/cucumber/constantize.rb +8 -10
  22. data/lib/cucumber/core_ext/string.rb +1 -0
  23. data/lib/cucumber/deprecate.rb +32 -8
  24. data/lib/cucumber/encoding.rb +2 -1
  25. data/lib/cucumber/errors.rb +6 -7
  26. data/lib/cucumber/events.rb +14 -7
  27. data/lib/cucumber/events/envelope.rb +9 -0
  28. data/lib/cucumber/events/gherkin_source_parsed.rb +11 -0
  29. data/lib/cucumber/events/gherkin_source_read.rb +1 -4
  30. data/lib/cucumber/events/hook_test_step_created.rb +13 -0
  31. data/lib/cucumber/events/step_activated.rb +6 -6
  32. data/lib/cucumber/events/step_definition_registered.rb +4 -8
  33. data/lib/cucumber/events/test_case_created.rb +13 -0
  34. data/lib/cucumber/events/test_case_finished.rb +0 -4
  35. data/lib/cucumber/events/test_case_ready.rb +12 -0
  36. data/lib/cucumber/events/test_case_started.rb +0 -4
  37. data/lib/cucumber/events/test_run_finished.rb +2 -3
  38. data/lib/cucumber/events/test_run_started.rb +2 -4
  39. data/lib/cucumber/events/test_step_created.rb +13 -0
  40. data/lib/cucumber/events/test_step_finished.rb +0 -4
  41. data/lib/cucumber/events/test_step_started.rb +1 -5
  42. data/lib/cucumber/events/undefined_parameter_type.rb +10 -0
  43. data/lib/cucumber/file_specs.rb +7 -6
  44. data/lib/cucumber/filters.rb +2 -0
  45. data/lib/cucumber/filters/activate_steps.rb +6 -4
  46. data/lib/cucumber/filters/apply_after_hooks.rb +1 -0
  47. data/lib/cucumber/filters/apply_after_step_hooks.rb +1 -0
  48. data/lib/cucumber/filters/apply_around_hooks.rb +1 -0
  49. data/lib/cucumber/filters/apply_before_hooks.rb +1 -0
  50. data/lib/cucumber/filters/broadcast_test_case_ready_event.rb +12 -0
  51. data/lib/cucumber/filters/broadcast_test_run_started_event.rb +2 -1
  52. data/lib/cucumber/filters/gated_receiver.rb +1 -2
  53. data/lib/cucumber/filters/prepare_world.rb +6 -13
  54. data/lib/cucumber/filters/quit.rb +3 -6
  55. data/lib/cucumber/filters/randomizer.rb +6 -7
  56. data/lib/cucumber/filters/retry.rb +2 -2
  57. data/lib/cucumber/filters/tag_limits.rb +2 -2
  58. data/lib/cucumber/filters/tag_limits/test_case_index.rb +1 -2
  59. data/lib/cucumber/filters/tag_limits/verifier.rb +3 -6
  60. data/lib/cucumber/formatter/ansicolor.rb +33 -37
  61. data/lib/cucumber/formatter/ast_lookup.rb +165 -0
  62. data/lib/cucumber/formatter/backtrace_filter.rb +10 -10
  63. data/lib/cucumber/formatter/console.rb +65 -74
  64. data/lib/cucumber/formatter/console_counts.rb +4 -9
  65. data/lib/cucumber/formatter/console_issues.rb +9 -6
  66. data/lib/cucumber/formatter/duration.rb +2 -1
  67. data/lib/cucumber/formatter/duration_extractor.rb +4 -2
  68. data/lib/cucumber/formatter/errors.rb +6 -0
  69. data/lib/cucumber/formatter/fail_fast.rb +9 -6
  70. data/lib/cucumber/formatter/fanout.rb +3 -3
  71. data/lib/cucumber/formatter/html.rb +11 -602
  72. data/lib/cucumber/formatter/http_io.rb +146 -0
  73. data/lib/cucumber/formatter/ignore_missing_messages.rb +2 -3
  74. data/lib/cucumber/formatter/interceptor.rb +11 -18
  75. data/lib/cucumber/formatter/io.rb +18 -11
  76. data/lib/cucumber/formatter/json.rb +102 -109
  77. data/lib/cucumber/formatter/junit.rb +73 -68
  78. data/lib/cucumber/formatter/message.rb +22 -0
  79. data/lib/cucumber/formatter/message_builder.rb +255 -0
  80. data/lib/cucumber/formatter/pretty.rb +360 -153
  81. data/lib/cucumber/formatter/progress.rb +31 -32
  82. data/lib/cucumber/formatter/query/hook_by_test_step.rb +31 -0
  83. data/lib/cucumber/formatter/query/pickle_by_test.rb +26 -0
  84. data/lib/cucumber/formatter/query/pickle_step_by_test_step.rb +26 -0
  85. data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +40 -0
  86. data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +40 -0
  87. data/lib/cucumber/formatter/rerun.rb +23 -4
  88. data/lib/cucumber/formatter/stepdefs.rb +2 -2
  89. data/lib/cucumber/formatter/steps.rb +4 -5
  90. data/lib/cucumber/formatter/summary.rb +17 -9
  91. data/lib/cucumber/formatter/unicode.rb +16 -18
  92. data/lib/cucumber/formatter/usage.rb +30 -26
  93. data/lib/cucumber/gherkin/data_table_parser.rb +18 -6
  94. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +83 -86
  95. data/lib/cucumber/gherkin/formatter/escaping.rb +13 -12
  96. data/lib/cucumber/gherkin/i18n.rb +1 -0
  97. data/lib/cucumber/gherkin/steps_parser.rb +18 -8
  98. data/lib/cucumber/glue/dsl.rb +2 -1
  99. data/lib/cucumber/glue/hook.rb +35 -11
  100. data/lib/cucumber/glue/invoke_in_world.rb +15 -20
  101. data/lib/cucumber/glue/proto_world.rb +47 -39
  102. data/lib/cucumber/glue/registry_and_more.rb +54 -23
  103. data/lib/cucumber/glue/snippet.rb +24 -27
  104. data/lib/cucumber/glue/step_definition.rb +51 -28
  105. data/lib/cucumber/glue/world_factory.rb +1 -3
  106. data/lib/cucumber/hooks.rb +24 -14
  107. data/lib/cucumber/load_path.rb +1 -0
  108. data/lib/cucumber/multiline_argument.rb +6 -8
  109. data/lib/cucumber/multiline_argument/data_table.rb +106 -73
  110. data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +8 -11
  111. data/lib/cucumber/multiline_argument/doc_string.rb +2 -1
  112. data/lib/cucumber/platform.rb +4 -3
  113. data/lib/cucumber/project_initializer.rb +1 -1
  114. data/lib/cucumber/rake/task.rb +21 -18
  115. data/lib/cucumber/rspec/disable_option_parser.rb +10 -8
  116. data/lib/cucumber/rspec/doubles.rb +1 -0
  117. data/lib/cucumber/running_test_case.rb +4 -54
  118. data/lib/cucumber/runtime.rb +57 -61
  119. data/lib/cucumber/runtime/after_hooks.rb +9 -4
  120. data/lib/cucumber/runtime/before_hooks.rb +9 -4
  121. data/lib/cucumber/runtime/for_programming_languages.rb +12 -9
  122. data/lib/cucumber/runtime/step_hooks.rb +5 -2
  123. data/lib/cucumber/runtime/support_code.rb +16 -22
  124. data/lib/cucumber/runtime/user_interface.rb +8 -19
  125. data/lib/cucumber/step_definition_light.rb +6 -4
  126. data/lib/cucumber/step_definitions.rb +3 -2
  127. data/lib/cucumber/step_match.rb +20 -18
  128. data/lib/cucumber/step_match_search.rb +9 -9
  129. data/lib/cucumber/term/ansicolor.rb +39 -39
  130. data/lib/cucumber/unit.rb +1 -0
  131. data/lib/cucumber/version +1 -1
  132. data/lib/simplecov_setup.rb +1 -0
  133. metadata +214 -127
  134. data/lib/cucumber/formatter/cucumber.css +0 -286
  135. data/lib/cucumber/formatter/cucumber.sass +0 -247
  136. data/lib/cucumber/formatter/hook_query_visitor.rb +0 -41
  137. data/lib/cucumber/formatter/html_builder.rb +0 -120
  138. data/lib/cucumber/formatter/inline-js.js +0 -30
  139. data/lib/cucumber/formatter/jquery-min.js +0 -154
  140. data/lib/cucumber/formatter/json_pretty.rb +0 -10
  141. data/lib/cucumber/formatter/legacy_api/adapter.rb +0 -1028
  142. data/lib/cucumber/formatter/legacy_api/ast.rb +0 -394
  143. data/lib/cucumber/formatter/legacy_api/results.rb +0 -50
  144. data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +0 -32
  145. data/lib/cucumber/step_argument.rb +0 -24
@@ -0,0 +1,9 @@
1
+ require 'cucumber/core/events'
2
+
3
+ module Cucumber
4
+ module Events
5
+ class Envelope < Core::Event.new(:envelope)
6
+ attr_reader :envelope
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ require 'cucumber/core/events'
2
+
3
+ module Cucumber
4
+ module Events
5
+ # Fired after we've parsed the contents of a feature file
6
+ class GherkinSourceParsed < Core::Event.new(:gherkin_document)
7
+ # The Gherkin Ast
8
+ attr_reader :gherkin_document
9
+ end
10
+ end
11
+ end
@@ -2,16 +2,13 @@ require 'cucumber/core/events'
2
2
 
3
3
  module Cucumber
4
4
  module Events
5
-
6
- # Fired after we've read in the contents of a feature file
5
+ # Fired after we've read in the contents of a feature file
7
6
  class GherkinSourceRead < Core::Event.new(:path, :body)
8
-
9
7
  # The path to the file
10
8
  attr_reader :path
11
9
 
12
10
  # The raw Gherkin source
13
11
  attr_reader :body
14
12
  end
15
-
16
13
  end
17
14
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/core/events'
4
+
5
+ module Cucumber
6
+ module Events
7
+ # Event fired when a step is created from a hook
8
+ class HookTestStepCreated < Core::Event.new(:test_step, :hook)
9
+ attr_reader :test_step
10
+ attr_reader :hook
11
+ end
12
+ end
13
+ end
@@ -1,25 +1,25 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber/core/events'
3
4
 
4
5
  module Cucumber
5
6
  module Events
6
-
7
7
  # Event fired when a step is activated
8
8
  class StepActivated < Core::Event.new(:test_step, :step_match)
9
-
10
- # The test step that was matched.
9
+ # The test step that was matched.
11
10
  #
12
11
  # @return [Cucumber::Core::Test::Step]
13
12
  attr_reader :test_step
14
13
 
15
- # Information about the matching definition.
14
+ # Information about the matching definition.
16
15
  #
17
16
  # @return [Cucumber::StepMatch]
18
17
  attr_reader :step_match
19
18
 
20
- # @private
19
+ # @private
21
20
  def initialize(test_step, step_match)
22
- @test_step, @step_match = test_step, step_match
21
+ @test_step = test_step
22
+ @step_match = step_match
23
23
  end
24
24
  end
25
25
  end
@@ -1,24 +1,20 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber/core/events'
3
4
 
4
5
  module Cucumber
5
6
  module Events
6
-
7
- # Event fired after each step definition has been registered
7
+ # Event fired after each step definition has been registered
8
8
  class StepDefinitionRegistered < Core::Event.new(:step_definition)
9
-
10
-
11
- #_The step definition that was just registered.
9
+ # The step definition that was just registered.
12
10
  #
13
11
  # @return [RbSupport::RbStepDefinition]
14
12
  attr_reader :step_definition
15
13
 
16
- #_@private
14
+ # _@private
17
15
  def initialize(step_definition)
18
16
  @step_definition = step_definition
19
17
  end
20
-
21
18
  end
22
-
23
19
  end
24
20
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/core/events'
4
+
5
+ module Cucumber
6
+ module Events
7
+ # Event fired when a Test::Case is created from a Pickle
8
+ class TestCaseCreated < Core::Event.new(:test_case, :pickle)
9
+ attr_reader :test_case
10
+ attr_reader :pickle
11
+ end
12
+ end
13
+ end
@@ -2,17 +2,13 @@ require 'cucumber/core/events'
2
2
 
3
3
  module Cucumber
4
4
  module Events
5
-
6
5
  # Signals that a {Cucumber::Core::Test::Case} has finished executing
7
6
  class TestCaseFinished < Core::Events::TestCaseFinished
8
-
9
7
  # @return [Cucumber::Core::Test::Case] that was executed
10
8
  attr_reader :test_case
11
9
 
12
10
  # @return [Cucumber::Core::Test::Result] the result of running the {Cucumber::Core::Test::Case}
13
11
  attr_reader :result
14
-
15
12
  end
16
-
17
13
  end
18
14
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/core/events'
4
+
5
+ module Cucumber
6
+ module Events
7
+ # Event fired when a Test::Case is ready to be ran (matching has been done, hooks added etc)
8
+ class TestCaseReady < Core::Event.new(:test_case)
9
+ attr_reader :test_case
10
+ end
11
+ end
12
+ end
@@ -2,14 +2,10 @@ require 'cucumber/core/events'
2
2
 
3
3
  module Cucumber
4
4
  module Events
5
-
6
5
  # Signals that a {Cucumber::Core::Test::Case} is about to be executed
7
6
  class TestCaseStarted < Core::Events::TestCaseStarted
8
-
9
7
  # @return [Cucumber::Core::Test::Case] the test case to be executed
10
8
  attr_reader :test_case
11
-
12
9
  end
13
-
14
10
  end
15
11
  end
@@ -1,12 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber/core/events'
3
4
 
4
5
  module Cucumber
5
6
  module Events
6
-
7
- # Event fired after all test cases have finished executing
7
+ # Event fired after all test cases have finished executing
8
8
  class TestRunFinished < Core::Event.new
9
9
  end
10
-
11
10
  end
12
11
  end
@@ -1,16 +1,14 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber/core/events'
3
4
 
4
5
  module Cucumber
5
6
  module Events
6
-
7
- # Event fired once all test cases have been filtered before
7
+ # Event fired once all test cases have been filtered before
8
8
  # the first one is executed.
9
9
  class TestRunStarted < Core::Event.new(:test_cases)
10
-
11
10
  # @return [Array<Cucumber::Core::Test::Case>] the test cases to be executed
12
11
  attr_reader :test_cases
13
12
  end
14
-
15
13
  end
16
14
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/core/events'
4
+
5
+ module Cucumber
6
+ module Events
7
+ # Event fired when a TestStep is created from a PickleStep
8
+ class TestStepCreated < Core::Event.new(:test_step, :pickle_step)
9
+ attr_reader :test_step
10
+ attr_reader :pickle_step
11
+ end
12
+ end
13
+ end
@@ -2,17 +2,13 @@ require 'cucumber/core/events'
2
2
 
3
3
  module Cucumber
4
4
  module Events
5
-
6
5
  # Signals that a {Cucumber::Core::Test::Step} has finished executing
7
6
  class TestStepFinished < Core::Events::TestStepFinished
8
-
9
7
  # @return [Cucumber::Core::Test::Step] the test step that was executed
10
8
  attr_reader :test_step
11
9
 
12
10
  # @return [Cucumber::Core::Test::Result] the result of running the {Cucumber::Core::Test::Step}
13
11
  attr_reader :result
14
-
15
12
  end
16
-
17
13
  end
18
14
  end
@@ -2,14 +2,10 @@ require 'cucumber/core/events'
2
2
 
3
3
  module Cucumber
4
4
  module Events
5
-
6
- # Signals that a {Cucumber::Core::Test::Step} is about to be executed
5
+ # Signals that a {Cucumber::Core::Test::Step} is about to be executed
7
6
  class TestStepStarted < Core::Events::TestStepStarted
8
-
9
7
  # @return [Cucumber::Core::Test::Step] the test step to be executed
10
8
  attr_reader :test_step
11
-
12
9
  end
13
-
14
10
  end
15
11
  end
@@ -0,0 +1,10 @@
1
+ require 'cucumber/core/events'
2
+
3
+ module Cucumber
4
+ module Events
5
+ class UndefinedParameterType < Core::Event.new(:type_name, :expression)
6
+ attr_reader :type_name
7
+ attr_reader :expression
8
+ end
9
+ end
10
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber'
3
- require 'cucumber/core/ast/location'
4
+ require 'cucumber/core/test/location'
4
5
 
5
6
  module Cucumber
6
7
  class FileSpecs
@@ -8,7 +9,7 @@ module Cucumber
8
9
 
9
10
  def initialize(file_specs)
10
11
  Cucumber.logger.debug("Features:\n")
11
- @file_specs = file_specs.map { |s| FileSpec.new(s) }
12
+ @file_specs = file_specs.map { |spec| FileSpec.new(spec) }
12
13
  Cucumber.logger.debug("\n")
13
14
  end
14
15
 
@@ -21,8 +22,8 @@ module Cucumber
21
22
  end
22
23
 
23
24
  class FileSpec
24
- def initialize(s)
25
- @file, @lines = *FILE_COLON_LINE_PATTERN.match(s).captures
25
+ def initialize(spec)
26
+ @file, @lines = *FILE_COLON_LINE_PATTERN.match(spec).captures
26
27
  Cucumber.logger.debug(" * #{@file}\n")
27
28
  @lines = String(@lines).split(':').map { |line| Integer(line) }
28
29
  end
@@ -30,8 +31,8 @@ module Cucumber
30
31
  attr_reader :file
31
32
 
32
33
  def locations
33
- return [ Core::Ast::Location.new(@file) ] if @lines.empty?
34
- @lines.map { |line| Core::Ast::Location.new(@file, line) }
34
+ return [Core::Test::Location.new(@file)] if @lines.empty?
35
+ @lines.map { |line| Core::Test::Location.new(@file, line) }
35
36
  end
36
37
  end
37
38
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber/filters/activate_steps'
3
4
  require 'cucumber/filters/apply_after_step_hooks'
4
5
  require 'cucumber/filters/apply_before_hooks'
@@ -10,3 +11,4 @@ require 'cucumber/filters/quit'
10
11
  require 'cucumber/filters/randomizer'
11
12
  require 'cucumber/filters/retry'
12
13
  require 'cucumber/filters/tag_limits'
14
+ require 'cucumber/filters/broadcast_test_case_ready_event'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber/core/filter'
3
4
  require 'cucumber/step_match'
4
5
  require 'cucumber/events'
@@ -7,7 +8,6 @@ require 'cucumber/errors'
7
8
  module Cucumber
8
9
  module Filters
9
10
  class ActivateSteps < Core::Filter.new(:step_match_search, :configuration)
10
-
11
11
  def test_case(test_case)
12
12
  CaseFilter.new(test_case, step_match_search, configuration).test_case.describe_to receiver
13
13
  end
@@ -26,7 +26,7 @@ module Cucumber
26
26
  private
27
27
 
28
28
  def new_test_steps
29
- @original_test_case.test_steps.map(&self.method(:attempt_to_activate))
29
+ @original_test_case.test_steps.map(&method(:attempt_to_activate))
30
30
  end
31
31
 
32
32
  def attempt_to_activate(test_step)
@@ -39,12 +39,14 @@ module Cucumber
39
39
 
40
40
  class FindMatch
41
41
  def initialize(step_match_search, configuration, test_step)
42
- @step_match_search, @configuration, @test_step = step_match_search, configuration, test_step
42
+ @step_match_search = step_match_search
43
+ @configuration = configuration
44
+ @test_step = test_step
43
45
  end
44
46
 
45
47
  def result
46
48
  begin
47
- return NoStepMatch.new(test_step.source.last, test_step.text) unless matches.any?
49
+ return NoStepMatch.new(test_step, test_step.text) unless matches.any?
48
50
  rescue Cucumber::Ambiguous => e
49
51
  return AmbiguousStepMatch.new(e)
50
52
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Cucumber
3
4
  module Filters
4
5
  class ApplyAfterHooks < Core::Filter.new(:hooks)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber/core/filter'
3
4
 
4
5
  module Cucumber
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber/core/filter'
3
4
 
4
5
  module Cucumber
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Cucumber
3
4
  module Filters
4
5
  class ApplyBeforeHooks < Core::Filter.new(:hooks)
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Filters
5
+ class BroadcastTestCaseReadyEvent < Core::Filter.new(:config)
6
+ def test_case(test_case)
7
+ config.notify :test_case_ready, test_case
8
+ test_case.describe_to(receiver)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Cucumber
3
4
  module Filters
4
5
  # Added at the end of the filter chain to broadcast a list of
5
6
  # all of the test cases that have made it through the filters.
6
7
  class BroadcastTestRunStartedEvent < Core::Filter.new(:config)
7
- def initialize(config, receiver=nil)
8
+ def initialize(config, receiver = nil)
8
9
  super
9
10
  @test_cases = []
10
11
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Cucumber
3
4
  module Filters
4
-
5
5
  class GatedReceiver
6
6
  def initialize(receiver)
7
7
  @receiver = receiver
@@ -21,6 +21,5 @@ module Cucumber
21
21
  self
22
22
  end
23
23
  end
24
-
25
24
  end
26
25
  end
@@ -1,36 +1,31 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'cucumber/core/filter'
3
- require 'cucumber/core/ast/location'
4
+ require 'cucumber/core/test/location'
4
5
  require 'cucumber/running_test_case'
5
6
 
6
7
  module Cucumber
7
8
  module Filters
8
-
9
9
  class PrepareWorld < Core::Filter.new(:runtime)
10
-
11
10
  def test_case(test_case)
12
11
  CaseFilter.new(runtime, test_case).test_case.describe_to receiver
13
12
  end
14
13
 
15
14
  class CaseFilter
16
15
  def initialize(runtime, original_test_case)
17
- @runtime, @original_test_case = runtime, original_test_case
16
+ @runtime = runtime
17
+ @original_test_case = original_test_case
18
18
  end
19
19
 
20
20
  def test_case
21
- init_scenario = Cucumber::Hooks.around_hook(@original_test_case.source) do |continue|
21
+ init_scenario = Cucumber::Hooks.around_hook do |continue|
22
22
  @runtime.begin_scenario(scenario)
23
23
  continue.call
24
24
  @runtime.end_scenario(scenario)
25
25
  end
26
26
  around_hooks = [init_scenario] + @original_test_case.around_hooks
27
27
 
28
- empty_hook = proc {} #no op - legacy format adapter expects a before hooks
29
- empty_hook_location = Cucumber::Core::Ast::Location.from_source_location(*empty_hook.source_location)
30
- default_hook = Cucumber::Hooks.before_hook(@original_test_case.source, empty_hook_location, &empty_hook)
31
- steps = [default_hook] + @original_test_case.test_steps
32
-
33
- @original_test_case.with_around_hooks(around_hooks).with_steps(steps)
28
+ @original_test_case.with_around_hooks(around_hooks).with_steps(@original_test_case.test_steps)
34
29
  end
35
30
 
36
31
  private
@@ -39,8 +34,6 @@ module Cucumber
39
34
  @scenario ||= RunningTestCase.new(test_case)
40
35
  end
41
36
  end
42
-
43
37
  end
44
-
45
38
  end
46
39
  end