@@ -56,20 +56,19 @@ def write_file(feature_filename, data)
56
56
end
57
57
58
58
define_steps do
59
- Given ( / a passing scenario/ ) do
59
+ Given ( ' a passing scenario' ) do
60
60
Kernel . puts 'foo'
61
61
end
62
62
end
63
63
64
- define_feature <<- FEATURE
65
- Feature: One passing feature
64
+ define_feature <<~ FEATURE
65
+ Feature: One passing feature
66
66
67
- Scenario: Passing
68
- Given a passing scenario
67
+ Scenario: Passing
68
+ Given a passing scenario
69
69
FEATURE
70
70
71
71
it 'will contain the file attribute' do
72
- expect ( @doc . xpath ( '//testsuite/testcase/@file' ) . size ) . to equal 1
73
72
expect ( @doc . xpath ( '//testsuite/testcase/@file' ) . first . value ) . to eq ( 'spec.feature' )
74
73
end
75
74
end
@@ -93,20 +92,20 @@ def write_file(feature_filename, data)
93
92
end
94
93
95
94
define_steps do
96
- Given ( / a passing scenario/ ) do
95
+ Given ( ' a passing scenario' ) do
97
96
Kernel . puts 'foo'
98
97
end
99
98
end
100
99
101
- define_feature <<- FEATURE
102
- Feature: One passing feature
100
+ define_feature <<~ FEATURE
101
+ Feature: One passing feature
103
102
104
- Scenario: Passing
105
- Given a passing scenario
103
+ Scenario: Passing
104
+ Given a passing scenario
106
105
FEATURE
107
106
108
107
it 'will not contain the file attribute' do
109
- expect ( @doc . xpath ( '//testsuite/testcase/@file' ) . size ) . to equal 0
108
+ expect ( @doc . xpath ( '//testsuite/testcase/@file' ) ) . to be_empty
110
109
end
111
110
end
112
111
end
@@ -124,20 +123,20 @@ def write_file(feature_filename, data)
124
123
end
125
124
126
125
define_steps do
127
- Given ( / a passing scenario/ ) do
126
+ Given ( ' a passing scenario' ) do
128
127
Kernel . puts 'foo'
129
128
end
130
129
end
131
130
132
- define_feature <<- FEATURE
133
- Feature: One passing scenario
131
+ define_feature <<~ FEATURE
132
+ Feature: One passing feature
134
133
135
- Scenario: Passing
136
- Given a passing scenario
134
+ Scenario: Passing
135
+ Given a passing scenario
137
136
FEATURE
138
137
139
138
it 'will not contain the file attribute' do
140
- expect ( @doc . xpath ( '//testsuite/testcase/@file' ) . size ) . to equal 0
139
+ expect ( @doc . xpath ( '//testsuite/testcase/@file' ) ) . to be_empty
141
140
end
142
141
end
143
142
end
@@ -155,23 +154,23 @@ def write_file(feature_filename, data)
155
154
end
156
155
157
156
define_steps do
158
- Given ( / a passing ctrl scenario/ ) do
157
+ Given ( ' a passing ctrl scenario' ) do
159
158
Kernel . puts "boo\b \c x\e \a \f boo "
160
159
end
161
160
end
162
161
163
- define_feature <<- FEATURE
164
- Feature: One passing scenario, one failing scenario
162
+ define_feature <<~ FEATURE
163
+ Feature: One passing scenario, one failing scenario
165
164
166
- Scenario: Passing
167
- Given a passing ctrl scenario
165
+ Scenario: Passing
166
+ Given a passing ctrl scenario
168
167
FEATURE
169
168
170
169
it { expect ( @doc . xpath ( '//testsuite/testcase/system-out' ) . first . content ) . to match ( /\s +boo boo\s +/ ) }
171
170
end
172
171
173
172
describe 'a feature with no name' do
174
- define_feature <<- FEATURE
173
+ define_feature <<~ FEATURE
175
174
Feature:
176
175
Scenario: Passing
177
176
Given a passing scenario
@@ -189,7 +188,7 @@ def write_file(feature_filename, data)
189
188
end
190
189
191
190
describe 'with a single scenario' do
192
- define_feature <<- FEATURE
191
+ define_feature <<~ FEATURE
193
192
Feature: One passing scenario, one failing scenario
194
193
195
194
Scenario: Passing
@@ -199,19 +198,19 @@ def write_file(feature_filename, data)
199
198
it { expect ( @doc . to_s ) . to match ( /One passing scenario, one failing scenario/ ) }
200
199
201
200
it 'has not a root system-out node' do
202
- expect ( @doc . xpath ( '//testsuite/system-out' ) . size ) . to eq 0
201
+ expect ( @doc . xpath ( '//testsuite/system-out' ) ) . to be_empty
203
202
end
204
203
205
204
it 'has not a root system-err node' do
206
- expect ( @doc . xpath ( '//testsuite/system-err' ) . size ) . to eq 0
205
+ expect ( @doc . xpath ( '//testsuite/system-err' ) ) . to be_empty
207
206
end
208
207
209
208
it 'has a system-out node under <testcase/>' do
210
- expect ( @doc . xpath ( '//testcase/system-out' ) . size ) . to eq 1
209
+ expect ( @doc . xpath ( '//testcase/system-out' ) . length ) . to eq ( 1 )
211
210
end
212
211
213
212
it 'has a system-err node under <testcase/>' do
214
- expect ( @doc . xpath ( '//testcase/system-err' ) . size ) . to eq 1
213
+ expect ( @doc . xpath ( '//testcase/system-err' ) . length ) . to eq ( 1 )
215
214
end
216
215
end
217
216
@@ -224,44 +223,45 @@ def write_file(feature_filename, data)
224
223
) , File . join ( 'features' , 'some' , 'path' , 'spec.feature' )
225
224
226
225
it 'writes the filename with absolute path' do
227
- expect ( @formatter . written_files . keys . first ) . to eq File . absolute_path ( 'TEST-features-some-path-spec.xml' )
226
+ expect ( @formatter . written_files . keys . first ) . to eq ( File . absolute_path ( 'TEST-features-some-path-spec.xml' ) )
228
227
end
229
228
end
230
229
231
230
describe 'with a scenario outline table' do
232
231
define_steps do
233
- Given ( /.*/ ) { }
232
+ Given ( '{word}' ) { }
234
233
end
235
234
236
- define_feature <<- FEATURE
235
+ define_feature <<~ FEATURE
237
236
Feature: Eat things when hungry
238
237
239
- Scenario Outline: Eat things
240
- Given <Things >
238
+ Scenario Outline: Eat variety of things
239
+ Given <things >
241
240
And stuff:
242
241
| foo |
243
242
| bar |
244
243
245
244
Examples: Good
246
- | Things |
245
+ | things |
247
246
| Cucumber |
248
- | Whisky |
247
+
249
248
Examples: Evil
250
- | Things |
251
- | Big Mac |
249
+ | things |
250
+ | Burger |
251
+ | Whisky |
252
252
FEATURE
253
253
254
254
it { expect ( @doc . to_s ) . to match ( /Eat things when hungry/ ) }
255
255
it { expect ( @doc . to_s ) . to match ( /Cucumber/ ) }
256
+ it { expect ( @doc . to_s ) . to match ( /Burger/ ) }
256
257
it { expect ( @doc . to_s ) . to match ( /Whisky/ ) }
257
- it { expect ( @doc . to_s ) . to match ( /Big Mac/ ) }
258
- it { expect ( @doc . to_s ) . not_to match ( /Things/ ) }
258
+ it { expect ( @doc . to_s ) . not_to match ( /Cake/ ) }
259
259
it { expect ( @doc . to_s ) . not_to match ( /Good|Evil/ ) }
260
260
it { expect ( @doc . to_s ) . not_to match ( /type="skipped"/ ) }
261
261
end
262
262
263
263
describe 'scenario with skipped test in junit report' do
264
- define_feature <<- FEATURE
264
+ define_feature <<~ FEATURE
265
265
Feature: junit report with skipped test
266
266
267
267
Scenario Outline: skip a test and junit report of the same
@@ -283,7 +283,7 @@ def write_file(feature_filename, data)
283
283
Then ( /I should have visited at least/ ) { |table | }
284
284
end
285
285
286
- define_feature <<- FEATURE
286
+ define_feature <<~ FEATURE
287
287
Feature: Shortlist
288
288
289
289
Scenario: Procure items
@@ -306,14 +306,15 @@ def write_file(feature_filename, data)
306
306
Before do
307
307
raise 'Before hook failed'
308
308
end
309
- Given ( / a passing step/ ) do
309
+ Given ( ' a passing step' ) do
310
310
end
311
311
end
312
- define_feature <<-FEATURE
313
- Feature: One passing scenario
314
312
315
- Scenario: Passing
316
- Given a passing step
313
+ define_feature <<~FEATURE
314
+ Feature: One passing scenario
315
+
316
+ Scenario: Passing
317
+ Given a passing step
317
318
FEATURE
318
319
319
320
it { expect ( @doc . to_s ) . to match ( /Before hook at spec\/ cucumber\/ formatter\/ junit_spec.rb:(\d +)/ ) }
@@ -324,14 +325,14 @@ def write_file(feature_filename, data)
324
325
After do
325
326
raise 'After hook failed'
326
327
end
327
- Given ( / a passing step/ ) do
328
+ Given ( ' a passing step' ) do
328
329
end
329
330
end
330
- define_feature <<- FEATURE
331
- Feature: One passing scenario
331
+ define_feature <<~ FEATURE
332
+ Feature: One passing scenario
332
333
333
- Scenario: Passing
334
- Given a passing step
334
+ Scenario: Passing
335
+ Given a passing step
335
336
FEATURE
336
337
337
338
it { expect ( @doc . to_s ) . to match ( /After hook at spec\/ cucumber\/ formatter\/ junit_spec.rb:(\d +)/ ) }
@@ -342,14 +343,14 @@ def write_file(feature_filename, data)
342
343
AfterStep do
343
344
raise 'AfterStep hook failed'
344
345
end
345
- Given ( / a passing step/ ) do
346
+ Given ( ' a passing step' ) do
346
347
end
347
348
end
348
- define_feature <<- FEATURE
349
- Feature: One passing scenario
349
+ define_feature <<~ FEATURE
350
+ Feature: One passing scenario
350
351
351
- Scenario: Passing
352
- Given a passing step
352
+ Scenario: Passing
353
+ Given a passing step
353
354
FEATURE
354
355
355
356
it { expect ( @doc . to_s ) . to match ( /AfterStep hook at spec\/ cucumber\/ formatter\/ junit_spec.rb:(\d +)/ ) }
@@ -361,14 +362,14 @@ def write_file(feature_filename, data)
361
362
block . call
362
363
raise 'Around hook failed'
363
364
end
364
- Given ( / a passing step/ ) do
365
+ Given ( ' a passing step' ) do
365
366
end
366
367
end
367
- define_feature <<- FEATURE
368
- Feature: One passing scenario
368
+ define_feature <<~ FEATURE
369
+ Feature: One passing scenario
369
370
370
- Scenario: Passing
371
- Given a passing step
371
+ Scenario: Passing
372
+ Given a passing step
372
373
FEATURE
373
374
374
375
it { expect ( @doc . to_s ) . to match ( /Around hook\n \n Message:/ ) }
@@ -393,31 +394,32 @@ def write_file(feature_filename, data)
393
394
394
395
describe 'with a scenario outline table' do
395
396
define_steps do
396
- Given ( /.*/ ) { }
397
+ Given ( '{word}' ) { }
397
398
end
398
399
399
- define_feature <<- FEATURE
400
+ define_feature <<~ FEATURE
400
401
Feature: Eat things when hungry
401
402
402
403
Scenario Outline: Eat things
403
- Given <Things >
404
+ Given <things >
404
405
And stuff:
405
406
| foo |
406
407
| bar |
407
408
408
409
Examples: Good
409
- | Things |
410
+ | things |
410
411
| Cucumber |
411
- | Whisky |
412
+
412
413
Examples: Evil
413
- | Things |
414
- | Big Mac |
414
+ | things |
415
+ | Burger |
416
+ | Whisky |
415
417
FEATURE
416
418
417
419
it { expect ( @doc . to_s ) . to match ( /Eat things when hungry/ ) }
418
420
it { expect ( @doc . to_s ) . to match ( /Cucumber/ ) }
419
421
it { expect ( @doc . to_s ) . to match ( /Whisky/ ) }
420
- it { expect ( @doc . to_s ) . to match ( /Big Mac / ) }
422
+ it { expect ( @doc . to_s ) . to match ( /Burger / ) }
421
423
it { expect ( @doc . to_s ) . not_to match ( /Things/ ) }
422
424
it { expect ( @doc . to_s ) . not_to match ( /Good|Evil/ ) }
423
425
it { expect ( @doc . to_s ) . not_to match ( /type="skipped"/ ) }
0 commit comments