cucumber-core 11.1.0 → 13.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -254
- data/README.md +3 -2
- data/lib/cucumber/core/compiler.rb +41 -20
- data/lib/cucumber/core/event.rb +26 -27
- data/lib/cucumber/core/event_bus.rb +16 -19
- data/lib/cucumber/core/events.rb +3 -11
- data/lib/cucumber/core/filter.rb +1 -3
- data/lib/cucumber/core/gherkin/parser.rb +41 -13
- data/lib/cucumber/core/gherkin/writer/helpers.rb +6 -4
- data/lib/cucumber/core/gherkin/writer.rb +11 -2
- data/lib/cucumber/core/platform.rb +2 -1
- data/lib/cucumber/core/report/summary.rb +14 -5
- data/lib/cucumber/core/test/action.rb +3 -3
- data/lib/cucumber/core/test/around_hook.rb +3 -1
- data/lib/cucumber/core/test/case.rb +6 -4
- data/lib/cucumber/core/test/data_table.rb +4 -7
- data/lib/cucumber/core/test/doc_string.rb +6 -5
- data/lib/cucumber/core/test/empty_multiline_argument.rb +2 -1
- data/lib/cucumber/core/test/filters/activate_steps_for_self_test.rb +3 -3
- data/lib/cucumber/core/test/filters/locations_filter.rb +1 -2
- data/lib/cucumber/core/test/filters/name_filter.rb +1 -1
- data/lib/cucumber/core/test/filters/tag_filter.rb +1 -1
- data/lib/cucumber/core/test/filters.rb +1 -0
- data/lib/cucumber/core/test/location.rb +6 -7
- data/lib/cucumber/core/test/result.rb +41 -37
- data/lib/cucumber/core/test/runner.rb +7 -7
- data/lib/cucumber/core/test/tag.rb +1 -0
- data/lib/cucumber/core/test/timer.rb +1 -0
- data/lib/cucumber/core.rb +1 -1
- metadata +42 -46
data/lib/cucumber/core/events.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'cucumber/core/event'
|
3
5
|
|
4
6
|
module Cucumber
|
5
7
|
module Core
|
6
8
|
module Events
|
7
|
-
|
8
9
|
class Envelope < Event.new(:envelope)
|
9
10
|
attr_reader :envelope
|
10
11
|
end
|
@@ -13,7 +14,6 @@ module Cucumber
|
|
13
14
|
class GherkinSourceParsed < Event.new(:gherkin_document)
|
14
15
|
# @return [GherkinDocument] the GherkinDocument Ast Node
|
15
16
|
attr_reader :gherkin_document
|
16
|
-
|
17
17
|
end
|
18
18
|
|
19
19
|
# Signals that a Test::Step was created from a PickleStep
|
@@ -36,40 +36,32 @@ module Cucumber
|
|
36
36
|
|
37
37
|
# Signals that a {Test::Case} is about to be executed
|
38
38
|
class TestCaseStarted < Event.new(:test_case)
|
39
|
-
|
40
39
|
# @return [Test::Case] the test case to be executed
|
41
40
|
attr_reader :test_case
|
42
|
-
|
43
41
|
end
|
44
42
|
|
45
43
|
# Signals that a {Test::Step} is about to be executed
|
46
44
|
class TestStepStarted < Event.new(:test_step)
|
47
|
-
|
48
45
|
# @return [Test::Step] the test step to be executed
|
49
46
|
attr_reader :test_step
|
50
|
-
|
51
47
|
end
|
52
48
|
|
53
49
|
# Signals that a {Test::Step} has finished executing
|
54
50
|
class TestStepFinished < Event.new(:test_step, :result)
|
55
|
-
|
56
51
|
# @return [Test::Step] the test step that was executed
|
57
52
|
attr_reader :test_step
|
58
53
|
|
59
54
|
# @return [Test::Result] the result of running the {Test::Step}
|
60
55
|
attr_reader :result
|
61
|
-
|
62
56
|
end
|
63
57
|
|
64
58
|
# Signals that a {Test::Case} has finished executing
|
65
59
|
class TestCaseFinished < Event.new(:test_case, :result)
|
66
|
-
|
67
60
|
# @return [Test::Case] that was executed
|
68
61
|
attr_reader :test_case
|
69
62
|
|
70
63
|
# @return [Test::Result] the result of running the {Test::Step}
|
71
64
|
attr_reader :result
|
72
|
-
|
73
65
|
end
|
74
66
|
|
75
67
|
# The registry contains all the events registered in the core,
|
@@ -83,7 +75,7 @@ module Cucumber
|
|
83
75
|
TestCaseStarted,
|
84
76
|
TestStepStarted,
|
85
77
|
TestStepFinished,
|
86
|
-
TestCaseFinished
|
78
|
+
TestCaseFinished
|
87
79
|
)
|
88
80
|
end
|
89
81
|
|
data/lib/cucumber/core/filter.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Cucumber
|
3
4
|
module Core
|
4
|
-
|
5
5
|
# Filters process test cases.
|
6
6
|
#
|
7
7
|
# Each filter must respond to the following protocol:
|
@@ -22,7 +22,6 @@ module Cucumber
|
|
22
22
|
# Finally, the `done` message is sent. A filter should pass this message directly to its receiver.
|
23
23
|
#
|
24
24
|
module Filter
|
25
|
-
|
26
25
|
# Utility method for quick construction of filter classes.
|
27
26
|
#
|
28
27
|
# @example Example usage:
|
@@ -70,7 +69,6 @@ module Cucumber
|
|
70
69
|
args[-1] = new_receiver
|
71
70
|
self.class.new(*args)
|
72
71
|
end
|
73
|
-
|
74
72
|
end
|
75
73
|
|
76
74
|
if block
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'gherkin'
|
3
4
|
|
4
5
|
module Cucumber
|
@@ -17,19 +18,8 @@ module Cucumber
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def document(document)
|
20
|
-
|
21
|
-
|
22
|
-
event_bus.envelope(message)
|
23
|
-
gherkin_query.update(message)
|
24
|
-
if !message.gherkin_document.nil?
|
25
|
-
event_bus.gherkin_source_parsed(message.gherkin_document)
|
26
|
-
elsif !message.pickle.nil?
|
27
|
-
receiver.pickle(message.pickle)
|
28
|
-
elsif message.parse_error
|
29
|
-
raise Core::Gherkin::ParseError.new("#{document.uri}: #{message.parse_error.message}")
|
30
|
-
else
|
31
|
-
raise "Unknown message: #{message.to_hash}"
|
32
|
-
end
|
21
|
+
source_messages(document).each do |message|
|
22
|
+
process(message, document)
|
33
23
|
end
|
34
24
|
end
|
35
25
|
|
@@ -46,6 +36,44 @@ module Cucumber
|
|
46
36
|
receiver.done
|
47
37
|
self
|
48
38
|
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def source_messages(document)
|
43
|
+
::Gherkin.from_source(document.uri, document.body, gherkin_options(document))
|
44
|
+
end
|
45
|
+
|
46
|
+
def process(message, document)
|
47
|
+
generate_envelope(message)
|
48
|
+
update_gherkin_query(message)
|
49
|
+
|
50
|
+
case type?(message)
|
51
|
+
when :gherkin_document; then event_bus.gherkin_source_parsed(message.gherkin_document)
|
52
|
+
when :pickle; then receiver.pickle(message.pickle)
|
53
|
+
when :parse_error; then raise ParseError.new("#{document.uri}: #{message.parse_error.message}")
|
54
|
+
else raise "Unknown message: #{message.to_hash}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def generate_envelope(message)
|
59
|
+
event_bus.envelope(message)
|
60
|
+
end
|
61
|
+
|
62
|
+
def update_gherkin_query(message)
|
63
|
+
gherkin_query.update(message)
|
64
|
+
end
|
65
|
+
|
66
|
+
def type?(message)
|
67
|
+
if !message.gherkin_document.nil?
|
68
|
+
:gherkin_document
|
69
|
+
elsif !message.pickle.nil?
|
70
|
+
:pickle
|
71
|
+
elsif message.parse_error
|
72
|
+
:parse_error
|
73
|
+
else
|
74
|
+
:unknown
|
75
|
+
end
|
76
|
+
end
|
49
77
|
end
|
50
78
|
end
|
51
79
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Cucumber
|
3
4
|
module Core
|
4
5
|
module Gherkin
|
5
6
|
module Writer
|
6
|
-
|
7
7
|
module HasOptionsInitializer
|
8
8
|
def self.included(base)
|
9
9
|
base.extend HasDefaultKeyword
|
@@ -79,6 +79,7 @@ module Cucumber
|
|
79
79
|
end
|
80
80
|
|
81
81
|
private
|
82
|
+
|
82
83
|
def elements
|
83
84
|
@elements ||= []
|
84
85
|
end
|
@@ -89,9 +90,10 @@ module Cucumber
|
|
89
90
|
end
|
90
91
|
|
91
92
|
private
|
93
|
+
|
92
94
|
def element(name)
|
93
95
|
define_method name do |*args, &source|
|
94
|
-
factory_name = String(name).split(
|
96
|
+
factory_name = String(name).split('_').map(&:capitalize).join
|
95
97
|
factory = Writer.const_get(factory_name)
|
96
98
|
factory.new(slurp_comments, *args).tap do |builder|
|
97
99
|
builder.instance_exec(&source) if source
|
@@ -106,7 +108,7 @@ module Cucumber
|
|
106
108
|
module Indentation
|
107
109
|
def self.level(number)
|
108
110
|
Module.new do
|
109
|
-
define_method :indent do |string, amount=nil|
|
111
|
+
define_method :indent do |string, amount = nil|
|
110
112
|
amount ||= number
|
111
113
|
return string if string.nil? || string.empty?
|
112
114
|
(' ' * amount) + string
|
@@ -125,6 +127,7 @@ module Cucumber
|
|
125
127
|
|
126
128
|
module HasDescription
|
127
129
|
private
|
130
|
+
|
128
131
|
def description
|
129
132
|
options.fetch(:description, '').split("\n").map(&:strip)
|
130
133
|
end
|
@@ -168,7 +171,6 @@ module Cucumber
|
|
168
171
|
end
|
169
172
|
end
|
170
173
|
end
|
171
|
-
|
172
174
|
end
|
173
175
|
end
|
174
176
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'cucumber/core/gherkin/writer/helpers'
|
3
4
|
require 'cucumber/core/gherkin/document'
|
4
5
|
|
5
6
|
module Cucumber
|
6
7
|
module Core
|
7
8
|
module Gherkin
|
8
|
-
|
9
9
|
module Writer
|
10
10
|
NEW_LINE = ''
|
11
11
|
def gherkin(uri = nil, &source)
|
@@ -55,6 +55,7 @@ module Cucumber
|
|
55
55
|
end
|
56
56
|
|
57
57
|
private
|
58
|
+
|
58
59
|
def language
|
59
60
|
options[:language]
|
60
61
|
end
|
@@ -86,6 +87,7 @@ module Cucumber
|
|
86
87
|
elements :step
|
87
88
|
|
88
89
|
private
|
90
|
+
|
89
91
|
def statements
|
90
92
|
prepare_statements(
|
91
93
|
comments_statement,
|
@@ -107,6 +109,7 @@ module Cucumber
|
|
107
109
|
elements :example, :scenario
|
108
110
|
|
109
111
|
private
|
112
|
+
|
110
113
|
def statements
|
111
114
|
prepare_statements(
|
112
115
|
comments_statement,
|
@@ -128,6 +131,7 @@ module Cucumber
|
|
128
131
|
elements :step
|
129
132
|
|
130
133
|
private
|
134
|
+
|
131
135
|
def statements
|
132
136
|
prepare_statements(
|
133
137
|
comments_statement,
|
@@ -155,6 +159,7 @@ module Cucumber
|
|
155
159
|
elements :step, :examples
|
156
160
|
|
157
161
|
private
|
162
|
+
|
158
163
|
def statements
|
159
164
|
prepare_statements comments_statement, tag_statement, name_statement, description_statement
|
160
165
|
end
|
@@ -174,6 +179,7 @@ module Cucumber
|
|
174
179
|
end
|
175
180
|
|
176
181
|
private
|
182
|
+
|
177
183
|
def statements
|
178
184
|
prepare_statements comments_statement, name_statement
|
179
185
|
end
|
@@ -195,6 +201,7 @@ module Cucumber
|
|
195
201
|
end
|
196
202
|
|
197
203
|
private
|
204
|
+
|
198
205
|
def statements
|
199
206
|
row_statements
|
200
207
|
end
|
@@ -216,13 +223,14 @@ module Cucumber
|
|
216
223
|
end
|
217
224
|
|
218
225
|
private
|
226
|
+
|
219
227
|
def statements
|
220
228
|
prepare_statements doc_string_statement
|
221
229
|
end
|
222
230
|
|
223
231
|
def doc_string_statement
|
224
232
|
[
|
225
|
-
%
|
233
|
+
%("""#{content_type}),
|
226
234
|
strings,
|
227
235
|
'"""'
|
228
236
|
]
|
@@ -242,6 +250,7 @@ module Cucumber
|
|
242
250
|
end
|
243
251
|
|
244
252
|
private
|
253
|
+
|
245
254
|
def statements
|
246
255
|
prepare_statements(
|
247
256
|
NEW_LINE,
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# Detect the platform we're running on so we can tweak behaviour
|
3
4
|
# in various places.
|
4
5
|
require 'rbconfig'
|
@@ -6,7 +7,7 @@ require 'rbconfig'
|
|
6
7
|
module Cucumber
|
7
8
|
unless defined?(Cucumber::VERSION)
|
8
9
|
JRUBY = defined?(JRUBY_VERSION)
|
9
|
-
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE ==
|
10
|
+
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
|
10
11
|
WINDOWS = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
11
12
|
OS_X = RbConfig::CONFIG['host_os'] =~ /darwin/
|
12
13
|
WINDOWS_MRI = WINDOWS && !JRUBY && !IRONRUBY
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Cucumber
|
3
4
|
module Core
|
4
5
|
module Report
|
@@ -12,26 +13,34 @@ module Cucumber
|
|
12
13
|
subscribe_to(event_bus)
|
13
14
|
end
|
14
15
|
|
15
|
-
def ok?(
|
16
|
-
test_cases.ok?(
|
16
|
+
def ok?(strict: Test::Result::StrictConfiguration.new)
|
17
|
+
test_cases.ok?(strict: strict)
|
17
18
|
end
|
18
19
|
|
19
20
|
private
|
20
21
|
|
21
22
|
def subscribe_to(event_bus)
|
23
|
+
register_test_case_finished_listener(event_bus)
|
24
|
+
register_test_step_finished_listener(event_bus)
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
def register_test_case_finished_listener(event_bus)
|
22
29
|
event_bus.on(:test_case_finished) do |event|
|
23
30
|
if event.test_case != @previous_test_case
|
24
31
|
@previous_test_case = event.test_case
|
25
|
-
event.result.describe_to
|
32
|
+
event.result.describe_to(test_cases)
|
26
33
|
elsif event.result.passed? || event.result.skipped?
|
27
34
|
test_cases.flaky
|
28
35
|
test_cases.decrement_failed
|
29
36
|
end
|
30
37
|
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def register_test_step_finished_listener(event_bus)
|
31
41
|
event_bus.on(:test_step_finished) do |event|
|
32
|
-
event.result.describe_to
|
42
|
+
event.result.describe_to(test_steps) unless event.test_step.hook?
|
33
43
|
end
|
34
|
-
self
|
35
44
|
end
|
36
45
|
end
|
37
46
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'cucumber/core/test/location'
|
3
4
|
require 'cucumber/core/test/result'
|
4
5
|
require 'cucumber/core/test/timer'
|
@@ -8,8 +9,8 @@ module Cucumber
|
|
8
9
|
module Test
|
9
10
|
class Action
|
10
11
|
def initialize(location = nil, &block)
|
11
|
-
raise ArgumentError,
|
12
|
-
@location = location
|
12
|
+
raise ArgumentError, 'Passing a block to execute the action is mandatory.' unless block
|
13
|
+
@location = location || Test::Location.new(*block.source_location)
|
13
14
|
@block = block
|
14
15
|
@timer = Timer.new
|
15
16
|
end
|
@@ -78,7 +79,6 @@ module Cucumber
|
|
78
79
|
Result::Undefined.new
|
79
80
|
end
|
80
81
|
end
|
81
|
-
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Cucumber
|
3
4
|
module Core
|
4
5
|
module Test
|
@@ -16,7 +17,7 @@ module Cucumber
|
|
16
17
|
true
|
17
18
|
end
|
18
19
|
|
19
|
-
def execute(*
|
20
|
+
def execute(*_args, &continue)
|
20
21
|
@timer.start
|
21
22
|
@block.call(continue)
|
22
23
|
Result::Unknown.new # Around hook does not know the result of the inner test steps
|
@@ -27,6 +28,7 @@ module Cucumber
|
|
27
28
|
end
|
28
29
|
|
29
30
|
private
|
31
|
+
|
30
32
|
def failed(exception)
|
31
33
|
Result::Failed.new(@timer.duration, exception)
|
32
34
|
end
|
@@ -7,14 +7,15 @@ module Cucumber
|
|
7
7
|
module Core
|
8
8
|
module Test
|
9
9
|
class Case
|
10
|
-
attr_reader :id, :name, :test_steps, :location, :tags, :language, :around_hooks
|
10
|
+
attr_reader :id, :name, :test_steps, :location, :parent_locations, :tags, :language, :around_hooks
|
11
11
|
|
12
|
-
def initialize(id, name, test_steps, location, tags, language, around_hooks = [])
|
12
|
+
def initialize(id, name, test_steps, location, parent_locations, tags, language, around_hooks = [])
|
13
13
|
raise ArgumentError.new("test_steps should be an Array but is a #{test_steps.class}") unless test_steps.is_a?(Array)
|
14
14
|
@id = id
|
15
15
|
@name = name
|
16
16
|
@test_steps = test_steps
|
17
17
|
@location = location
|
18
|
+
@parent_locations = parent_locations
|
18
19
|
@tags = tags
|
19
20
|
@language = language
|
20
21
|
@around_hooks = around_hooks
|
@@ -36,11 +37,11 @@ module Cucumber
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def with_steps(test_steps)
|
39
|
-
self.class.new(id, name, test_steps, location, tags, language, around_hooks)
|
40
|
+
self.class.new(id, name, test_steps, location, parent_locations, tags, language, around_hooks)
|
40
41
|
end
|
41
42
|
|
42
43
|
def with_around_hooks(around_hooks)
|
43
|
-
self.class.new(id, name, test_steps, location, tags, language, around_hooks)
|
44
|
+
self.class.new(id, name, test_steps, location, parent_locations, tags, language, around_hooks)
|
44
45
|
end
|
45
46
|
|
46
47
|
def match_tags?(*expressions)
|
@@ -61,6 +62,7 @@ module Cucumber
|
|
61
62
|
|
62
63
|
def matching_locations
|
63
64
|
[
|
65
|
+
parent_locations,
|
64
66
|
location,
|
65
67
|
tags.map(&:location),
|
66
68
|
test_steps.map(&:matching_locations)
|
@@ -95,11 +95,9 @@ module Cucumber
|
|
95
95
|
private
|
96
96
|
|
97
97
|
def verify_rows_are_same_length(raw)
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
raise ArgumentError, "Rows must all be the same length"
|
102
|
-
end
|
98
|
+
raw.transpose
|
99
|
+
rescue IndexError
|
100
|
+
raise ArgumentError, 'Rows must all be the same length'
|
103
101
|
end
|
104
102
|
|
105
103
|
def ensure_array_of_array(array)
|
@@ -108,9 +106,8 @@ module Cucumber
|
|
108
106
|
|
109
107
|
def hashes_to_array(hashes)
|
110
108
|
header = hashes[0].keys.sort
|
111
|
-
[header] + hashes.map {|hash| header.map {|key| hash[key]}}
|
109
|
+
[header] + hashes.map { |hash| header.map { |key| hash[key] } }
|
112
110
|
end
|
113
|
-
|
114
111
|
end
|
115
112
|
end
|
116
113
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'delegate'
|
3
4
|
module Cucumber
|
4
5
|
module Core
|
@@ -41,7 +42,7 @@ module Cucumber
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def map
|
44
|
-
raise ArgumentError,
|
45
|
+
raise ArgumentError, 'No block given' unless block_given?
|
45
46
|
new_content = yield content
|
46
47
|
self.class.new(new_content, content_type)
|
47
48
|
end
|
@@ -66,10 +67,10 @@ module Cucumber
|
|
66
67
|
|
67
68
|
def inspect
|
68
69
|
[
|
69
|
-
%
|
70
|
-
%
|
71
|
-
%
|
72
|
-
%
|
70
|
+
%(#<#{self.class}),
|
71
|
+
%( """#{content_type}),
|
72
|
+
%( #{@content}),
|
73
|
+
%( """>)
|
73
74
|
].join("\n")
|
74
75
|
end
|
75
76
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Core
|
3
5
|
module Test
|
4
6
|
module Filters
|
5
|
-
|
6
7
|
# This filter is used for testing Cucumber itself. It adds step definitions
|
7
8
|
# that will activate steps to have passed / failed / pending results
|
8
9
|
# if they use conventional names.
|
@@ -19,7 +20,7 @@ module Cucumber
|
|
19
20
|
when /pending/
|
20
21
|
step.with_action { raise Test::Result::Pending }
|
21
22
|
when /pass/
|
22
|
-
step.with_action {}
|
23
|
+
step.with_action { :no_op }
|
23
24
|
else
|
24
25
|
step
|
25
26
|
end
|
@@ -28,7 +29,6 @@ module Cucumber
|
|
28
29
|
test_case.with_steps(test_steps).describe_to(receiver)
|
29
30
|
end
|
30
31
|
end
|
31
|
-
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'cucumber/core/filter'
|
3
4
|
|
4
5
|
module Cucumber
|
5
6
|
module Core
|
6
7
|
module Test
|
7
|
-
|
8
8
|
# Sorts and filters scenarios based on a list of locations
|
9
9
|
class LocationsFilter < Filter.new(:filter_locations)
|
10
|
-
|
11
10
|
def test_case(test_case)
|
12
11
|
test_cases[test_case.location.file] << test_case
|
13
12
|
self
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'cucumber/core/filter'
|
3
4
|
|
4
5
|
module Cucumber
|
5
6
|
module Core
|
6
7
|
module Test
|
7
8
|
class TagFilter < Filter.new(:filter_expressions)
|
8
|
-
|
9
9
|
def test_case(test_case)
|
10
10
|
test_cases << test_case
|
11
11
|
if test_case.match_tags?(filter_expressions)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'forwardable'
|
3
4
|
require 'cucumber/core/platform'
|
4
5
|
module Cucumber
|
@@ -7,7 +8,6 @@ module Cucumber
|
|
7
8
|
IncompatibleLocations = Class.new(StandardError)
|
8
9
|
|
9
10
|
module Location
|
10
|
-
|
11
11
|
def self.of_caller(additional_depth = 0)
|
12
12
|
from_file_colon_line(*caller[1 + additional_depth])
|
13
13
|
end
|
@@ -30,7 +30,7 @@ module Cucumber
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.new(file, raw_lines=nil)
|
33
|
-
file || raise(ArgumentError,
|
33
|
+
file || raise(ArgumentError, 'file is mandatory')
|
34
34
|
if raw_lines
|
35
35
|
Precise.new(file, Lines.new(raw_lines))
|
36
36
|
else
|
@@ -47,7 +47,7 @@ module Cucumber
|
|
47
47
|
other.file == file
|
48
48
|
end
|
49
49
|
|
50
|
-
def include?(
|
50
|
+
def include?(_lines)
|
51
51
|
true
|
52
52
|
end
|
53
53
|
end
|
@@ -68,7 +68,7 @@ module Cucumber
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def to_s
|
71
|
-
[file, lines.to_s].join(
|
71
|
+
[file, lines.to_s].join(':')
|
72
72
|
end
|
73
73
|
|
74
74
|
def hash
|
@@ -91,7 +91,7 @@ module Cucumber
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def inspect
|
94
|
-
"<#{self.class}: #{
|
94
|
+
"<#{self.class}: #{self}>"
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -128,7 +128,7 @@ module Cucumber
|
|
128
128
|
return first.to_s if data.length == 1
|
129
129
|
return "#{data.min}..#{data.max}" if range?
|
130
130
|
|
131
|
-
data.to_a.join(
|
131
|
+
data.to_a.join(':')
|
132
132
|
end
|
133
133
|
|
134
134
|
def inspect
|
@@ -180,7 +180,6 @@ module Cucumber
|
|
180
180
|
# will be overriden by nodes that actually have a multiline_argument
|
181
181
|
Test::EmptyMultilineArgument.new
|
182
182
|
end
|
183
|
-
|
184
183
|
end
|
185
184
|
end
|
186
185
|
end
|