cuke_modeler 1.0.4 → 1.1.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/History.md +12 -0
- data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +5 -5
- data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +8 -5
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +8 -5
- data/lib/cuke_modeler/containing.rb +12 -7
- data/lib/cuke_modeler/models/background.rb +7 -2
- data/lib/cuke_modeler/models/cell.rb +2 -1
- data/lib/cuke_modeler/models/doc_string.rb +2 -1
- data/lib/cuke_modeler/models/example.rb +8 -4
- data/lib/cuke_modeler/models/feature.rb +4 -1
- data/lib/cuke_modeler/models/outline.rb +6 -2
- data/lib/cuke_modeler/models/row.rb +2 -1
- data/lib/cuke_modeler/models/scenario.rb +7 -2
- data/lib/cuke_modeler/models/step.rb +2 -1
- data/lib/cuke_modeler/models/table.rb +2 -1
- data/lib/cuke_modeler/models/tag.rb +2 -1
- data/lib/cuke_modeler/parsing.rb +45 -0
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/features/modeling/background_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/background_output.feature +6 -1
- data/testing/cucumber/features/modeling/directory_output.feature +6 -1
- data/testing/cucumber/features/modeling/doc_string_output.feature +6 -1
- data/testing/cucumber/features/modeling/example_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/example_output.feature +6 -1
- data/testing/cucumber/features/modeling/feature_file_output.feature +6 -1
- data/testing/cucumber/features/modeling/feature_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/feature_output.feature +6 -1
- data/testing/cucumber/features/modeling/model_output.feature +1 -8
- data/testing/cucumber/features/modeling/outline_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/outline_output.feature +6 -1
- data/testing/cucumber/features/modeling/row_output.feature +6 -1
- data/testing/cucumber/features/modeling/scenario_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/scenario_output.feature +6 -1
- data/testing/cucumber/features/modeling/step_output.feature +6 -1
- data/testing/cucumber/features/modeling/table_output.feature +6 -1
- data/testing/cucumber/features/modeling/tag_output.feature +6 -1
- data/testing/cucumber/step_definitions/verification_steps.rb +21 -12
- data/testing/dialect_helper.rb +48 -0
- data/testing/rspec/spec/integration/background_integration_spec.rb +93 -88
- data/testing/rspec/spec/integration/cell_integration_spec.rb +26 -27
- data/testing/rspec/spec/integration/directory_integration_spec.rb +4 -4
- data/testing/rspec/spec/integration/doc_string_integration_spec.rb +38 -39
- data/testing/rspec/spec/integration/example_integration_spec.rb +97 -95
- data/testing/rspec/spec/integration/feature_file_integration_spec.rb +5 -5
- data/testing/rspec/spec/integration/feature_integration_spec.rb +157 -155
- data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +17 -17
- data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +17 -17
- data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +17 -17
- data/testing/rspec/spec/integration/outline_integration_spec.rb +359 -354
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +30 -2
- data/testing/rspec/spec/integration/row_integration_spec.rb +23 -25
- data/testing/rspec/spec/integration/scenario_integration_spec.rb +238 -235
- data/testing/rspec/spec/integration/step_integration_spec.rb +69 -64
- data/testing/rspec/spec/integration/table_integration_spec.rb +32 -36
- data/testing/rspec/spec/integration/tag_integration_spec.rb +26 -27
- data/testing/rspec/spec/spec_helper.rb +43 -0
- data/testing/rspec/spec/unit/background_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/example_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/feature_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/outline_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/parsing_unit_spec.rb +33 -0
- data/testing/rspec/spec/unit/scenario_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +58 -0
- data/testing/rspec/spec/unit/step_unit_spec.rb +1 -23
- data/testing/test_languages.json +45 -0
- data/todo.txt +1 -1
- metadata +6 -3
@@ -0,0 +1,48 @@
|
|
1
|
+
module CukeModeler
|
2
|
+
module DialectHelper
|
3
|
+
|
4
|
+
def self.set_dialect(dialect)
|
5
|
+
@dialect = dialect
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.feature_keyword
|
9
|
+
get_word(@dialect['feature'])
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.background_keyword
|
13
|
+
get_word(@dialect['background'])
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.scenario_keyword
|
17
|
+
get_word(@dialect['scenario'])
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.outline_keyword
|
21
|
+
get_word(@dialect['scenarioOutline'] || @dialect['scenario_outline'])
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.example_keyword
|
25
|
+
get_word(@dialect['examples'])
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.step_keyword
|
29
|
+
get_word(@dialect['given']).strip
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.given_keyword
|
33
|
+
get_word(@dialect['given']).strip
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.then_keyword
|
37
|
+
get_word(@dialect['then']).strip
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.get_word(word_set)
|
41
|
+
word_set.is_a?(Array) ? word_set.first : word_set.split('|').first
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
private_class_method :get_word
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -15,13 +15,13 @@ describe 'Background, Integration' do
|
|
15
15
|
describe 'unique behavior' do
|
16
16
|
|
17
17
|
it 'can be instantiated with the minimum viable Gherkin' do
|
18
|
-
source =
|
18
|
+
source = "#{@background_keyword}:"
|
19
19
|
|
20
20
|
expect { clazz.new(source) }.to_not raise_error
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
24
|
-
background = clazz.new("
|
24
|
+
background = clazz.new("#{@background_keyword}: test background\ndescription\n#{@step_keyword} a step")
|
25
25
|
data = background.parsing_data
|
26
26
|
|
27
27
|
expect(data.keys).to match_array([:type, :location, :keyword, :name, :steps, :description])
|
@@ -29,7 +29,7 @@ describe 'Background, Integration' do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
32
|
-
background = clazz.new("
|
32
|
+
background = clazz.new("#{@background_keyword}: test background\ndescription\n#{@step_keyword} a step")
|
33
33
|
data = background.parsing_data
|
34
34
|
|
35
35
|
expect(data.keys).to match_array([:type, :location, :keyword, :name, :steps, :description])
|
@@ -37,7 +37,7 @@ describe 'Background, Integration' do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
40
|
-
background = clazz.new("
|
40
|
+
background = clazz.new("#{@background_keyword}: test background\ndescription\n#{@step_keyword} a step")
|
41
41
|
data = background.parsing_data
|
42
42
|
|
43
43
|
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'steps', 'type'])
|
@@ -45,15 +45,14 @@ describe 'Background, Integration' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'provides a descriptive filename when being parsed from stand alone text' do
|
48
|
-
source = "bad background text \n
|
48
|
+
source = "bad background text \n #{@background_keyword}:\n #{@step_keyword} a step\n @foo "
|
49
49
|
|
50
50
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_background\.feature'/)
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'properly sets its child models' do
|
54
|
-
source =
|
55
|
-
|
56
|
-
source = source.join("\n")
|
54
|
+
source = "#{@background_keyword}: Test background
|
55
|
+
#{@step_keyword} a step"
|
57
56
|
|
58
57
|
background = clazz.new(source)
|
59
58
|
step = background.steps.first
|
@@ -62,7 +61,7 @@ describe 'Background, Integration' do
|
|
62
61
|
end
|
63
62
|
|
64
63
|
it 'trims whitespace from its source description' do
|
65
|
-
source = [
|
64
|
+
source = ["#{@background_keyword}:",
|
66
65
|
' ',
|
67
66
|
' description line 1',
|
68
67
|
'',
|
@@ -71,11 +70,11 @@ describe 'Background, Integration' do
|
|
71
70
|
'',
|
72
71
|
'',
|
73
72
|
'',
|
74
|
-
|
73
|
+
" #{@step_keyword} a step"]
|
75
74
|
source = source.join("\n")
|
76
75
|
|
77
76
|
background = clazz.new(source)
|
78
|
-
description = background.description.split("\n")
|
77
|
+
description = background.description.split("\n", -1)
|
79
78
|
|
80
79
|
expect(description).to eq([' description line 1',
|
81
80
|
'',
|
@@ -87,11 +86,10 @@ describe 'Background, Integration' do
|
|
87
86
|
describe 'getting ancestors' do
|
88
87
|
|
89
88
|
before(:each) do
|
90
|
-
source =
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
source = source.join("\n")
|
89
|
+
source = "#{@feature_keyword}: Test feature
|
90
|
+
|
91
|
+
#{@background_keyword}: Test background
|
92
|
+
#{@step_keyword} a step"
|
95
93
|
|
96
94
|
file_path = "#{@default_file_directory}/background_test_file.feature"
|
97
95
|
File.open(file_path, 'w') { |file| file.write(source) }
|
@@ -132,11 +130,19 @@ describe 'Background, Integration' do
|
|
132
130
|
|
133
131
|
context 'from source text' do
|
134
132
|
|
133
|
+
let(:source_text) { "#{@background_keyword}:" }
|
134
|
+
let(:background) { clazz.new(source_text) }
|
135
|
+
|
136
|
+
|
137
|
+
it "models the background's keyword" do
|
138
|
+
expect(background.keyword).to eq("#{@background_keyword}")
|
139
|
+
end
|
140
|
+
|
135
141
|
it "models the background's source line" do
|
136
|
-
source_text = "
|
142
|
+
source_text = "#{@feature_keyword}:
|
137
143
|
|
138
|
-
|
139
|
-
|
144
|
+
#{@background_keyword}: foo
|
145
|
+
#{@step_keyword} step"
|
140
146
|
background = CukeModeler::Feature.new(source_text).background
|
141
147
|
|
142
148
|
expect(background.source_line).to eq(3)
|
@@ -144,15 +150,15 @@ describe 'Background, Integration' do
|
|
144
150
|
|
145
151
|
context 'a filled background' do
|
146
152
|
|
147
|
-
let(:source_text) { "
|
153
|
+
let(:source_text) { "#{@background_keyword}: Background name
|
148
154
|
|
149
155
|
Background description.
|
150
156
|
|
151
157
|
Some more.
|
152
158
|
Even more.
|
153
159
|
|
154
|
-
|
155
|
-
|
160
|
+
#{@step_keyword} a step
|
161
|
+
#{@step_keyword} another step" }
|
156
162
|
let(:background) { clazz.new(source_text) }
|
157
163
|
|
158
164
|
|
@@ -161,7 +167,7 @@ describe 'Background, Integration' do
|
|
161
167
|
end
|
162
168
|
|
163
169
|
it "models the background's description" do
|
164
|
-
description = background.description.split("\n")
|
170
|
+
description = background.description.split("\n", -1)
|
165
171
|
|
166
172
|
expect(description).to eq([' Background description.',
|
167
173
|
'',
|
@@ -179,7 +185,7 @@ describe 'Background, Integration' do
|
|
179
185
|
|
180
186
|
context 'an empty background' do
|
181
187
|
|
182
|
-
let(:source_text) {
|
188
|
+
let(:source_text) { "#{@background_keyword}:" }
|
183
189
|
let(:background) { clazz.new(source_text) }
|
184
190
|
|
185
191
|
|
@@ -205,19 +211,19 @@ describe 'Background, Integration' do
|
|
205
211
|
describe 'comparison' do
|
206
212
|
|
207
213
|
it 'is equal to a background with the same steps' do
|
208
|
-
source = "
|
209
|
-
|
210
|
-
|
214
|
+
source = "#{@background_keyword}:
|
215
|
+
#{@step_keyword} step 1
|
216
|
+
#{@step_keyword} step 2"
|
211
217
|
background_1 = clazz.new(source)
|
212
218
|
|
213
|
-
source = "
|
214
|
-
|
215
|
-
|
219
|
+
source = "#{@background_keyword}:
|
220
|
+
#{@step_keyword} step 1
|
221
|
+
#{@step_keyword} step 2"
|
216
222
|
background_2 = clazz.new(source)
|
217
223
|
|
218
|
-
source = "
|
219
|
-
|
220
|
-
|
224
|
+
source = "#{@background_keyword}:
|
225
|
+
#{@step_keyword} step 2
|
226
|
+
#{@step_keyword} step 1"
|
221
227
|
background_3 = clazz.new(source)
|
222
228
|
|
223
229
|
|
@@ -226,19 +232,19 @@ describe 'Background, Integration' do
|
|
226
232
|
end
|
227
233
|
|
228
234
|
it 'is equal to a scenario with the same steps' do
|
229
|
-
source = "
|
230
|
-
|
231
|
-
|
235
|
+
source = "#{@background_keyword}:
|
236
|
+
#{@step_keyword} step 1
|
237
|
+
#{@step_keyword} step 2"
|
232
238
|
background = clazz.new(source)
|
233
239
|
|
234
|
-
source = "
|
235
|
-
|
236
|
-
|
240
|
+
source = "#{@scenario_keyword}:
|
241
|
+
#{@step_keyword} step 1
|
242
|
+
#{@step_keyword} step 2"
|
237
243
|
scenario_1 = CukeModeler::Scenario.new(source)
|
238
244
|
|
239
|
-
source = "
|
240
|
-
|
241
|
-
|
245
|
+
source = "#{@scenario_keyword}:
|
246
|
+
#{@step_keyword} step 2
|
247
|
+
#{@step_keyword} step 1"
|
242
248
|
scenario_2 = CukeModeler::Scenario.new(source)
|
243
249
|
|
244
250
|
|
@@ -247,23 +253,23 @@ describe 'Background, Integration' do
|
|
247
253
|
end
|
248
254
|
|
249
255
|
it 'is equal to an outline with the same steps' do
|
250
|
-
source = "
|
251
|
-
|
252
|
-
|
256
|
+
source = "#{@background_keyword}:
|
257
|
+
#{@step_keyword} step 1
|
258
|
+
#{@step_keyword} step 2"
|
253
259
|
background = clazz.new(source)
|
254
260
|
|
255
|
-
source = "
|
256
|
-
|
257
|
-
|
258
|
-
|
261
|
+
source = "#{@outline_keyword}:
|
262
|
+
#{@step_keyword} step 1
|
263
|
+
#{@step_keyword} step 2
|
264
|
+
#{@example_keyword}:
|
259
265
|
| param |
|
260
266
|
| value |"
|
261
267
|
outline_1 = CukeModeler::Outline.new(source)
|
262
268
|
|
263
|
-
source = "
|
264
|
-
|
265
|
-
|
266
|
-
|
269
|
+
source = "#{@outline_keyword}:
|
270
|
+
#{@step_keyword} step 2
|
271
|
+
#{@step_keyword} step 1
|
272
|
+
#{@example_keyword}:
|
267
273
|
| param |
|
268
274
|
| value |"
|
269
275
|
outline_2 = CukeModeler::Outline.new(source)
|
@@ -279,18 +285,17 @@ describe 'Background, Integration' do
|
|
279
285
|
describe 'background output' do
|
280
286
|
|
281
287
|
it 'can be remade from its own output' do
|
282
|
-
source =
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
source = source.join("\n")
|
288
|
+
source = "#{@background_keyword}: A background with everything it could have
|
289
|
+
|
290
|
+
Including a description
|
291
|
+
and then some.
|
292
|
+
|
293
|
+
#{@step_keyword} a step
|
294
|
+
| value |
|
295
|
+
#{@step_keyword} another step
|
296
|
+
\"\"\"
|
297
|
+
some string
|
298
|
+
\"\"\""
|
294
299
|
background = clazz.new(source)
|
295
300
|
|
296
301
|
background_output = background.to_s
|
@@ -303,85 +308,85 @@ describe 'Background, Integration' do
|
|
303
308
|
context 'from source text' do
|
304
309
|
|
305
310
|
it 'can output an empty background' do
|
306
|
-
source = [
|
311
|
+
source = ["#{@background_keyword}:"]
|
307
312
|
source = source.join("\n")
|
308
313
|
background = clazz.new(source)
|
309
314
|
|
310
|
-
background_output = background.to_s.split("\n")
|
315
|
+
background_output = background.to_s.split("\n", -1)
|
311
316
|
|
312
|
-
expect(background_output).to eq([
|
317
|
+
expect(background_output).to eq(["#{@background_keyword}:"])
|
313
318
|
end
|
314
319
|
|
315
320
|
it 'can output a background that has a name' do
|
316
|
-
source = [
|
321
|
+
source = ["#{@background_keyword}: test background"]
|
317
322
|
source = source.join("\n")
|
318
323
|
background = clazz.new(source)
|
319
324
|
|
320
|
-
background_output = background.to_s.split("\n")
|
325
|
+
background_output = background.to_s.split("\n", -1)
|
321
326
|
|
322
|
-
expect(background_output).to eq([
|
327
|
+
expect(background_output).to eq(["#{@background_keyword}: test background"])
|
323
328
|
end
|
324
329
|
|
325
330
|
it 'can output a background that has a description' do
|
326
|
-
source = [
|
331
|
+
source = ["#{@background_keyword}:",
|
327
332
|
'Some description.',
|
328
333
|
'Some more description.']
|
329
334
|
source = source.join("\n")
|
330
335
|
background = clazz.new(source)
|
331
336
|
|
332
|
-
background_output = background.to_s.split("\n")
|
337
|
+
background_output = background.to_s.split("\n", -1)
|
333
338
|
|
334
|
-
expect(background_output).to eq([
|
339
|
+
expect(background_output).to eq(["#{@background_keyword}:",
|
335
340
|
'',
|
336
341
|
'Some description.',
|
337
342
|
'Some more description.'])
|
338
343
|
end
|
339
344
|
|
340
345
|
it 'can output a background that has steps' do
|
341
|
-
source = [
|
342
|
-
|
346
|
+
source = ["#{@background_keyword}:",
|
347
|
+
"#{@step_keyword} a step",
|
343
348
|
'|value|',
|
344
|
-
|
349
|
+
"#{@step_keyword} another step",
|
345
350
|
'"""',
|
346
351
|
'some string',
|
347
352
|
'"""']
|
348
353
|
source = source.join("\n")
|
349
354
|
background = clazz.new(source)
|
350
355
|
|
351
|
-
background_output = background.to_s.split("\n")
|
356
|
+
background_output = background.to_s.split("\n", -1)
|
352
357
|
|
353
|
-
expect(background_output).to eq([
|
354
|
-
|
358
|
+
expect(background_output).to eq(["#{@background_keyword}:",
|
359
|
+
" #{@step_keyword} a step",
|
355
360
|
' | value |',
|
356
|
-
|
361
|
+
" #{@step_keyword} another step",
|
357
362
|
' """',
|
358
363
|
' some string',
|
359
364
|
' """'])
|
360
365
|
end
|
361
366
|
|
362
367
|
it 'can output a background that has everything' do
|
363
|
-
source = [
|
368
|
+
source = ["#{@background_keyword}: A background with everything it could have",
|
364
369
|
'Including a description',
|
365
370
|
'and then some.',
|
366
|
-
|
371
|
+
"#{@step_keyword} a step",
|
367
372
|
'|value|',
|
368
|
-
|
373
|
+
"#{@step_keyword} another step",
|
369
374
|
'"""',
|
370
375
|
'some string',
|
371
376
|
'"""']
|
372
377
|
source = source.join("\n")
|
373
378
|
background = clazz.new(source)
|
374
379
|
|
375
|
-
background_output = background.to_s.split("\n")
|
380
|
+
background_output = background.to_s.split("\n", -1)
|
376
381
|
|
377
|
-
expect(background_output).to eq([
|
382
|
+
expect(background_output).to eq(["#{@background_keyword}: A background with everything it could have",
|
378
383
|
'',
|
379
384
|
'Including a description',
|
380
385
|
'and then some.',
|
381
386
|
'',
|
382
|
-
|
387
|
+
" #{@step_keyword} a step",
|
383
388
|
' | value |',
|
384
|
-
|
389
|
+
" #{@step_keyword} another step",
|
385
390
|
' """',
|
386
391
|
' some string',
|
387
392
|
' """'])
|
@@ -55,12 +55,11 @@ describe 'Cell, Integration' do
|
|
55
55
|
describe 'getting ancestors' do
|
56
56
|
|
57
57
|
before(:each) do
|
58
|
-
source =
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
source = source.join("\n")
|
58
|
+
source = "#{@feature_keyword}: Test feature
|
59
|
+
|
60
|
+
#{@scenario_keyword}: Test test
|
61
|
+
#{@step_keyword} a step
|
62
|
+
| a value |"
|
64
63
|
|
65
64
|
file_path = "#{@default_file_directory}/cell_test_file.feature"
|
66
65
|
File.open(file_path, 'w') { |file| file.write(source) }
|
@@ -91,13 +90,13 @@ describe 'Cell, Integration' do
|
|
91
90
|
context 'a cell that is part of an outline' do
|
92
91
|
|
93
92
|
before(:each) do
|
94
|
-
source =
|
93
|
+
source = "#{@feature_keyword}: Test feature
|
95
94
|
|
96
|
-
|
97
|
-
|
98
|
-
|
95
|
+
#{@outline_keyword}: Test outline
|
96
|
+
#{@step_keyword} a step
|
97
|
+
#{@example_keyword}:
|
99
98
|
| param |
|
100
|
-
| value |
|
99
|
+
| value |"
|
101
100
|
|
102
101
|
file_path = "#{@default_file_directory}/cell_test_file.feature"
|
103
102
|
File.open(file_path, 'w') { |file| file.write(source) }
|
@@ -131,11 +130,11 @@ describe 'Cell, Integration' do
|
|
131
130
|
context 'a cell that is part of a scenario' do
|
132
131
|
|
133
132
|
before(:each) do
|
134
|
-
source =
|
133
|
+
source = "#{@feature_keyword}: Test feature
|
135
134
|
|
136
|
-
|
137
|
-
|
138
|
-
| a | table |
|
135
|
+
#{@scenario_keyword}: Test test
|
136
|
+
#{@step_keyword} a step:
|
137
|
+
| a | table |"
|
139
138
|
|
140
139
|
file_path = "#{@default_file_directory}/cell_test_file.feature"
|
141
140
|
File.open(file_path, 'w') { |file| file.write(source) }
|
@@ -156,11 +155,11 @@ describe 'Cell, Integration' do
|
|
156
155
|
context 'a cell that is part of a background' do
|
157
156
|
|
158
157
|
before(:each) do
|
159
|
-
source =
|
158
|
+
source = "#{@feature_keyword}: Test feature
|
160
159
|
|
161
|
-
|
162
|
-
|
163
|
-
| a | table |
|
160
|
+
#{@background_keyword}: Test background
|
161
|
+
#{@step_keyword} a step:
|
162
|
+
| a | table |"
|
164
163
|
|
165
164
|
file_path = "#{@default_file_directory}/cell_test_file.feature"
|
166
165
|
File.open(file_path, 'w') { |file| file.write(source) }
|
@@ -181,11 +180,11 @@ describe 'Cell, Integration' do
|
|
181
180
|
context 'a cell that is part of a step' do
|
182
181
|
|
183
182
|
before(:each) do
|
184
|
-
source =
|
183
|
+
source = "#{@feature_keyword}: Test feature
|
185
184
|
|
186
|
-
|
187
|
-
|
188
|
-
| a | table |
|
185
|
+
#{@scenario_keyword}: Test test
|
186
|
+
#{@step_keyword} a step:
|
187
|
+
| a | table |"
|
189
188
|
|
190
189
|
file_path = "#{@default_file_directory}/cell_test_file.feature"
|
191
190
|
File.open(file_path, 'w') { |file| file.write(source) }
|
@@ -237,11 +236,11 @@ describe 'Cell, Integration' do
|
|
237
236
|
end
|
238
237
|
|
239
238
|
it "models the cell's source line" do
|
240
|
-
source_text =
|
239
|
+
source_text = "#{@feature_keyword}:
|
241
240
|
|
242
|
-
|
243
|
-
|
244
|
-
| value |
|
241
|
+
#{@scenario_keyword}:
|
242
|
+
#{@step_keyword} a step
|
243
|
+
| value |"
|
245
244
|
cell = CukeModeler::Feature.new(source_text).tests.first.steps.first.block.rows.first.cells.first
|
246
245
|
|
247
246
|
expect(cell.source_line).to eq(5)
|