cucumber 4.0.0.rc.3 → 4.0.0.rc.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -1
- data/lib/cucumber/cli/options.rb +2 -1
- data/lib/cucumber/configuration.rb +5 -0
- data/lib/cucumber/deprecate.rb +29 -5
- data/lib/cucumber/errors.rb +3 -0
- data/lib/cucumber/events.rb +12 -7
- data/lib/cucumber/events/envelope.rb +9 -0
- data/lib/cucumber/events/hook_test_step_created.rb +13 -0
- data/lib/cucumber/events/test_case_created.rb +13 -0
- data/lib/cucumber/events/test_case_ready.rb +12 -0
- data/lib/cucumber/events/test_step_created.rb +13 -0
- data/lib/cucumber/filters.rb +1 -0
- data/lib/cucumber/filters/broadcast_test_case_ready_event.rb +12 -0
- data/lib/cucumber/formatter/console.rb +3 -8
- data/lib/cucumber/formatter/duration_extractor.rb +1 -1
- data/lib/cucumber/formatter/errors.rb +6 -0
- data/lib/cucumber/formatter/json.rb +15 -6
- data/lib/cucumber/formatter/junit.rb +1 -1
- data/lib/cucumber/formatter/message.rb +246 -0
- data/lib/cucumber/formatter/pretty.rb +3 -4
- data/lib/cucumber/formatter/query/hook_by_test_step.rb +31 -0
- data/lib/cucumber/formatter/query/pickle_by_test.rb +26 -0
- data/lib/cucumber/formatter/query/pickle_step_by_test_step.rb +26 -0
- data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +40 -0
- data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +40 -0
- data/lib/cucumber/gherkin/data_table_parser.rb +1 -1
- data/lib/cucumber/gherkin/steps_parser.rb +1 -1
- data/lib/cucumber/glue/hook.rb +18 -2
- data/lib/cucumber/glue/proto_world.rb +30 -18
- data/lib/cucumber/glue/registry_and_more.rb +31 -2
- data/lib/cucumber/glue/step_definition.rb +28 -4
- data/lib/cucumber/hooks.rb +8 -8
- data/lib/cucumber/multiline_argument.rb +1 -1
- data/lib/cucumber/multiline_argument/data_table.rb +17 -13
- data/lib/cucumber/runtime.rb +2 -2
- data/lib/cucumber/runtime/after_hooks.rb +6 -2
- data/lib/cucumber/runtime/before_hooks.rb +6 -2
- data/lib/cucumber/runtime/for_programming_languages.rb +1 -0
- data/lib/cucumber/runtime/step_hooks.rb +3 -2
- data/lib/cucumber/runtime/support_code.rb +3 -3
- data/lib/cucumber/runtime/user_interface.rb +2 -10
- data/lib/cucumber/version +1 -1
- metadata +40 -27
@@ -131,10 +131,9 @@ module Cucumber
|
|
131
131
|
print_summary
|
132
132
|
end
|
133
133
|
|
134
|
-
def
|
135
|
-
|
136
|
-
|
137
|
-
end
|
134
|
+
def attach(src, media_type)
|
135
|
+
return unless media_type == 'text/x.cucumber.log+plain'
|
136
|
+
@test_step_output.push src
|
138
137
|
end
|
139
138
|
|
140
139
|
private
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'cucumber/formatter/errors'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Formatter
|
5
|
+
module Query
|
6
|
+
class HookByTestStep
|
7
|
+
def initialize(config)
|
8
|
+
@hook_id_by_test_step_id = {}
|
9
|
+
|
10
|
+
config.on_event :test_step_created, &method(:on_test_step_created)
|
11
|
+
config.on_event :hook_test_step_created, &method(:on_hook_test_step_created)
|
12
|
+
end
|
13
|
+
|
14
|
+
def hook_id(test_step)
|
15
|
+
return @hook_id_by_test_step_id[test_step.id] if @hook_id_by_test_step_id.key?(test_step.id)
|
16
|
+
raise TestStepUnknownError, "No hook found for #{test_step.id} }. Known: #{@hook_id_by_test_step_id.keys}"
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def on_test_step_created(event)
|
22
|
+
@hook_id_by_test_step_id[event.test_step.id] = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def on_hook_test_step_created(event)
|
26
|
+
@hook_id_by_test_step_id[event.test_step.id] = event.hook.id
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'cucumber/formatter/errors'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Formatter
|
5
|
+
module Query
|
6
|
+
class PickleByTest
|
7
|
+
def initialize(config)
|
8
|
+
@pickle_id_by_test_case_id = {}
|
9
|
+
config.on_event :test_case_created, &method(:on_test_case_created)
|
10
|
+
end
|
11
|
+
|
12
|
+
def pickle_id(test_case)
|
13
|
+
return @pickle_id_by_test_case_id[test_case.id] if @pickle_id_by_test_case_id.key?(test_case.id)
|
14
|
+
|
15
|
+
raise TestCaseUnknownError, "No pickle found for #{test_case.id} }. Known: #{@pickle_id_by_test_case_id.keys}"
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def on_test_case_created(event)
|
21
|
+
@pickle_id_by_test_case_id[event.test_case.id] = event.pickle.id
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'cucumber/formatter/errors'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Formatter
|
5
|
+
module Query
|
6
|
+
class PickleStepByTestStep
|
7
|
+
def initialize(config)
|
8
|
+
@pickle_id_step_by_test_step_id = {}
|
9
|
+
config.on_event :test_step_created, &method(:on_test_step_created)
|
10
|
+
end
|
11
|
+
|
12
|
+
def pickle_step_id(test_step)
|
13
|
+
return @pickle_id_step_by_test_step_id[test_step.id] if @pickle_id_step_by_test_step_id.key?(test_step.id)
|
14
|
+
|
15
|
+
raise TestStepUnknownError, "No pickle step found for #{test_step.id} }. Known: #{@pickle_id_step_by_test_step_id.keys}"
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def on_test_step_created(event)
|
21
|
+
@pickle_id_step_by_test_step_id[event.test_step.id] = event.pickle_step.id
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'cucumber/formatter/errors'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Formatter
|
5
|
+
module Query
|
6
|
+
class StepDefinitionsByTestStep
|
7
|
+
def initialize(config)
|
8
|
+
@step_definition_ids_by_test_step_id = {}
|
9
|
+
@step_match_arguments_by_test_step_id = {}
|
10
|
+
|
11
|
+
config.on_event :test_step_created, &method(:on_test_step_created)
|
12
|
+
config.on_event :step_activated, &method(:on_step_activated)
|
13
|
+
end
|
14
|
+
|
15
|
+
def step_definition_ids(test_step)
|
16
|
+
return @step_definition_ids_by_test_step_id[test_step.id] if @step_definition_ids_by_test_step_id.key?(test_step.id)
|
17
|
+
|
18
|
+
raise TestStepUnknownError, "No step definition found for #{test_step.id} }. Known: #{@step_definition_ids_by_test_step_id.keys}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def step_match_arguments(test_step)
|
22
|
+
return @step_match_arguments_by_test_step_id[test_step.id] if @step_match_arguments_by_test_step_id.key?(test_step.id)
|
23
|
+
|
24
|
+
raise TestStepUnknownError, "No step match arguments found for #{test_step.id} }. Known: #{@step_match_arguments_by_test_step_id.keys}"
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def on_test_step_created(event)
|
30
|
+
@step_definition_ids_by_test_step_id[event.test_step.id] = []
|
31
|
+
end
|
32
|
+
|
33
|
+
def on_step_activated(event)
|
34
|
+
@step_definition_ids_by_test_step_id[event.test_step.id] << event.step_match.step_definition.id
|
35
|
+
@step_match_arguments_by_test_step_id[event.test_step.id] = event.step_match.step_arguments
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'cucumber/formatter/errors'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Formatter
|
5
|
+
module Query
|
6
|
+
class TestCaseStartedByTestCase
|
7
|
+
def initialize(config)
|
8
|
+
@config = config
|
9
|
+
config.on_event :test_case_created, &method(:on_test_case_created)
|
10
|
+
config.on_event :test_case_started, &method(:on_test_case_started)
|
11
|
+
|
12
|
+
@attempts_by_test_case_id = {}
|
13
|
+
@test_case_started_id_by_test_case_id = {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def attempt_by_test_case(test_case)
|
17
|
+
raise TestCaseUnknownError, "No test case found for #{test_case.id} }. Known: #{@attempts_by_test_case_id.keys}" unless @attempts_by_test_case_id.key?(test_case.id)
|
18
|
+
@attempts_by_test_case_id[test_case.id]
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_case_started_id_by_test_case(test_case)
|
22
|
+
raise TestCaseUnknownError, "No test case found for #{test_case.id} }. Known: #{@test_case_started_id_by_test_case_id.keys}" unless @test_case_started_id_by_test_case_id.key?(test_case.id)
|
23
|
+
@test_case_started_id_by_test_case_id[test_case.id]
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def on_test_case_created(event)
|
29
|
+
@attempts_by_test_case_id[event.test_case.id] = 0
|
30
|
+
@test_case_started_id_by_test_case_id[event.test_case.id] = nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def on_test_case_started(event)
|
34
|
+
@attempts_by_test_case_id[event.test_case.id] += 1
|
35
|
+
@test_case_started_id_by_test_case_id[event.test_case.id] = @config.id_generator.new_id
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -15,7 +15,7 @@ module Cucumber
|
|
15
15
|
messages = ::Gherkin.from_source('dummy', feature_header + text, gherkin_options)
|
16
16
|
|
17
17
|
messages.each do |message|
|
18
|
-
gherkin_document = message.
|
18
|
+
gherkin_document = message.gherkin_document.to_hash unless message.gherkin_document.nil?
|
19
19
|
end
|
20
20
|
|
21
21
|
return if gherkin_document.nil?
|
@@ -17,7 +17,7 @@ module Cucumber
|
|
17
17
|
messages = ::Gherkin.from_source('dummy', feature_header(dialect) + text, gherkin_options)
|
18
18
|
|
19
19
|
messages.each do |message|
|
20
|
-
gherkin_document = message.
|
20
|
+
gherkin_document = message.gherkin_document.to_hash unless message.gherkin_document.nil?
|
21
21
|
end
|
22
22
|
|
23
23
|
@builder.steps(gherkin_document[:feature][:children][0][:scenario][:steps])
|
data/lib/cucumber/glue/hook.rb
CHANGED
@@ -6,9 +6,10 @@ module Cucumber
|
|
6
6
|
module Glue
|
7
7
|
# TODO: Kill pointless wrapper for Before, After and AfterStep hooks with fire
|
8
8
|
class Hook
|
9
|
-
attr_reader :tag_expressions, :location
|
9
|
+
attr_reader :id, :tag_expressions, :location
|
10
10
|
|
11
|
-
def initialize(registry, tag_expressions, proc)
|
11
|
+
def initialize(id, registry, tag_expressions, proc)
|
12
|
+
@id = id
|
12
13
|
@registry = registry
|
13
14
|
@tag_expressions = sanitize_tag_expressions(tag_expressions)
|
14
15
|
@proc = proc
|
@@ -27,6 +28,21 @@ module Cucumber
|
|
27
28
|
)
|
28
29
|
end
|
29
30
|
|
31
|
+
def to_envelope
|
32
|
+
Cucumber::Messages::Envelope.new(
|
33
|
+
hook: Cucumber::Messages::Hook.new(
|
34
|
+
id: id,
|
35
|
+
tag_expression: tag_expressions.join(' '),
|
36
|
+
source_reference: Cucumber::Messages::SourceReference.new(
|
37
|
+
uri: location.file,
|
38
|
+
location: Cucumber::Messages::Location.new(
|
39
|
+
line: location.lines.first
|
40
|
+
)
|
41
|
+
)
|
42
|
+
)
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
30
46
|
private
|
31
47
|
|
32
48
|
def sanitize_tag_expressions(tag_expressions)
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'cucumber/gherkin/formatter/ansi_escapes'
|
4
4
|
require 'cucumber/core/test/data_table'
|
5
|
+
require 'cucumber/deprecate'
|
5
6
|
|
6
7
|
module Cucumber
|
7
8
|
module Glue
|
@@ -67,9 +68,8 @@ module Cucumber
|
|
67
68
|
# %w{ CUC-101 Peeler 22 }
|
68
69
|
# ])
|
69
70
|
#
|
70
|
-
def table(text_or_table
|
71
|
-
|
72
|
-
MultilineArgument::DataTable.from(text_or_table, location)
|
71
|
+
def table(text_or_table)
|
72
|
+
MultilineArgument::DataTable.from(text_or_table)
|
73
73
|
end
|
74
74
|
|
75
75
|
# Print a message to the output.
|
@@ -80,7 +80,16 @@ module Cucumber
|
|
80
80
|
#
|
81
81
|
# If you'd prefer to see the message immediately, call {Kernel.puts} instead.
|
82
82
|
def puts(*messages)
|
83
|
-
|
83
|
+
Cucumber.deprecate(
|
84
|
+
'Messages emitted with "puts" will no longer be caught by Cucumber ' \
|
85
|
+
'and sent to the formatter. If you want message to be in the formatted output, ' \
|
86
|
+
"please use log(message) instead.\n" \
|
87
|
+
'If you simply want it in the console, '\
|
88
|
+
'keep using "puts" (or Kernel.puts to avoid this message)',
|
89
|
+
'puts(message)',
|
90
|
+
'5.0.0'
|
91
|
+
)
|
92
|
+
messages.each { |message| log(message.to_s) }
|
84
93
|
end
|
85
94
|
|
86
95
|
# Pause the tests and ask the operator for input
|
@@ -89,7 +98,21 @@ module Cucumber
|
|
89
98
|
end
|
90
99
|
|
91
100
|
# Embed an image in the output
|
92
|
-
def embed(file, mime_type,
|
101
|
+
def embed(file, mime_type, _label = 'Screenshot')
|
102
|
+
Cucumber.deprecate(
|
103
|
+
'Please use attach(file, media_type) instead',
|
104
|
+
'embed(file, mime_type, label)',
|
105
|
+
'5.0.0'
|
106
|
+
)
|
107
|
+
attach(file, mime_type)
|
108
|
+
end
|
109
|
+
|
110
|
+
def log(message)
|
111
|
+
raise Cucumber::LogTypeInvalid unless message.is_a?(String)
|
112
|
+
attach(message.dup, 'text/x.cucumber.log+plain')
|
113
|
+
end
|
114
|
+
|
115
|
+
def attach(file, media_type)
|
93
116
|
super
|
94
117
|
end
|
95
118
|
|
@@ -146,23 +169,12 @@ module Cucumber
|
|
146
169
|
runtime.invoke_dynamic_steps(steps_text, language, location)
|
147
170
|
end
|
148
171
|
|
149
|
-
# rubocop:disable Style/UnneededInterpolation
|
150
|
-
define_method(:puts) do |*messages|
|
151
|
-
# Even though they won't be output until later, converting the messages to
|
152
|
-
# strings right away will protect them from modifications to their original
|
153
|
-
# objects in the mean time
|
154
|
-
messages.collect! { |message| "#{message}" }
|
155
|
-
|
156
|
-
runtime.puts(*messages)
|
157
|
-
end
|
158
|
-
# rubocop:enable Style/UnneededInterpolation
|
159
|
-
|
160
172
|
define_method(:ask) do |question, timeout_seconds = 60|
|
161
173
|
runtime.ask(question, timeout_seconds)
|
162
174
|
end
|
163
175
|
|
164
|
-
define_method(:
|
165
|
-
runtime.
|
176
|
+
define_method(:attach) do |file, media_type|
|
177
|
+
runtime.attach(file, media_type)
|
166
178
|
end
|
167
179
|
|
168
180
|
# Prints the list of modules that are included in the World
|
@@ -72,18 +72,33 @@ module Cucumber
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def register_rb_hook(phase, tag_expressions, proc)
|
75
|
-
add_hook(phase, Hook.new(self, tag_expressions, proc))
|
75
|
+
hook = add_hook(phase, Hook.new(@configuration.id_generator.new_id, self, tag_expressions, proc))
|
76
|
+
@configuration.notify :envelope, hook.to_envelope
|
77
|
+
hook
|
76
78
|
end
|
77
79
|
|
78
80
|
def define_parameter_type(parameter_type)
|
81
|
+
@configuration.notify :envelope, parameter_type_envelope(parameter_type)
|
82
|
+
|
79
83
|
@parameter_type_registry.define_parameter_type(parameter_type)
|
80
84
|
end
|
81
85
|
|
82
86
|
def register_rb_step_definition(string_or_regexp, proc_or_sym, options)
|
83
|
-
step_definition = StepDefinition.new(self, string_or_regexp, proc_or_sym, options)
|
87
|
+
step_definition = StepDefinition.new(@configuration.id_generator.new_id, self, string_or_regexp, proc_or_sym, options)
|
84
88
|
@step_definitions << step_definition
|
85
89
|
@configuration.notify :step_definition_registered, step_definition
|
90
|
+
@configuration.notify :envelope, step_definition.to_envelope
|
86
91
|
step_definition
|
92
|
+
rescue Cucumber::CucumberExpressions::UndefinedParameterTypeError => e
|
93
|
+
# TODO: add a way to extract the parameter type directly from the error.
|
94
|
+
type_name = e.message.match(/^Undefined parameter type \{(.*)\}$/)[1]
|
95
|
+
|
96
|
+
@configuration.notify :envelope, Cucumber::Messages::Envelope.new(
|
97
|
+
undefined_parameter_type: Cucumber::Messages::UndefinedParameterType.new(
|
98
|
+
name: type_name,
|
99
|
+
expression: string_or_regexp
|
100
|
+
)
|
101
|
+
)
|
87
102
|
end
|
88
103
|
|
89
104
|
def build_rb_world_factory(world_modules, namespaced_world_modules, proc)
|
@@ -171,6 +186,20 @@ module Cucumber
|
|
171
186
|
|
172
187
|
private
|
173
188
|
|
189
|
+
def parameter_type_envelope(parameter_type)
|
190
|
+
# TODO: should me moved to Cucumber::Expression::ParameterType#to_envelope ?
|
191
|
+
# Note: that would mean that cucumber-expression would depend on cucumber-messages
|
192
|
+
|
193
|
+
Cucumber::Messages::Envelope.new(
|
194
|
+
parameter_type: Cucumber::Messages::ParameterType.new(
|
195
|
+
name: parameter_type.name,
|
196
|
+
regular_expressions: parameter_type.regexps.map(&:to_s),
|
197
|
+
prefer_for_regular_expression_match: parameter_type.prefer_for_regexp_match?,
|
198
|
+
use_for_snippets: parameter_type.use_for_snippets?
|
199
|
+
)
|
200
|
+
)
|
201
|
+
end
|
202
|
+
|
174
203
|
def available_step_definition_hash
|
175
204
|
@available_step_definition_hash ||= {}
|
176
205
|
end
|
@@ -24,9 +24,9 @@ module Cucumber
|
|
24
24
|
end
|
25
25
|
|
26
26
|
class << self
|
27
|
-
def new(registry, string_or_regexp, proc_or_sym, options)
|
27
|
+
def new(id, registry, string_or_regexp, proc_or_sym, options)
|
28
28
|
raise MissingProc if proc_or_sym.nil?
|
29
|
-
super registry, registry.create_expression(string_or_regexp), create_proc(proc_or_sym, options)
|
29
|
+
super id, registry, registry.create_expression(string_or_regexp), create_proc(proc_or_sym, options)
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
@@ -62,16 +62,40 @@ module Cucumber
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
attr_reader :expression, :registry
|
65
|
+
attr_reader :id, :expression, :registry
|
66
66
|
|
67
|
-
def initialize(registry, expression, proc)
|
67
|
+
def initialize(id, registry, expression, proc)
|
68
68
|
raise 'No regexp' if expression.is_a?(Regexp)
|
69
|
+
@id = id
|
69
70
|
@registry = registry
|
70
71
|
@expression = expression
|
71
72
|
@proc = proc
|
72
73
|
# @registry.available_step_definition(regexp_source, location)
|
73
74
|
end
|
74
75
|
|
76
|
+
def to_envelope
|
77
|
+
Cucumber::Messages::Envelope.new(
|
78
|
+
step_definition: Cucumber::Messages::StepDefinition.new(
|
79
|
+
id: id,
|
80
|
+
pattern: Cucumber::Messages::StepDefinitionPattern.new(
|
81
|
+
source: expression.source.to_s,
|
82
|
+
type: expression_type
|
83
|
+
),
|
84
|
+
source_reference: Cucumber::Messages::SourceReference.new(
|
85
|
+
uri: location.file,
|
86
|
+
location: Cucumber::Messages::Location.new(
|
87
|
+
line: location.lines.first
|
88
|
+
)
|
89
|
+
)
|
90
|
+
)
|
91
|
+
)
|
92
|
+
end
|
93
|
+
|
94
|
+
def expression_type
|
95
|
+
return Cucumber::Messages::StepDefinitionPatternType::CUCUMBER_EXPRESSION if expression.is_a?(CucumberExpressions::CucumberExpression)
|
96
|
+
Cucumber::Messages::StepDefinitionPatternType::REGULAR_EXPRESSION
|
97
|
+
end
|
98
|
+
|
75
99
|
# @api private
|
76
100
|
def to_hash
|
77
101
|
type = expression.is_a?(CucumberExpressions::RegularExpression) ? 'regular expression' : 'cucumber expression'
|
data/lib/cucumber/hooks.rb
CHANGED
@@ -9,17 +9,17 @@ module Cucumber
|
|
9
9
|
# source for test steps
|
10
10
|
module Hooks
|
11
11
|
class << self
|
12
|
-
def before_hook(location, &block)
|
13
|
-
build_hook_step(location, block, BeforeHook, Core::Test::UnskippableAction)
|
12
|
+
def before_hook(id, location, &block)
|
13
|
+
build_hook_step(id, location, block, BeforeHook, Core::Test::UnskippableAction)
|
14
14
|
end
|
15
15
|
|
16
|
-
def after_hook(location, &block)
|
17
|
-
build_hook_step(location, block, AfterHook, Core::Test::UnskippableAction)
|
16
|
+
def after_hook(id, location, &block)
|
17
|
+
build_hook_step(id, location, block, AfterHook, Core::Test::UnskippableAction)
|
18
18
|
end
|
19
19
|
|
20
|
-
def after_step_hook(test_step, location, &block)
|
20
|
+
def after_step_hook(id, test_step, location, &block)
|
21
21
|
raise ArgumentError if test_step.hook?
|
22
|
-
build_hook_step(location, block, AfterStepHook, Core::Test::Action)
|
22
|
+
build_hook_step(id, location, block, AfterStepHook, Core::Test::Action)
|
23
23
|
end
|
24
24
|
|
25
25
|
def around_hook(&block)
|
@@ -28,10 +28,10 @@ module Cucumber
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
def build_hook_step(location, block, hook_type, action_type)
|
31
|
+
def build_hook_step(id, location, block, hook_type, action_type)
|
32
32
|
action = action_type.new(location, &block)
|
33
33
|
hook = hook_type.new(action.location)
|
34
|
-
Core::Test::HookStep.new(hook.text, location, action)
|
34
|
+
Core::Test::HookStep.new(id, hook.text, location, action)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|