cuke_modeler 1.3.0 → 1.4.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 +5 -5
- data/.travis.yml +16 -0
- data/Gemfile +11 -3
- data/History.md +5 -0
- data/LICENSE.txt +1 -1
- data/Rakefile +8 -1
- data/appveyor.yml +7 -12
- data/cuke_modeler.gemspec +2 -2
- data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +309 -0
- data/lib/cuke_modeler/parsing.rb +28 -5
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/step_definitions/feature_file_steps.rb +1 -1
- data/testing/cucumber/step_definitions/modeling_steps.rb +2 -2
- data/testing/cucumber/step_definitions/verification_steps.rb +3 -2
- data/testing/file_helper.rb +3 -0
- data/testing/gemfiles/gherkin2.gemfile +7 -0
- data/testing/gemfiles/gherkin3.gemfile +6 -0
- data/testing/gemfiles/gherkin4.gemfile +7 -0
- data/testing/gemfiles/gherkin5.gemfile +6 -0
- data/testing/gemfiles/gherkin6.gemfile +10 -0
- data/testing/rspec/spec/integration/background_integration_spec.rb +80 -72
- data/testing/rspec/spec/integration/cell_integration_spec.rb +28 -20
- data/testing/rspec/spec/integration/comment_integration_spec.rb +11 -3
- data/testing/rspec/spec/integration/directory_integration_spec.rb +2 -2
- data/testing/rspec/spec/integration/doc_string_integration_spec.rb +26 -18
- data/testing/rspec/spec/integration/example_integration_spec.rb +75 -61
- data/testing/rspec/spec/integration/feature_file_integration_spec.rb +30 -20
- data/testing/rspec/spec/integration/feature_integration_spec.rb +106 -98
- data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +11 -11
- data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +11 -11
- data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +12 -12
- data/testing/rspec/spec/integration/gherkin_6_adapter_spec.rb +166 -0
- data/testing/rspec/spec/integration/outline_integration_spec.rb +116 -102
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +16 -4
- data/testing/rspec/spec/integration/row_integration_spec.rb +26 -18
- data/testing/rspec/spec/integration/scenario_integration_spec.rb +82 -74
- data/testing/rspec/spec/integration/step_integration_spec.rb +65 -49
- data/testing/rspec/spec/integration/table_integration_spec.rb +25 -17
- data/testing/rspec/spec/integration/tag_integration_spec.rb +27 -19
- data/testing/rspec/spec/spec_helper.rb +64 -35
- data/todo.txt +3 -1
- metadata +10 -8
- data/testing/cucumber/support/transforms.rb +0 -3
@@ -14,8 +14,18 @@ describe 'FeatureFile, Integration' do
|
|
14
14
|
|
15
15
|
describe 'unique behavior' do
|
16
16
|
|
17
|
-
it 'stores the original data generated by the parsing adapter', :
|
18
|
-
test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{
|
17
|
+
it 'stores the original data generated by the parsing adapter', :gherkin6 => true do
|
18
|
+
test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
|
19
|
+
|
20
|
+
feature_file = clazz.new(test_file_path)
|
21
|
+
data = feature_file.parsing_data
|
22
|
+
|
23
|
+
expect(data.keys).to match_array([:uri, :feature, :comments])
|
24
|
+
expect(File.basename(data[:uri])).to eq('test_file.feature')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
|
28
|
+
test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
|
19
29
|
|
20
30
|
feature_file = clazz.new(test_file_path)
|
21
31
|
data = feature_file.parsing_data
|
@@ -25,7 +35,7 @@ describe 'FeatureFile, Integration' do
|
|
25
35
|
end
|
26
36
|
|
27
37
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
28
|
-
test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{
|
38
|
+
test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
|
29
39
|
|
30
40
|
feature_file = clazz.new(test_file_path)
|
31
41
|
data = feature_file.parsing_data
|
@@ -35,7 +45,7 @@ describe 'FeatureFile, Integration' do
|
|
35
45
|
end
|
36
46
|
|
37
47
|
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
38
|
-
test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{
|
48
|
+
test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
|
39
49
|
|
40
50
|
feature_file = clazz.new(test_file_path)
|
41
51
|
data = feature_file.parsing_data
|
@@ -59,7 +69,7 @@ describe 'FeatureFile, Integration' do
|
|
59
69
|
|
60
70
|
describe 'model population' do
|
61
71
|
|
62
|
-
let(:source_text) { "#{
|
72
|
+
let(:source_text) { "#{FEATURE_KEYWORD}: Test feature" }
|
63
73
|
let(:feature_file_path) { CukeModeler::FileHelper.create_feature_file }
|
64
74
|
let(:feature_file) { clazz.new(feature_file_path) }
|
65
75
|
|
@@ -84,50 +94,50 @@ describe 'FeatureFile, Integration' do
|
|
84
94
|
it "models the feature file's comments" do
|
85
95
|
source_text = "# feature comment
|
86
96
|
@tag1 @tag2 @tag3
|
87
|
-
#{
|
97
|
+
#{FEATURE_KEYWORD}: A feature with everything it could have
|
88
98
|
|
89
99
|
Including a description
|
90
100
|
and then some.
|
91
101
|
|
92
102
|
# background comment
|
93
|
-
#{
|
103
|
+
#{BACKGROUND_KEYWORD}:
|
94
104
|
|
95
105
|
Background
|
96
106
|
description
|
97
107
|
|
98
|
-
#{
|
108
|
+
#{STEP_KEYWORD} a step
|
99
109
|
# table comment
|
100
110
|
| value1 |
|
101
111
|
# table row comment
|
102
112
|
| value2 |
|
103
|
-
#{
|
113
|
+
#{STEP_KEYWORD} another step
|
104
114
|
|
105
115
|
# scenario comment
|
106
116
|
@scenario_tag
|
107
|
-
#{
|
117
|
+
#{SCENARIO_KEYWORD}:
|
108
118
|
|
109
119
|
Scenario
|
110
120
|
description
|
111
121
|
|
112
|
-
#{
|
113
|
-
#{
|
122
|
+
#{STEP_KEYWORD} a step
|
123
|
+
#{STEP_KEYWORD} another step
|
114
124
|
\"\"\"
|
115
125
|
some text
|
116
126
|
\"\"\"
|
117
127
|
|
118
128
|
# outline comment
|
119
129
|
@outline_tag
|
120
|
-
#{
|
130
|
+
#{OUTLINE_KEYWORD}:
|
121
131
|
|
122
132
|
Outline
|
123
133
|
description
|
124
134
|
|
125
135
|
# step comment
|
126
|
-
#{
|
136
|
+
#{STEP_KEYWORD} a step
|
127
137
|
# table comment
|
128
138
|
| value2 |
|
129
139
|
# step comment
|
130
|
-
#{
|
140
|
+
#{STEP_KEYWORD} another step
|
131
141
|
# doc string comment
|
132
142
|
\"\"\"
|
133
143
|
some text
|
@@ -135,7 +145,7 @@ describe 'FeatureFile, Integration' do
|
|
135
145
|
|
136
146
|
# example comment
|
137
147
|
@example_tag
|
138
|
-
#{
|
148
|
+
#{EXAMPLE_KEYWORD}:
|
139
149
|
|
140
150
|
Example
|
141
151
|
description
|
@@ -187,7 +197,7 @@ describe 'FeatureFile, Integration' do
|
|
187
197
|
end
|
188
198
|
|
189
199
|
it 'properly sets its child models' do
|
190
|
-
file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{
|
200
|
+
file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: Test feature", :name => 'test_file')
|
191
201
|
|
192
202
|
file = clazz.new(file_path)
|
193
203
|
feature = file.feature
|
@@ -202,7 +212,7 @@ describe 'FeatureFile, Integration' do
|
|
202
212
|
let(:feature_file_path) { CukeModeler::FileHelper.create_feature_file(:text => '', :name => 'feature_file_test_file', :directory => directory_path) }
|
203
213
|
|
204
214
|
before(:each) do
|
205
|
-
File.open(feature_file_path, 'w') { |file| file.write("#{
|
215
|
+
File.open(feature_file_path, 'w') { |file| file.write("#{FEATURE_KEYWORD}: Test feature") }
|
206
216
|
end
|
207
217
|
|
208
218
|
let(:directory_model) { CukeModeler::Directory.new(directory_path) }
|
@@ -228,7 +238,7 @@ describe 'FeatureFile, Integration' do
|
|
228
238
|
|
229
239
|
context 'from source text' do
|
230
240
|
|
231
|
-
let(:source_text) { "#{
|
241
|
+
let(:source_text) { "#{FEATURE_KEYWORD}: Test feature" }
|
232
242
|
let(:feature_file_path) { CukeModeler::FileHelper.create_feature_file(:text => '', :name => 'feature_file_test_file') }
|
233
243
|
let(:feature_file) { clazz.new(feature_file_path) }
|
234
244
|
|
@@ -246,7 +256,7 @@ describe 'FeatureFile, Integration' do
|
|
246
256
|
end
|
247
257
|
|
248
258
|
it 'can be remade from its own output' do
|
249
|
-
path = CukeModeler::FileHelper.create_feature_file(:text => "#{
|
259
|
+
path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}:", :name => 'feature_file_test_file')
|
250
260
|
feature_file = clazz.new(path)
|
251
261
|
|
252
262
|
feature_file_output = feature_file.to_s
|
@@ -16,7 +16,7 @@ describe 'Feature, Integration' do
|
|
16
16
|
describe 'unique behavior' do
|
17
17
|
|
18
18
|
it 'can be instantiated with the minimum viable Gherkin' do
|
19
|
-
source = "#{
|
19
|
+
source = "#{FEATURE_KEYWORD}:"
|
20
20
|
|
21
21
|
expect { clazz.new(source) }.to_not raise_error
|
22
22
|
end
|
@@ -47,11 +47,11 @@ describe 'Feature, Integration' do
|
|
47
47
|
|
48
48
|
it 'properly sets its child models' do
|
49
49
|
source = "@a_tag
|
50
|
-
#{
|
51
|
-
#{
|
52
|
-
#{
|
53
|
-
#{
|
54
|
-
#{
|
50
|
+
#{FEATURE_KEYWORD}: Test feature
|
51
|
+
#{BACKGROUND_KEYWORD}: Test background
|
52
|
+
#{SCENARIO_KEYWORD}: Test scenario
|
53
|
+
#{OUTLINE_KEYWORD}: Test outline
|
54
|
+
#{EXAMPLE_KEYWORD}: Test Examples
|
55
55
|
| param |
|
56
56
|
| value |"
|
57
57
|
|
@@ -69,8 +69,16 @@ describe 'Feature, Integration' do
|
|
69
69
|
expect(tag.parent_model).to equal(feature)
|
70
70
|
end
|
71
71
|
|
72
|
-
it 'stores the original data generated by the parsing adapter', :
|
73
|
-
feature = clazz.new("@tag\n#{
|
72
|
+
it 'stores the original data generated by the parsing adapter', :gherkin6 => true do
|
73
|
+
feature = clazz.new("@tag\n#{FEATURE_KEYWORD}: test feature\ndescription\n#{BACKGROUND_KEYWORD}:\n#{SCENARIO_KEYWORD}:")
|
74
|
+
data = feature.parsing_data
|
75
|
+
|
76
|
+
expect(data.keys).to match_array([:tags, :location, :language, :keyword, :name, :children, :description])
|
77
|
+
expect(data[:name]).to eq('test feature')
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
|
81
|
+
feature = clazz.new("@tag\n#{FEATURE_KEYWORD}: test feature\ndescription\n#{BACKGROUND_KEYWORD}:\n#{SCENARIO_KEYWORD}:")
|
74
82
|
data = feature.parsing_data
|
75
83
|
|
76
84
|
expect(data.keys).to match_array([:type, :tags, :location, :language, :keyword, :name, :children, :description])
|
@@ -78,7 +86,7 @@ describe 'Feature, Integration' do
|
|
78
86
|
end
|
79
87
|
|
80
88
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
81
|
-
feature = clazz.new("@tag\n#{
|
89
|
+
feature = clazz.new("@tag\n#{FEATURE_KEYWORD}: test feature\ndescription\n#{BACKGROUND_KEYWORD}:\n#{SCENARIO_KEYWORD}:")
|
82
90
|
data = feature.parsing_data
|
83
91
|
|
84
92
|
expect(data.keys).to match_array([:type, :tags, :location, :language, :keyword, :name, :scenarioDefinitions, :comments, :background, :description])
|
@@ -86,7 +94,7 @@ describe 'Feature, Integration' do
|
|
86
94
|
end
|
87
95
|
|
88
96
|
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
89
|
-
feature = clazz.new("@tag\n#{
|
97
|
+
feature = clazz.new("@tag\n#{FEATURE_KEYWORD}: test feature\ndescription\n#{BACKGROUND_KEYWORD}:\n#{SCENARIO_KEYWORD}:")
|
90
98
|
data = feature.parsing_data
|
91
99
|
|
92
100
|
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'uri', 'elements', 'tags'])
|
@@ -94,7 +102,7 @@ describe 'Feature, Integration' do
|
|
94
102
|
end
|
95
103
|
|
96
104
|
it 'trims whitespace from its source description' do
|
97
|
-
source = ["#{
|
105
|
+
source = ["#{FEATURE_KEYWORD}:",
|
98
106
|
' ',
|
99
107
|
' description line 1',
|
100
108
|
'',
|
@@ -103,7 +111,7 @@ describe 'Feature, Integration' do
|
|
103
111
|
'',
|
104
112
|
'',
|
105
113
|
'',
|
106
|
-
" #{
|
114
|
+
" #{SCENARIO_KEYWORD}:"]
|
107
115
|
source = source.join("\n")
|
108
116
|
|
109
117
|
feature = clazz.new(source)
|
@@ -131,14 +139,14 @@ describe 'Feature, Integration' do
|
|
131
139
|
context 'from source text' do
|
132
140
|
|
133
141
|
it "models the feature's keyword" do
|
134
|
-
source_text = "#{
|
142
|
+
source_text = "#{FEATURE_KEYWORD}:"
|
135
143
|
feature = CukeModeler::Feature.new(source_text)
|
136
144
|
|
137
|
-
expect(feature.keyword).to eq(
|
145
|
+
expect(feature.keyword).to eq(FEATURE_KEYWORD)
|
138
146
|
end
|
139
147
|
|
140
148
|
it "models the feature's source line" do
|
141
|
-
source_text = "#{
|
149
|
+
source_text = "#{FEATURE_KEYWORD}:"
|
142
150
|
feature = CukeModeler::Feature.new(source_text)
|
143
151
|
|
144
152
|
expect(feature.source_line).to eq(1)
|
@@ -148,31 +156,31 @@ describe 'Feature, Integration' do
|
|
148
156
|
context 'a filled feature' do
|
149
157
|
|
150
158
|
let(:source_text) { "@tag_1 @tag_2
|
151
|
-
#{
|
159
|
+
#{FEATURE_KEYWORD}: Feature Foo
|
152
160
|
|
153
161
|
Some feature description.
|
154
162
|
|
155
163
|
Some more.
|
156
164
|
And some more.
|
157
165
|
|
158
|
-
#{
|
159
|
-
#{
|
166
|
+
#{BACKGROUND_KEYWORD}: The background
|
167
|
+
#{STEP_KEYWORD} some setup step
|
160
168
|
|
161
|
-
#{
|
162
|
-
#{
|
169
|
+
#{SCENARIO_KEYWORD}: Scenario 1
|
170
|
+
#{STEP_KEYWORD} a step
|
163
171
|
|
164
|
-
#{
|
165
|
-
#{
|
166
|
-
#{
|
172
|
+
#{OUTLINE_KEYWORD}: Outline 1
|
173
|
+
#{STEP_KEYWORD} a step
|
174
|
+
#{EXAMPLE_KEYWORD}:
|
167
175
|
| param |
|
168
176
|
| value |
|
169
177
|
|
170
|
-
#{
|
171
|
-
#{
|
178
|
+
#{SCENARIO_KEYWORD}: Scenario 2
|
179
|
+
#{STEP_KEYWORD} a step
|
172
180
|
|
173
|
-
#{
|
174
|
-
#{
|
175
|
-
#{
|
181
|
+
#{OUTLINE_KEYWORD}: Outline 2
|
182
|
+
#{STEP_KEYWORD} a step
|
183
|
+
#{EXAMPLE_KEYWORD}:
|
176
184
|
| param |
|
177
185
|
| value |" }
|
178
186
|
let(:feature) { clazz.new(source_text) }
|
@@ -218,7 +226,7 @@ describe 'Feature, Integration' do
|
|
218
226
|
|
219
227
|
context 'an empty feature' do
|
220
228
|
|
221
|
-
let(:source_text) { "#{
|
229
|
+
let(:source_text) { "#{FEATURE_KEYWORD}:" }
|
222
230
|
let(:feature) { clazz.new(source_text) }
|
223
231
|
|
224
232
|
|
@@ -254,13 +262,13 @@ describe 'Feature, Integration' do
|
|
254
262
|
|
255
263
|
|
256
264
|
it 'knows how many test cases it has' do
|
257
|
-
source_1 = "#{
|
265
|
+
source_1 = "#{FEATURE_KEYWORD}: Test feature"
|
258
266
|
|
259
|
-
source_2 = "#{
|
260
|
-
#{
|
261
|
-
#{
|
262
|
-
#{
|
263
|
-
#{
|
267
|
+
source_2 = "#{FEATURE_KEYWORD}: Test feature
|
268
|
+
#{SCENARIO_KEYWORD}: Test scenario
|
269
|
+
#{OUTLINE_KEYWORD}: Test outline
|
270
|
+
#{STEP_KEYWORD} a step
|
271
|
+
#{EXAMPLE_KEYWORD}: Test examples
|
264
272
|
|param|
|
265
273
|
|value_1|
|
266
274
|
|value_2|"
|
@@ -282,7 +290,7 @@ describe 'Feature, Integration' do
|
|
282
290
|
|
283
291
|
|
284
292
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
285
|
-
let(:source_gherkin) { "#{
|
293
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature" }
|
286
294
|
|
287
295
|
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
288
296
|
let(:feature_model) { directory_model.feature_files.first.feature }
|
@@ -313,47 +321,47 @@ describe 'Feature, Integration' do
|
|
313
321
|
|
314
322
|
it 'can be remade from its own output' do
|
315
323
|
source = "@tag1 @tag2 @tag3
|
316
|
-
#{
|
324
|
+
#{FEATURE_KEYWORD}: A feature with everything it could have
|
317
325
|
|
318
326
|
Including a description
|
319
327
|
and then some.
|
320
328
|
|
321
|
-
#{
|
329
|
+
#{BACKGROUND_KEYWORD}:
|
322
330
|
|
323
331
|
Background
|
324
332
|
description
|
325
333
|
|
326
|
-
#{
|
334
|
+
#{STEP_KEYWORD} a step
|
327
335
|
| value1 |
|
328
|
-
#{
|
336
|
+
#{STEP_KEYWORD} another step
|
329
337
|
|
330
338
|
@scenario_tag
|
331
|
-
#{
|
339
|
+
#{SCENARIO_KEYWORD}:
|
332
340
|
|
333
341
|
Scenario
|
334
342
|
description
|
335
343
|
|
336
|
-
#{
|
337
|
-
#{
|
344
|
+
#{STEP_KEYWORD} a step
|
345
|
+
#{STEP_KEYWORD} another step
|
338
346
|
\"\"\"
|
339
347
|
some text
|
340
348
|
\"\"\"
|
341
349
|
|
342
350
|
@outline_tag
|
343
|
-
#{
|
351
|
+
#{OUTLINE_KEYWORD}:
|
344
352
|
|
345
353
|
Outline
|
346
354
|
description
|
347
355
|
|
348
|
-
#{
|
356
|
+
#{STEP_KEYWORD} a step
|
349
357
|
| value2 |
|
350
|
-
#{
|
358
|
+
#{STEP_KEYWORD} another step
|
351
359
|
\"\"\"
|
352
360
|
some text
|
353
361
|
\"\"\"
|
354
362
|
|
355
363
|
@example_tag
|
356
|
-
#{
|
364
|
+
#{EXAMPLE_KEYWORD}:
|
357
365
|
|
358
366
|
Example
|
359
367
|
description
|
@@ -372,27 +380,27 @@ describe 'Feature, Integration' do
|
|
372
380
|
context 'from source text' do
|
373
381
|
|
374
382
|
it 'can output an empty feature' do
|
375
|
-
source = ["#{
|
383
|
+
source = ["#{FEATURE_KEYWORD}:"]
|
376
384
|
source = source.join("\n")
|
377
385
|
feature = clazz.new(source)
|
378
386
|
|
379
387
|
feature_output = feature.to_s.split("\n", -1)
|
380
388
|
|
381
|
-
expect(feature_output).to eq(["#{
|
389
|
+
expect(feature_output).to eq(["#{FEATURE_KEYWORD}:"])
|
382
390
|
end
|
383
391
|
|
384
392
|
it 'can output a feature that has a name' do
|
385
|
-
source = ["#{
|
393
|
+
source = ["#{FEATURE_KEYWORD}: test feature"]
|
386
394
|
source = source.join("\n")
|
387
395
|
feature = clazz.new(source)
|
388
396
|
|
389
397
|
feature_output = feature.to_s.split("\n", -1)
|
390
398
|
|
391
|
-
expect(feature_output).to eq(["#{
|
399
|
+
expect(feature_output).to eq(["#{FEATURE_KEYWORD}: test feature"])
|
392
400
|
end
|
393
401
|
|
394
402
|
it 'can output a feature that has a description' do
|
395
|
-
source = ["#{
|
403
|
+
source = ["#{FEATURE_KEYWORD}:",
|
396
404
|
'Some description.',
|
397
405
|
'Some more description.']
|
398
406
|
source = source.join("\n")
|
@@ -400,7 +408,7 @@ describe 'Feature, Integration' do
|
|
400
408
|
|
401
409
|
feature_output = feature.to_s.split("\n", -1)
|
402
410
|
|
403
|
-
expect(feature_output).to eq(["#{
|
411
|
+
expect(feature_output).to eq(["#{FEATURE_KEYWORD}:",
|
404
412
|
'',
|
405
413
|
'Some description.',
|
406
414
|
'Some more description.'])
|
@@ -409,51 +417,51 @@ describe 'Feature, Integration' do
|
|
409
417
|
it 'can output a feature that has tags' do
|
410
418
|
source = ['@tag1 @tag2',
|
411
419
|
'@tag3',
|
412
|
-
"#{
|
420
|
+
"#{FEATURE_KEYWORD}:"]
|
413
421
|
source = source.join("\n")
|
414
422
|
feature = clazz.new(source)
|
415
423
|
|
416
424
|
feature_output = feature.to_s.split("\n", -1)
|
417
425
|
|
418
426
|
expect(feature_output).to eq(['@tag1 @tag2 @tag3',
|
419
|
-
"#{
|
427
|
+
"#{FEATURE_KEYWORD}:"])
|
420
428
|
end
|
421
429
|
|
422
430
|
it 'can output a feature that has a background' do
|
423
|
-
source = ["#{
|
424
|
-
"#{
|
425
|
-
"#{
|
431
|
+
source = ["#{FEATURE_KEYWORD}:",
|
432
|
+
"#{BACKGROUND_KEYWORD}:",
|
433
|
+
"#{STEP_KEYWORD} a step"]
|
426
434
|
source = source.join("\n")
|
427
435
|
feature = clazz.new(source)
|
428
436
|
|
429
437
|
feature_output = feature.to_s.split("\n", -1)
|
430
438
|
|
431
|
-
expect(feature_output).to eq(["#{
|
439
|
+
expect(feature_output).to eq(["#{FEATURE_KEYWORD}:",
|
432
440
|
'',
|
433
|
-
" #{
|
434
|
-
" #{
|
441
|
+
" #{BACKGROUND_KEYWORD}:",
|
442
|
+
" #{STEP_KEYWORD} a step"])
|
435
443
|
end
|
436
444
|
|
437
445
|
it 'can output a feature that has a scenario' do
|
438
|
-
source = ["#{
|
439
|
-
"#{
|
440
|
-
"#{
|
446
|
+
source = ["#{FEATURE_KEYWORD}:",
|
447
|
+
"#{SCENARIO_KEYWORD}:",
|
448
|
+
"#{STEP_KEYWORD} a step"]
|
441
449
|
source = source.join("\n")
|
442
450
|
feature = clazz.new(source)
|
443
451
|
|
444
452
|
feature_output = feature.to_s.split("\n", -1)
|
445
453
|
|
446
|
-
expect(feature_output).to eq(["#{
|
454
|
+
expect(feature_output).to eq(["#{FEATURE_KEYWORD}:",
|
447
455
|
'',
|
448
|
-
" #{
|
449
|
-
" #{
|
456
|
+
" #{SCENARIO_KEYWORD}:",
|
457
|
+
" #{STEP_KEYWORD} a step"])
|
450
458
|
end
|
451
459
|
|
452
460
|
it 'can output a feature that has an outline' do
|
453
|
-
source = ["#{
|
454
|
-
"#{
|
455
|
-
"#{
|
456
|
-
"#{
|
461
|
+
source = ["#{FEATURE_KEYWORD}:",
|
462
|
+
"#{OUTLINE_KEYWORD}:",
|
463
|
+
"#{STEP_KEYWORD} a step",
|
464
|
+
"#{EXAMPLE_KEYWORD}:",
|
457
465
|
'|param|',
|
458
466
|
'|value|']
|
459
467
|
source = source.join("\n")
|
@@ -461,48 +469,48 @@ describe 'Feature, Integration' do
|
|
461
469
|
|
462
470
|
feature_output = feature.to_s.split("\n", -1)
|
463
471
|
|
464
|
-
expect(feature_output).to eq(["#{
|
472
|
+
expect(feature_output).to eq(["#{FEATURE_KEYWORD}:",
|
465
473
|
'',
|
466
|
-
" #{
|
467
|
-
" #{
|
474
|
+
" #{OUTLINE_KEYWORD}:",
|
475
|
+
" #{STEP_KEYWORD} a step",
|
468
476
|
'',
|
469
|
-
" #{
|
477
|
+
" #{EXAMPLE_KEYWORD}:",
|
470
478
|
' | param |',
|
471
479
|
' | value |'])
|
472
480
|
end
|
473
481
|
|
474
482
|
it 'can output a feature that has everything' do
|
475
483
|
source = ['@tag1 @tag2 @tag3',
|
476
|
-
"#{
|
484
|
+
"#{FEATURE_KEYWORD}: A feature with everything it could have",
|
477
485
|
'Including a description',
|
478
486
|
'and then some.',
|
479
|
-
"#{
|
487
|
+
"#{BACKGROUND_KEYWORD}:",
|
480
488
|
'Background',
|
481
489
|
'description',
|
482
|
-
"#{
|
490
|
+
"#{STEP_KEYWORD} a step",
|
483
491
|
'|value1|',
|
484
|
-
"#{
|
492
|
+
"#{STEP_KEYWORD} another step",
|
485
493
|
'@scenario_tag',
|
486
|
-
"#{
|
494
|
+
"#{SCENARIO_KEYWORD}:",
|
487
495
|
'Scenario',
|
488
496
|
'description',
|
489
|
-
"#{
|
490
|
-
"#{
|
497
|
+
"#{STEP_KEYWORD} a step",
|
498
|
+
"#{STEP_KEYWORD} another step",
|
491
499
|
'"""',
|
492
500
|
'some text',
|
493
501
|
'"""',
|
494
502
|
'@outline_tag',
|
495
|
-
"#{
|
503
|
+
"#{OUTLINE_KEYWORD}:",
|
496
504
|
'Outline ',
|
497
505
|
'description',
|
498
|
-
"#{
|
506
|
+
"#{STEP_KEYWORD} a step ",
|
499
507
|
'|value2|',
|
500
|
-
"#{
|
508
|
+
"#{STEP_KEYWORD} another step",
|
501
509
|
'"""',
|
502
510
|
'some text',
|
503
511
|
'"""',
|
504
512
|
'@example_tag',
|
505
|
-
"#{
|
513
|
+
"#{EXAMPLE_KEYWORD}:",
|
506
514
|
'Example',
|
507
515
|
'description',
|
508
516
|
'|param|',
|
@@ -513,47 +521,47 @@ describe 'Feature, Integration' do
|
|
513
521
|
feature_output = feature.to_s.split("\n", -1)
|
514
522
|
|
515
523
|
expect(feature_output).to eq(['@tag1 @tag2 @tag3',
|
516
|
-
"#{
|
524
|
+
"#{FEATURE_KEYWORD}: A feature with everything it could have",
|
517
525
|
'',
|
518
526
|
'Including a description',
|
519
527
|
'and then some.',
|
520
528
|
'',
|
521
|
-
" #{
|
529
|
+
" #{BACKGROUND_KEYWORD}:",
|
522
530
|
'',
|
523
531
|
' Background',
|
524
532
|
' description',
|
525
533
|
'',
|
526
|
-
" #{
|
534
|
+
" #{STEP_KEYWORD} a step",
|
527
535
|
' | value1 |',
|
528
|
-
" #{
|
536
|
+
" #{STEP_KEYWORD} another step",
|
529
537
|
'',
|
530
538
|
' @scenario_tag',
|
531
|
-
" #{
|
539
|
+
" #{SCENARIO_KEYWORD}:",
|
532
540
|
'',
|
533
541
|
' Scenario',
|
534
542
|
' description',
|
535
543
|
'',
|
536
|
-
" #{
|
537
|
-
" #{
|
544
|
+
" #{STEP_KEYWORD} a step",
|
545
|
+
" #{STEP_KEYWORD} another step",
|
538
546
|
' """',
|
539
547
|
' some text',
|
540
548
|
' """',
|
541
549
|
'',
|
542
550
|
' @outline_tag',
|
543
|
-
" #{
|
551
|
+
" #{OUTLINE_KEYWORD}:",
|
544
552
|
'',
|
545
553
|
' Outline',
|
546
554
|
' description',
|
547
555
|
'',
|
548
|
-
" #{
|
556
|
+
" #{STEP_KEYWORD} a step",
|
549
557
|
' | value2 |',
|
550
|
-
" #{
|
558
|
+
" #{STEP_KEYWORD} another step",
|
551
559
|
' """',
|
552
560
|
' some text',
|
553
561
|
' """',
|
554
562
|
'',
|
555
563
|
' @example_tag',
|
556
|
-
" #{
|
564
|
+
" #{EXAMPLE_KEYWORD}:",
|
557
565
|
'',
|
558
566
|
' Example',
|
559
567
|
' description',
|
@@ -624,7 +632,7 @@ describe 'Feature, Integration' do
|
|
624
632
|
end
|
625
633
|
|
626
634
|
|
627
|
-
expect { clazz.new("#{
|
635
|
+
expect { clazz.new("#{FEATURE_KEYWORD}:\n#{SCENARIO_KEYWORD}:\n#{STEP_KEYWORD} foo") }.to raise_error(ArgumentError, /Unknown.*some_unknown_type/)
|
628
636
|
ensure
|
629
637
|
# Making sure that our changes don't escape a test and ruin the rest of the suite
|
630
638
|
module CukeModeler
|