cucumber-core 10.1.1 → 11.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +203 -284
- data/README.md +0 -1
- data/lib/cucumber/core/test/case.rb +11 -1
- data/lib/cucumber/core/test/data_table.rb +4 -0
- data/lib/cucumber/core/test/doc_string.rb +4 -1
- data/lib/cucumber/core/test/empty_multiline_argument.rb +2 -2
- data/lib/cucumber/core/test/filters/locations_filter.rb +1 -1
- data/lib/cucumber/core/test/location.rb +15 -5
- data/lib/cucumber/core/test/step.rb +4 -0
- metadata +29 -94
- data/lib/cucumber/core/version.rb +0 -10
- data/spec/coverage.rb +0 -12
- data/spec/cucumber/core/compiler_spec.rb +0 -241
- data/spec/cucumber/core/event_bus_spec.rb +0 -163
- data/spec/cucumber/core/event_spec.rb +0 -40
- data/spec/cucumber/core/filter_spec.rb +0 -101
- data/spec/cucumber/core/gherkin/parser_spec.rb +0 -162
- data/spec/cucumber/core/gherkin/writer_spec.rb +0 -332
- data/spec/cucumber/core/report/summary_spec.rb +0 -178
- data/spec/cucumber/core/test/action_spec.rb +0 -153
- data/spec/cucumber/core/test/case_spec.rb +0 -125
- data/spec/cucumber/core/test/data_table_spec.rb +0 -79
- data/spec/cucumber/core/test/doc_string_spec.rb +0 -111
- data/spec/cucumber/core/test/duration_matcher.rb +0 -20
- data/spec/cucumber/core/test/empty_multiline_argument_spec.rb +0 -28
- data/spec/cucumber/core/test/filters/locations_filter_spec.rb +0 -271
- data/spec/cucumber/core/test/location_spec.rb +0 -129
- data/spec/cucumber/core/test/result_spec.rb +0 -504
- data/spec/cucumber/core/test/runner_spec.rb +0 -320
- data/spec/cucumber/core/test/step_spec.rb +0 -88
- data/spec/cucumber/core/test/timer_spec.rb +0 -25
- data/spec/cucumber/core_spec.rb +0 -262
- data/spec/report_api_spy.rb +0 -25
@@ -26,7 +26,7 @@ module Cucumber
|
|
26
26
|
def sorted_test_cases
|
27
27
|
filter_locations.map { |filter_location|
|
28
28
|
test_cases[filter_location.file].select { |test_case|
|
29
|
-
|
29
|
+
test_case.match_locations?([filter_location])
|
30
30
|
}
|
31
31
|
}.flatten.uniq
|
32
32
|
end
|
@@ -22,7 +22,7 @@ module Cucumber
|
|
22
22
|
pwd = File.expand_path(Dir.pwd)
|
23
23
|
pwd.force_encoding(file.encoding)
|
24
24
|
if file.index(pwd)
|
25
|
-
file = file[pwd.length+1..-1]
|
25
|
+
file = file[pwd.length + 1..-1]
|
26
26
|
elsif file =~ /.*\/gems\/(.*\.rb)$/
|
27
27
|
file = $1
|
28
28
|
end
|
@@ -63,6 +63,7 @@ module Cucumber
|
|
63
63
|
|
64
64
|
def match?(other)
|
65
65
|
return false unless other.file == file
|
66
|
+
|
66
67
|
other.include?(lines)
|
67
68
|
end
|
68
69
|
|
@@ -71,13 +72,20 @@ module Cucumber
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def hash
|
74
|
-
self.class
|
75
|
+
[self.class, to_s].hash
|
75
76
|
end
|
76
77
|
|
77
78
|
def to_str
|
78
79
|
to_s
|
79
80
|
end
|
80
81
|
|
82
|
+
def merge(multiline_arg)
|
83
|
+
new_lines = (0..multiline_arg.lines_count).map do |offset|
|
84
|
+
lines.min + offset
|
85
|
+
end
|
86
|
+
Location.new(file, new_lines)
|
87
|
+
end
|
88
|
+
|
81
89
|
def on_line(new_line)
|
82
90
|
Location.new(file, new_line)
|
83
91
|
end
|
@@ -111,19 +119,20 @@ module Cucumber
|
|
111
119
|
other.data.subset?(data) || data.subset?(other.data)
|
112
120
|
end
|
113
121
|
|
114
|
-
def +(
|
115
|
-
new_data = data +
|
122
|
+
def +(other)
|
123
|
+
new_data = data + other.data
|
116
124
|
self.class.new(new_data)
|
117
125
|
end
|
118
126
|
|
119
127
|
def to_s
|
120
128
|
return first.to_s if data.length == 1
|
121
129
|
return "#{data.min}..#{data.max}" if range?
|
130
|
+
|
122
131
|
data.to_a.join(":")
|
123
132
|
end
|
124
133
|
|
125
134
|
def inspect
|
126
|
-
"<#{self.class}: #{
|
135
|
+
"<#{self.class}: #{self}>"
|
127
136
|
end
|
128
137
|
|
129
138
|
protected
|
@@ -149,6 +158,7 @@ module Cucumber
|
|
149
158
|
|
150
159
|
def location
|
151
160
|
raise('Please set @location in the constructor') unless defined?(@location)
|
161
|
+
|
152
162
|
@location
|
153
163
|
end
|
154
164
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 11.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
@@ -12,48 +12,48 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2022-
|
15
|
+
date: 2022-12-23 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: cucumber-gherkin
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "~>"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '22.0'
|
24
21
|
- - ">="
|
25
22
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
23
|
+
version: '24'
|
24
|
+
- - "<"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '27'
|
27
27
|
type: :runtime
|
28
28
|
prerelease: false
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '22.0'
|
34
31
|
- - ">="
|
35
32
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
33
|
+
version: '24'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '27'
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: cucumber-messages
|
39
39
|
requirement: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - "~>"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '17.1'
|
44
41
|
- - ">="
|
45
42
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
43
|
+
version: '19'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '22'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '17.1'
|
54
51
|
- - ">="
|
55
52
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
53
|
+
version: '19'
|
54
|
+
- - "<"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '22'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: cucumber-tag-expressions
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,26 +74,6 @@ dependencies:
|
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 4.1.0
|
77
|
-
- !ruby/object:Gem::Dependency
|
78
|
-
name: coveralls
|
79
|
-
requirement: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - "~>"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0.8'
|
84
|
-
- - ">="
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: 0.8.23
|
87
|
-
type: :development
|
88
|
-
prerelease: false
|
89
|
-
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
requirements:
|
91
|
-
- - "~>"
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0.8'
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.8.23
|
97
77
|
- !ruby/object:Gem::Dependency
|
98
78
|
name: rake
|
99
79
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,40 +100,40 @@ dependencies:
|
|
120
100
|
requirements:
|
121
101
|
- - "~>"
|
122
102
|
- !ruby/object:Gem::Version
|
123
|
-
version: '3.
|
103
|
+
version: '3.11'
|
124
104
|
- - ">="
|
125
105
|
- !ruby/object:Gem::Version
|
126
|
-
version: 3.
|
106
|
+
version: 3.11.0
|
127
107
|
type: :development
|
128
108
|
prerelease: false
|
129
109
|
version_requirements: !ruby/object:Gem::Requirement
|
130
110
|
requirements:
|
131
111
|
- - "~>"
|
132
112
|
- !ruby/object:Gem::Version
|
133
|
-
version: '3.
|
113
|
+
version: '3.11'
|
134
114
|
- - ">="
|
135
115
|
- !ruby/object:Gem::Version
|
136
|
-
version: 3.
|
116
|
+
version: 3.11.0
|
137
117
|
- !ruby/object:Gem::Dependency
|
138
118
|
name: rubocop
|
139
119
|
requirement: !ruby/object:Gem::Requirement
|
140
120
|
requirements:
|
141
121
|
- - "~>"
|
142
122
|
- !ruby/object:Gem::Version
|
143
|
-
version: '1.
|
123
|
+
version: '1.29'
|
144
124
|
- - ">="
|
145
125
|
- !ruby/object:Gem::Version
|
146
|
-
version: 1.
|
126
|
+
version: 1.29.1
|
147
127
|
type: :development
|
148
128
|
prerelease: false
|
149
129
|
version_requirements: !ruby/object:Gem::Requirement
|
150
130
|
requirements:
|
151
131
|
- - "~>"
|
152
132
|
- !ruby/object:Gem::Version
|
153
|
-
version: '1.
|
133
|
+
version: '1.29'
|
154
134
|
- - ">="
|
155
135
|
- !ruby/object:Gem::Version
|
156
|
-
version: 1.
|
136
|
+
version: 1.29.1
|
157
137
|
- !ruby/object:Gem::Dependency
|
158
138
|
name: rubocop-packaging
|
159
139
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,29 +213,6 @@ files:
|
|
233
213
|
- lib/cucumber/core/test/step.rb
|
234
214
|
- lib/cucumber/core/test/tag.rb
|
235
215
|
- lib/cucumber/core/test/timer.rb
|
236
|
-
- lib/cucumber/core/version.rb
|
237
|
-
- spec/coverage.rb
|
238
|
-
- spec/cucumber/core/compiler_spec.rb
|
239
|
-
- spec/cucumber/core/event_bus_spec.rb
|
240
|
-
- spec/cucumber/core/event_spec.rb
|
241
|
-
- spec/cucumber/core/filter_spec.rb
|
242
|
-
- spec/cucumber/core/gherkin/parser_spec.rb
|
243
|
-
- spec/cucumber/core/gherkin/writer_spec.rb
|
244
|
-
- spec/cucumber/core/report/summary_spec.rb
|
245
|
-
- spec/cucumber/core/test/action_spec.rb
|
246
|
-
- spec/cucumber/core/test/case_spec.rb
|
247
|
-
- spec/cucumber/core/test/data_table_spec.rb
|
248
|
-
- spec/cucumber/core/test/doc_string_spec.rb
|
249
|
-
- spec/cucumber/core/test/duration_matcher.rb
|
250
|
-
- spec/cucumber/core/test/empty_multiline_argument_spec.rb
|
251
|
-
- spec/cucumber/core/test/filters/locations_filter_spec.rb
|
252
|
-
- spec/cucumber/core/test/location_spec.rb
|
253
|
-
- spec/cucumber/core/test/result_spec.rb
|
254
|
-
- spec/cucumber/core/test/runner_spec.rb
|
255
|
-
- spec/cucumber/core/test/step_spec.rb
|
256
|
-
- spec/cucumber/core/test/timer_spec.rb
|
257
|
-
- spec/cucumber/core_spec.rb
|
258
|
-
- spec/report_api_spy.rb
|
259
216
|
homepage: https://cucumber.io
|
260
217
|
licenses:
|
261
218
|
- MIT
|
@@ -281,30 +238,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
238
|
- !ruby/object:Gem::Version
|
282
239
|
version: '0'
|
283
240
|
requirements: []
|
284
|
-
rubygems_version: 3.
|
241
|
+
rubygems_version: 3.3.5
|
285
242
|
signing_key:
|
286
243
|
specification_version: 4
|
287
|
-
summary: cucumber-core-
|
288
|
-
test_files:
|
289
|
-
- spec/cucumber/core/compiler_spec.rb
|
290
|
-
- spec/cucumber/core/filter_spec.rb
|
291
|
-
- spec/cucumber/core/test/data_table_spec.rb
|
292
|
-
- spec/cucumber/core/test/timer_spec.rb
|
293
|
-
- spec/cucumber/core/test/filters/locations_filter_spec.rb
|
294
|
-
- spec/cucumber/core/test/doc_string_spec.rb
|
295
|
-
- spec/cucumber/core/test/step_spec.rb
|
296
|
-
- spec/cucumber/core/test/runner_spec.rb
|
297
|
-
- spec/cucumber/core/test/result_spec.rb
|
298
|
-
- spec/cucumber/core/test/location_spec.rb
|
299
|
-
- spec/cucumber/core/test/empty_multiline_argument_spec.rb
|
300
|
-
- spec/cucumber/core/test/duration_matcher.rb
|
301
|
-
- spec/cucumber/core/test/case_spec.rb
|
302
|
-
- spec/cucumber/core/test/action_spec.rb
|
303
|
-
- spec/cucumber/core/report/summary_spec.rb
|
304
|
-
- spec/cucumber/core/event_spec.rb
|
305
|
-
- spec/cucumber/core/gherkin/writer_spec.rb
|
306
|
-
- spec/cucumber/core/gherkin/parser_spec.rb
|
307
|
-
- spec/cucumber/core/event_bus_spec.rb
|
308
|
-
- spec/cucumber/core_spec.rb
|
309
|
-
- spec/report_api_spy.rb
|
310
|
-
- spec/coverage.rb
|
244
|
+
summary: cucumber-core-11.1.0
|
245
|
+
test_files: []
|
data/spec/coverage.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'rubygems'
|
3
|
-
require 'simplecov'
|
4
|
-
formatters = [ SimpleCov::Formatter::HTMLFormatter ]
|
5
|
-
|
6
|
-
if ENV['TRAVIS']
|
7
|
-
require 'coveralls'
|
8
|
-
formatters << Coveralls::SimpleCov::Formatter
|
9
|
-
end
|
10
|
-
|
11
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(formatters)
|
12
|
-
SimpleCov.start
|
@@ -1,241 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'cucumber/core'
|
3
|
-
require 'cucumber/core/compiler'
|
4
|
-
require 'cucumber/core/gherkin/writer'
|
5
|
-
|
6
|
-
module Cucumber::Core
|
7
|
-
describe Compiler do
|
8
|
-
include Gherkin::Writer
|
9
|
-
include Cucumber::Core
|
10
|
-
|
11
|
-
def self.stubs(*names)
|
12
|
-
names.each do |name|
|
13
|
-
let(name) { double(name.to_s) }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it "compiles a feature with a single scenario" do
|
18
|
-
gherkin_documents = [
|
19
|
-
gherkin do
|
20
|
-
feature do
|
21
|
-
scenario do
|
22
|
-
step 'passing'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
]
|
27
|
-
compile(gherkin_documents) do |visitor|
|
28
|
-
expect( visitor ).to receive(:test_case).once.ordered.and_yield(visitor)
|
29
|
-
expect( visitor ).to receive(:test_step).once.ordered
|
30
|
-
expect( visitor ).to receive(:done).once.ordered
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context "when the event_bus is provided" do
|
35
|
-
let(:event_bus) { double }
|
36
|
-
|
37
|
-
before do
|
38
|
-
allow( event_bus ).to receive(:envelope)
|
39
|
-
allow( event_bus ).to receive(:gherkin_source_parsed).and_return(nil)
|
40
|
-
allow( event_bus ).to receive(:test_case_created).and_return(nil)
|
41
|
-
allow( event_bus ).to receive(:test_step_created).and_return(nil)
|
42
|
-
end
|
43
|
-
|
44
|
-
it "emits a TestCaseCreated event with the created Test::Case and Pickle" do
|
45
|
-
gherkin_documents = [
|
46
|
-
gherkin do
|
47
|
-
feature do
|
48
|
-
scenario do
|
49
|
-
step 'passing'
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
]
|
54
|
-
|
55
|
-
compile(gherkin_documents, event_bus) do |visitor|
|
56
|
-
allow( visitor ).to receive(:test_case)
|
57
|
-
allow( visitor ).to receive(:test_step)
|
58
|
-
allow( visitor ).to receive(:done)
|
59
|
-
allow( event_bus ).to receive(:envelope)
|
60
|
-
|
61
|
-
expect( event_bus ).to receive(:test_case_created).once
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
it "emits a TestStepCreated event with the created Test::Step and PickleStep" do
|
66
|
-
gherkin_documents = [
|
67
|
-
gherkin do
|
68
|
-
feature do
|
69
|
-
scenario do
|
70
|
-
step 'passing'
|
71
|
-
step 'passing'
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
]
|
76
|
-
|
77
|
-
compile(gherkin_documents, event_bus) do |visitor|
|
78
|
-
allow( visitor ).to receive(:test_case)
|
79
|
-
allow( visitor ).to receive(:test_step)
|
80
|
-
allow( visitor ).to receive(:done)
|
81
|
-
allow( event_bus ).to receive(:envelope)
|
82
|
-
|
83
|
-
expect( event_bus ).to receive(:test_step_created).twice
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
it "compiles a feature with a background" do
|
89
|
-
gherkin_documents = [
|
90
|
-
gherkin do
|
91
|
-
feature do
|
92
|
-
background do
|
93
|
-
step 'passing'
|
94
|
-
end
|
95
|
-
|
96
|
-
scenario do
|
97
|
-
step 'passing'
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
]
|
102
|
-
compile(gherkin_documents) do |visitor|
|
103
|
-
expect( visitor ).to receive(:test_case).once.ordered.and_yield(visitor)
|
104
|
-
expect( visitor ).to receive(:test_step).exactly(2).times.ordered
|
105
|
-
expect( visitor ).to receive(:done).once.ordered
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
it "compiles multiple features" do
|
110
|
-
gherkin_documents = [
|
111
|
-
gherkin do
|
112
|
-
feature do
|
113
|
-
background do
|
114
|
-
step 'passing'
|
115
|
-
end
|
116
|
-
scenario do
|
117
|
-
step 'passing'
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end,
|
121
|
-
gherkin do
|
122
|
-
feature do
|
123
|
-
background do
|
124
|
-
step 'passing'
|
125
|
-
end
|
126
|
-
scenario do
|
127
|
-
step 'passing'
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
]
|
132
|
-
compile(gherkin_documents) do |visitor|
|
133
|
-
expect( visitor ).to receive(:test_case).once.ordered
|
134
|
-
expect( visitor ).to receive(:test_step).twice.ordered
|
135
|
-
expect( visitor ).to receive(:test_case).once.ordered
|
136
|
-
expect( visitor ).to receive(:test_step).twice.ordered
|
137
|
-
expect( visitor ).to receive(:done).once
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
context "compiling scenario outlines" do
|
142
|
-
it "compiles a scenario outline to test cases" do
|
143
|
-
gherkin_documents = [
|
144
|
-
gherkin do
|
145
|
-
feature do
|
146
|
-
background do
|
147
|
-
step 'passing'
|
148
|
-
end
|
149
|
-
|
150
|
-
scenario_outline do
|
151
|
-
step 'passing <arg>'
|
152
|
-
step 'passing'
|
153
|
-
|
154
|
-
examples 'examples 1' do
|
155
|
-
row 'arg'
|
156
|
-
row '1'
|
157
|
-
row '2'
|
158
|
-
end
|
159
|
-
|
160
|
-
examples 'examples 2' do
|
161
|
-
row 'arg'
|
162
|
-
row 'a'
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
]
|
168
|
-
compile(gherkin_documents) do |visitor|
|
169
|
-
expect( visitor ).to receive(:test_case).exactly(3).times.and_yield(visitor)
|
170
|
-
expect( visitor ).to receive(:test_step).exactly(9).times
|
171
|
-
expect( visitor ).to receive(:done).once
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'replaces arguments correctly when generating test steps' do
|
176
|
-
gherkin_documents = [
|
177
|
-
gherkin do
|
178
|
-
feature do
|
179
|
-
scenario_outline do
|
180
|
-
step 'passing <arg1> with <arg2>'
|
181
|
-
step 'as well as <arg3>'
|
182
|
-
|
183
|
-
examples do
|
184
|
-
row 'arg1', 'arg2', 'arg3'
|
185
|
-
row '1', '2', '3'
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
|
-
]
|
191
|
-
|
192
|
-
compile(gherkin_documents) do |visitor|
|
193
|
-
expect( visitor ).to receive(:test_step) do |test_step|
|
194
|
-
expect(test_step.text).to eq 'passing 1 with 2'
|
195
|
-
end.once.ordered
|
196
|
-
|
197
|
-
expect( visitor ).to receive(:test_step) do |test_step|
|
198
|
-
expect(test_step.text).to eq 'as well as 3'
|
199
|
-
end.once.ordered
|
200
|
-
|
201
|
-
expect( visitor ).to receive(:done).once.ordered
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
context 'empty scenarios' do
|
207
|
-
it 'does create test cases for them' do
|
208
|
-
gherkin_documents = [
|
209
|
-
gherkin do
|
210
|
-
feature do
|
211
|
-
scenario do
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
]
|
216
|
-
compile(gherkin_documents) do |visitor|
|
217
|
-
expect( visitor ).to receive(:test_case).once.ordered
|
218
|
-
expect( visitor ).to receive(:done).once.ordered
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
def compile(gherkin_documents, event_bus = nil)
|
224
|
-
visitor = double
|
225
|
-
allow( visitor ).to receive(:test_suite).and_yield(visitor)
|
226
|
-
allow( visitor ).to receive(:test_case).and_yield(visitor)
|
227
|
-
|
228
|
-
if event_bus.nil?
|
229
|
-
event_bus = double
|
230
|
-
allow( event_bus ).to receive(:envelope).and_return(nil)
|
231
|
-
allow( event_bus ).to receive(:gherkin_source_parsed).and_return(nil)
|
232
|
-
allow( event_bus ).to receive(:test_case_created).and_return(nil)
|
233
|
-
allow( event_bus ).to receive(:test_step_created).and_return(nil)
|
234
|
-
allow( event_bus ).to receive(:envelope).and_return(nil)
|
235
|
-
end
|
236
|
-
|
237
|
-
yield visitor
|
238
|
-
super(gherkin_documents, visitor, [], event_bus)
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|