cuke_modeler 1.3.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +60 -17
  3. data/CHANGELOG.md +312 -0
  4. data/Gemfile +19 -3
  5. data/LICENSE.txt +1 -1
  6. data/README.md +17 -7
  7. data/Rakefile +45 -28
  8. data/appveyor.yml +57 -17
  9. data/cuke_modeler.gemspec +6 -3
  10. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +1 -0
  11. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +1 -0
  12. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +2 -1
  13. data/lib/cuke_modeler/adapters/gherkin_5_adapter.rb +12 -0
  14. data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +310 -0
  15. data/lib/cuke_modeler/adapters/gherkin_7_adapter.rb +307 -0
  16. data/lib/cuke_modeler/adapters/gherkin_8_adapter.rb +12 -0
  17. data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +12 -0
  18. data/lib/cuke_modeler/containing.rb +16 -0
  19. data/lib/cuke_modeler/described.rb +1 -0
  20. data/lib/cuke_modeler/models/step.rb +31 -2
  21. data/lib/cuke_modeler/named.rb +1 -0
  22. data/lib/cuke_modeler/nested.rb +1 -0
  23. data/lib/cuke_modeler/parsed.rb +1 -0
  24. data/lib/cuke_modeler/parsing.rb +116 -68
  25. data/lib/cuke_modeler/sourceable.rb +1 -0
  26. data/lib/cuke_modeler/stepped.rb +1 -0
  27. data/lib/cuke_modeler/taggable.rb +1 -0
  28. data/lib/cuke_modeler/version.rb +1 -1
  29. data/testing/cucumber/features/analysis/step_comparison.feature +25 -0
  30. data/testing/cucumber/features/analysis/test_comparison.feature +1 -1
  31. data/testing/cucumber/step_definitions/feature_file_steps.rb +1 -1
  32. data/testing/cucumber/step_definitions/modeling_steps.rb +7 -2
  33. data/testing/cucumber/step_definitions/verification_steps.rb +11 -2
  34. data/testing/file_helper.rb +3 -0
  35. data/testing/gemfiles/gherkin2.gemfile +8 -0
  36. data/testing/gemfiles/gherkin3.gemfile +6 -0
  37. data/testing/gemfiles/gherkin4.gemfile +7 -0
  38. data/testing/gemfiles/gherkin5.gemfile +7 -0
  39. data/testing/gemfiles/gherkin6.gemfile +10 -0
  40. data/testing/gemfiles/gherkin7.gemfile +9 -0
  41. data/testing/gemfiles/gherkin8.gemfile +9 -0
  42. data/testing/gemfiles/gherkin9.gemfile +9 -0
  43. data/testing/helper_methods.rb +23 -0
  44. data/testing/rspec/spec/integration/{gherkin_2_adapter_spec.rb → adapters/gherkin_2_adapter_spec.rb} +13 -13
  45. data/testing/rspec/spec/integration/{gherkin_3_adapter_spec.rb → adapters/gherkin_3_adapter_spec.rb} +13 -13
  46. data/testing/rspec/spec/integration/{gherkin_4_adapter_spec.rb → adapters/gherkin_4_adapter_spec.rb} +13 -13
  47. data/testing/rspec/spec/integration/adapters/gherkin_5_adapter_spec.rb +165 -0
  48. data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +159 -0
  49. data/testing/rspec/spec/integration/adapters/gherkin_7_adapter_spec.rb +162 -0
  50. data/testing/rspec/spec/integration/adapters/gherkin_8_adapter_spec.rb +162 -0
  51. data/testing/rspec/spec/integration/adapters/gherkin_9_adapter_spec.rb +162 -0
  52. data/testing/rspec/spec/integration/{background_integration_spec.rb → models/background_integration_spec.rb} +90 -86
  53. data/testing/rspec/spec/integration/{cell_integration_spec.rb → models/cell_integration_spec.rb} +49 -38
  54. data/testing/rspec/spec/integration/{comment_integration_spec.rb → models/comment_integration_spec.rb} +31 -20
  55. data/testing/rspec/spec/integration/{directory_integration_spec.rb → models/directory_integration_spec.rb} +3 -3
  56. data/testing/rspec/spec/integration/{doc_string_integration_spec.rb → models/doc_string_integration_spec.rb} +39 -35
  57. data/testing/rspec/spec/integration/{example_integration_spec.rb → models/example_integration_spec.rb} +109 -83
  58. data/testing/rspec/spec/integration/{feature_file_integration_spec.rb → models/feature_file_integration_spec.rb} +52 -38
  59. data/testing/rspec/spec/integration/{feature_integration_spec.rb → models/feature_integration_spec.rb} +125 -112
  60. data/testing/rspec/spec/integration/{model_integration_spec.rb → models/model_integration_spec.rb} +1 -1
  61. data/testing/rspec/spec/integration/{outline_integration_spec.rb → models/outline_integration_spec.rb} +138 -129
  62. data/testing/rspec/spec/integration/{row_integration_spec.rb → models/row_integration_spec.rb} +55 -35
  63. data/testing/rspec/spec/integration/{scenario_integration_spec.rb → models/scenario_integration_spec.rb} +92 -88
  64. data/testing/rspec/spec/integration/models/step_integration_spec.rb +573 -0
  65. data/testing/rspec/spec/integration/{table_integration_spec.rb → models/table_integration_spec.rb} +38 -34
  66. data/testing/rspec/spec/integration/{tag_integration_spec.rb → models/tag_integration_spec.rb} +56 -36
  67. data/testing/rspec/spec/integration/parsing_integration_spec.rb +45 -7
  68. data/testing/rspec/spec/spec_helper.rb +79 -43
  69. data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +25 -0
  70. data/testing/rspec/spec/unit/{background_unit_spec.rb → models/background_unit_spec.rb} +1 -1
  71. data/testing/rspec/spec/unit/{cell_unit_spec.rb → models/cell_unit_spec.rb} +1 -1
  72. data/testing/rspec/spec/unit/{comment_unit_spec.rb → models/comment_unit_spec.rb} +1 -1
  73. data/testing/rspec/spec/unit/{directory_unit_spec.rb → models/directory_unit_spec.rb} +1 -1
  74. data/testing/rspec/spec/unit/{doc_string_unit_spec.rb → models/doc_string_unit_spec.rb} +1 -1
  75. data/testing/rspec/spec/unit/{example_unit_spec.rb → models/example_unit_spec.rb} +1 -1
  76. data/testing/rspec/spec/unit/{feature_file_unit_spec.rb → models/feature_file_unit_spec.rb} +1 -1
  77. data/testing/rspec/spec/unit/{feature_unit_spec.rb → models/feature_unit_spec.rb} +1 -1
  78. data/testing/rspec/spec/unit/{model_unit_spec.rb → models/model_unit_spec.rb} +1 -1
  79. data/testing/rspec/spec/unit/{outline_unit_spec.rb → models/outline_unit_spec.rb} +1 -1
  80. data/testing/rspec/spec/unit/{row_unit_spec.rb → models/row_unit_spec.rb} +1 -1
  81. data/testing/rspec/spec/unit/{scenario_unit_spec.rb → models/scenario_unit_spec.rb} +1 -1
  82. data/testing/rspec/spec/unit/{step_unit_spec.rb → models/step_unit_spec.rb} +2 -2
  83. data/testing/rspec/spec/unit/{table_unit_spec.rb → models/table_unit_spec.rb} +1 -1
  84. data/testing/rspec/spec/unit/{tag_unit_spec.rb → models/tag_unit_spec.rb} +1 -1
  85. data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +102 -0
  86. data/todo.txt +5 -2
  87. metadata +80 -47
  88. data/History.md +0 -186
  89. data/testing/cucumber/support/transforms.rb +0 -3
  90. data/testing/rspec/spec/integration/step_integration_spec.rb +0 -459
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/../spec_helper"
1
+ require "#{File.dirname(__FILE__)}/../../spec_helper"
2
2
 
3
3
 
4
4
  describe 'Model, Integration' do
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/../spec_helper"
1
+ require "#{File.dirname(__FILE__)}/../../spec_helper"
2
2
 
3
3
 
4
4
  describe 'Outline, Integration' do
@@ -14,22 +14,16 @@ describe 'Outline, Integration' do
14
14
 
15
15
  describe 'unique behavior' do
16
16
 
17
- it 'can be instantiated with the minimum viable Gherkin', :gherkin4 => true do
18
- source = "#{@outline_keyword}:"
19
-
20
- expect { clazz.new(source) }.to_not raise_error
21
- end
22
-
23
- it 'can be instantiated with the minimum viable Gherkin', :gherkin2 => true do
24
- source = "#{@outline_keyword}:"
17
+ it 'can be instantiated with the minimum viable Gherkin', :unless => gherkin?(3) do
18
+ source = "#{OUTLINE_KEYWORD}:"
25
19
 
26
20
  expect { clazz.new(source) }.to_not raise_error
27
21
  end
28
22
 
29
23
  # gherkin 3.x does not accept incomplete outlines
30
- it 'can be instantiated with the minimum viable Gherkin', :gherkin3 => true do
31
- source = "#{@outline_keyword}:
32
- #{@example_keyword}:
24
+ it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(3) do
25
+ source = "#{OUTLINE_KEYWORD}:
26
+ #{EXAMPLE_KEYWORD}:
33
27
  | param |
34
28
  | value |"
35
29
 
@@ -57,41 +51,45 @@ describe 'Outline, Integration' do
57
51
  end
58
52
  end
59
53
 
60
- it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
61
- outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
62
- data = outline.parsing_data
54
+ describe 'parsing data' do
63
55
 
64
- expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples, :description])
65
- expect(data[:type]).to eq(:ScenarioOutline)
66
- end
56
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
57
+ outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
58
+ data = outline.parsing_data
67
59
 
68
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
69
- outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
70
- data = outline.parsing_data
60
+ expect(data.keys).to match_array([:background, :rule, :scenario])
61
+ expect(data[:scenario][:name]).to eq('test outline')
62
+ end
71
63
 
72
- expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples, :description])
73
- expect(data[:type]).to eq(:ScenarioOutline)
74
- end
64
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
65
+ outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
66
+ data = outline.parsing_data
67
+
68
+ expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples, :description])
69
+ expect(data[:type]).to eq(:ScenarioOutline)
70
+ end
75
71
 
76
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
77
- outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
78
- data = outline.parsing_data
72
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
73
+ outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
74
+ data = outline.parsing_data
75
+
76
+ expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'examples', 'steps', 'tags'])
77
+ expect(data['keyword']).to eq('Scenario Outline')
78
+ end
79
79
 
80
- expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'examples', 'steps', 'tags'])
81
- expect(data['keyword']).to eq('Scenario Outline')
82
80
  end
83
81
 
84
82
  it 'provides a descriptive filename when being parsed from stand alone text' do
85
- source = "bad outline text \n #{@outline_keyword}:\n #{@step_keyword} a step\n @foo "
83
+ source = "bad outline text \n #{OUTLINE_KEYWORD}:\n #{STEP_KEYWORD} a step\n @foo "
86
84
 
87
85
  expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_outline\.feature'/)
88
86
  end
89
87
 
90
88
  it 'properly sets its child models' do
91
89
  source = "@a_tag
92
- #{@outline_keyword}:
93
- #{@step_keyword} a step
94
- #{@example_keyword}:
90
+ #{OUTLINE_KEYWORD}:
91
+ #{STEP_KEYWORD} a step
92
+ #{EXAMPLE_KEYWORD}:
95
93
  | param |
96
94
  | value |"
97
95
 
@@ -113,11 +111,11 @@ describe 'Outline, Integration' do
113
111
 
114
112
 
115
113
  let(:test_directory) { CukeModeler::FileHelper.create_directory }
116
- let(:source_gherkin) { "#{@feature_keyword}: Test feature
114
+ let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
117
115
 
118
- #{@outline_keyword}: Test test
119
- #{@step_keyword} a step
120
- #{@example_keyword}: Test example
116
+ #{OUTLINE_KEYWORD}: Test test
117
+ #{STEP_KEYWORD} a step
118
+ #{EXAMPLE_KEYWORD}: Test example
121
119
  | a param |
122
120
  | a value |"
123
121
  }
@@ -157,21 +155,32 @@ describe 'Outline, Integration' do
157
155
 
158
156
  context 'from source text' do
159
157
 
160
- let(:source_text) { "#{@outline_keyword}:" }
158
+ let(:source_text) { "#{OUTLINE_KEYWORD}:" }
161
159
  let(:outline) { clazz.new(source_text) }
162
160
 
163
161
 
164
162
  # gherkin 3.x does not accept incomplete outlines
165
- it "models the outline's keyword", :gherkin3 => false do
166
- expect(outline.keyword).to eq("#{@outline_keyword}")
163
+ it "models the outline's keyword", :unless => gherkin?(3) do
164
+ expect(outline.keyword).to eq("#{OUTLINE_KEYWORD}")
165
+ end
166
+
167
+ context 'using gherkin 3.x', :if => gherkin?(3) do
168
+
169
+ let(:source_text) { "#{OUTLINE_KEYWORD}:\n#{STEP_KEYWORD} step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|" }
170
+ let(:outline) { clazz.new(source_text) }
171
+
172
+ it "models the outline's keyword" do
173
+ expect(outline.keyword).to eq(OUTLINE_KEYWORD)
174
+ end
175
+
167
176
  end
168
177
 
169
178
  it "models the outline's source line" do
170
- source_text = "#{@feature_keyword}:
179
+ source_text = "#{FEATURE_KEYWORD}:
171
180
 
172
- #{@outline_keyword}: foo
173
- #{@step_keyword} step
174
- #{@example_keyword}:
181
+ #{OUTLINE_KEYWORD}: foo
182
+ #{STEP_KEYWORD} step
183
+ #{EXAMPLE_KEYWORD}:
175
184
  | param |
176
185
  | value |"
177
186
  outline = CukeModeler::Feature.new(source_text).tests.first
@@ -183,20 +192,20 @@ describe 'Outline, Integration' do
183
192
  context 'a filled outline' do
184
193
 
185
194
  let(:source_text) { "@tag1 @tag2 @tag3
186
- #{@outline_keyword}: Foo
195
+ #{OUTLINE_KEYWORD}: Foo
187
196
  Scenario description.
188
197
 
189
198
  Some more.
190
199
  Even more.
191
200
 
192
- #{@step_keyword} a <setup> step
193
- #{@step_keyword} an action step
194
- #{@step_keyword} a <verification> step
201
+ #{STEP_KEYWORD} a <setup> step
202
+ #{STEP_KEYWORD} an action step
203
+ #{STEP_KEYWORD} a <verification> step
195
204
 
196
- #{@example_keyword}: example 1
205
+ #{EXAMPLE_KEYWORD}: example 1
197
206
  | setup | verification |
198
207
  | x | y |
199
- #{@example_keyword}: example 2
208
+ #{EXAMPLE_KEYWORD}: example 2
200
209
  | setup | verification |
201
210
  | a | b |" }
202
211
  let(:outline) { clazz.new(source_text) }
@@ -237,9 +246,9 @@ describe 'Outline, Integration' do
237
246
 
238
247
 
239
248
  # gherkin 3.x does not accept incomplete outlines
240
- context 'an empty outline', :gherkin3 => false do
249
+ context 'an empty outline', :unless => gherkin?(3) do
241
250
 
242
- let(:source_text) { "#{@outline_keyword}:" }
251
+ let(:source_text) { "#{OUTLINE_KEYWORD}:" }
243
252
  let(:outline) { clazz.new(source_text) }
244
253
 
245
254
 
@@ -270,7 +279,7 @@ describe 'Outline, Integration' do
270
279
  end
271
280
 
272
281
  it 'trims whitespace from its source description' do
273
- source = ["#{@outline_keyword}:",
282
+ source = ["#{OUTLINE_KEYWORD}:",
274
283
  ' ',
275
284
  ' description line 1',
276
285
  '',
@@ -279,9 +288,9 @@ describe 'Outline, Integration' do
279
288
  '',
280
289
  '',
281
290
  '',
282
- " #{@step_keyword} a step",
291
+ " #{STEP_KEYWORD} a step",
283
292
  '',
284
- "#{@example_keyword}:",
293
+ "#{EXAMPLE_KEYWORD}:",
285
294
  '|param|',
286
295
  '|value|']
287
296
  source = source.join("\n")
@@ -299,22 +308,22 @@ describe 'Outline, Integration' do
299
308
  describe 'comparison' do
300
309
 
301
310
  it 'is equal to a background with the same steps' do
302
- source = "#{@outline_keyword}:
303
- #{@step_keyword} step 1
304
- #{@step_keyword} step 2
305
- #{@example_keyword}:
311
+ source = "#{OUTLINE_KEYWORD}:
312
+ #{STEP_KEYWORD} step 1
313
+ #{STEP_KEYWORD} step 2
314
+ #{EXAMPLE_KEYWORD}:
306
315
  | param |
307
316
  | value |"
308
317
  outline = clazz.new(source)
309
318
 
310
- source = "#{@background_keyword}:
311
- #{@step_keyword} step 1
312
- #{@step_keyword} step 2"
319
+ source = "#{BACKGROUND_KEYWORD}:
320
+ #{STEP_KEYWORD} step 1
321
+ #{STEP_KEYWORD} step 2"
313
322
  background_1 = CukeModeler::Background.new(source)
314
323
 
315
- source = "#{@background_keyword}:
316
- #{@step_keyword} step 2
317
- #{@step_keyword} step 1"
324
+ source = "#{BACKGROUND_KEYWORD}:
325
+ #{STEP_KEYWORD} step 2
326
+ #{STEP_KEYWORD} step 1"
318
327
  background_2 = CukeModeler::Background.new(source)
319
328
 
320
329
 
@@ -323,22 +332,22 @@ describe 'Outline, Integration' do
323
332
  end
324
333
 
325
334
  it 'is equal to a scenario with the same steps' do
326
- source = "#{@outline_keyword}:
327
- #{@step_keyword} step 1
328
- #{@step_keyword} step 2
329
- #{@example_keyword}:
335
+ source = "#{OUTLINE_KEYWORD}:
336
+ #{STEP_KEYWORD} step 1
337
+ #{STEP_KEYWORD} step 2
338
+ #{EXAMPLE_KEYWORD}:
330
339
  | param |
331
340
  | value |"
332
341
  outline = clazz.new(source)
333
342
 
334
- source = "#{@scenario_keyword}:
335
- #{@step_keyword} step 1
336
- #{@step_keyword} step 2"
343
+ source = "#{SCENARIO_KEYWORD}:
344
+ #{STEP_KEYWORD} step 1
345
+ #{STEP_KEYWORD} step 2"
337
346
  scenario_1 = CukeModeler::Scenario.new(source)
338
347
 
339
- source = "#{@scenario_keyword}:
340
- #{@step_keyword} step 2
341
- #{@step_keyword} step 1"
348
+ source = "#{SCENARIO_KEYWORD}:
349
+ #{STEP_KEYWORD} step 2
350
+ #{STEP_KEYWORD} step 1"
342
351
  scenario_2 = CukeModeler::Scenario.new(source)
343
352
 
344
353
 
@@ -347,26 +356,26 @@ describe 'Outline, Integration' do
347
356
  end
348
357
 
349
358
  it 'is equal to an outline with the same steps' do
350
- source = "#{@outline_keyword}:
351
- #{@step_keyword} step 1
352
- #{@step_keyword} step 2
353
- #{@example_keyword}:
359
+ source = "#{OUTLINE_KEYWORD}:
360
+ #{STEP_KEYWORD} step 1
361
+ #{STEP_KEYWORD} step 2
362
+ #{EXAMPLE_KEYWORD}:
354
363
  | param |
355
364
  | value |"
356
365
  outline_1 = clazz.new(source)
357
366
 
358
- source = "#{@outline_keyword}:
359
- #{@step_keyword} step 1
360
- #{@step_keyword} step 2
361
- #{@example_keyword}:
367
+ source = "#{OUTLINE_KEYWORD}:
368
+ #{STEP_KEYWORD} step 1
369
+ #{STEP_KEYWORD} step 2
370
+ #{EXAMPLE_KEYWORD}:
362
371
  | param |
363
372
  | value |"
364
373
  outline_2 = clazz.new(source)
365
374
 
366
- source = "#{@outline_keyword}:
367
- #{@step_keyword} step 2
368
- #{@step_keyword} step 1
369
- #{@example_keyword}:
375
+ source = "#{OUTLINE_KEYWORD}:
376
+ #{STEP_KEYWORD} step 2
377
+ #{STEP_KEYWORD} step 1
378
+ #{EXAMPLE_KEYWORD}:
370
379
  | param |
371
380
  | value |"
372
381
  outline_3 = clazz.new(source)
@@ -383,19 +392,19 @@ describe 'Outline, Integration' do
383
392
 
384
393
  it 'can be remade from its own output' do
385
394
  source = "@tag1 @tag2 @tag3
386
- #{@outline_keyword}: An outline with everything it could have
395
+ #{OUTLINE_KEYWORD}: An outline with everything it could have
387
396
 
388
397
  Some description.
389
398
  Some more description.
390
399
 
391
- #{@step_keyword} a step
400
+ #{STEP_KEYWORD} a step
392
401
  | value |
393
- #{@step_keyword} a <value> step
402
+ #{STEP_KEYWORD} a <value> step
394
403
  \"\"\"
395
404
  some string
396
405
  \"\"\"
397
406
 
398
- #{@example_keyword}:
407
+ #{EXAMPLE_KEYWORD}:
399
408
 
400
409
  Some description.
401
410
  Some more description.
@@ -404,7 +413,7 @@ describe 'Outline, Integration' do
404
413
  | x |
405
414
 
406
415
  @example_tag
407
- #{@example_keyword}:
416
+ #{EXAMPLE_KEYWORD}:
408
417
  | value |
409
418
  | y |"
410
419
  outline = clazz.new(source)
@@ -419,30 +428,30 @@ describe 'Outline, Integration' do
419
428
  context 'from source text' do
420
429
 
421
430
  # gherkin 3.x does not accept incomplete outlines
422
- it 'can output an empty outline', :gherkin3 => false do
423
- source = ["#{@outline_keyword}:"]
431
+ it 'can output an empty outline', :unless => gherkin?(3) do
432
+ source = ["#{OUTLINE_KEYWORD}:"]
424
433
  source = source.join("\n")
425
434
  outline = clazz.new(source)
426
435
 
427
436
  outline_output = outline.to_s.split("\n", -1)
428
437
 
429
- expect(outline_output).to eq(["#{@outline_keyword}:"])
438
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:"])
430
439
  end
431
440
 
432
441
  # gherkin 3.x does not accept incomplete outlines
433
- it 'can output a outline that has a name', :gherkin3 => false do
434
- source = ["#{@outline_keyword}: test outline"]
442
+ it 'can output a outline that has a name', :unless => gherkin?(3) do
443
+ source = ["#{OUTLINE_KEYWORD}: test outline"]
435
444
  source = source.join("\n")
436
445
  outline = clazz.new(source)
437
446
 
438
447
  outline_output = outline.to_s.split("\n", -1)
439
448
 
440
- expect(outline_output).to eq(["#{@outline_keyword}: test outline"])
449
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}: test outline"])
441
450
  end
442
451
 
443
452
  # gherkin 3.x does not accept incomplete outlines
444
- it 'can output a outline that has a description', :gherkin3 => false do
445
- source = ["#{@outline_keyword}:",
453
+ it 'can output a outline that has a description', :unless => gherkin?(3) do
454
+ source = ["#{OUTLINE_KEYWORD}:",
446
455
  'Some description.',
447
456
  'Some more description.']
448
457
  source = source.join("\n")
@@ -450,18 +459,18 @@ describe 'Outline, Integration' do
450
459
 
451
460
  outline_output = outline.to_s.split("\n", -1)
452
461
 
453
- expect(outline_output).to eq(["#{@outline_keyword}:",
462
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:",
454
463
  '',
455
464
  'Some description.',
456
465
  'Some more description.'])
457
466
  end
458
467
 
459
468
  # gherkin 3.x does not accept incomplete outlines
460
- it 'can output a outline that has steps', :gherkin3 => false do
461
- source = ["#{@outline_keyword}:",
462
- " #{@step_keyword} a step",
469
+ it 'can output a outline that has steps', :unless => gherkin?(3) do
470
+ source = ["#{OUTLINE_KEYWORD}:",
471
+ " #{STEP_KEYWORD} a step",
463
472
  ' | value |',
464
- " #{@step_keyword} another step",
473
+ " #{STEP_KEYWORD} another step",
465
474
  ' """',
466
475
  ' some string',
467
476
  ' """']
@@ -470,36 +479,36 @@ describe 'Outline, Integration' do
470
479
 
471
480
  outline_output = outline.to_s.split("\n", -1)
472
481
 
473
- expect(outline_output).to eq(["#{@outline_keyword}:",
474
- " #{@step_keyword} a step",
482
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:",
483
+ " #{STEP_KEYWORD} a step",
475
484
  ' | value |',
476
- " #{@step_keyword} another step",
485
+ " #{STEP_KEYWORD} another step",
477
486
  ' """',
478
487
  ' some string',
479
488
  ' """'])
480
489
  end
481
490
 
482
491
  # gherkin 3.x does not accept incomplete outlines
483
- it 'can output a outline that has tags', :gherkin3 => false do
492
+ it 'can output a outline that has tags', :unless => gherkin?(3) do
484
493
  source = ['@tag1 @tag2',
485
494
  '@tag3',
486
- "#{@outline_keyword}:"]
495
+ "#{OUTLINE_KEYWORD}:"]
487
496
  source = source.join("\n")
488
497
  outline = clazz.new(source)
489
498
 
490
499
  outline_output = outline.to_s.split("\n", -1)
491
500
 
492
501
  expect(outline_output).to eq(['@tag1 @tag2 @tag3',
493
- "#{@outline_keyword}:"])
502
+ "#{OUTLINE_KEYWORD}:"])
494
503
  end
495
504
 
496
505
  it 'can output a outline that has examples' do
497
- source = ["#{@outline_keyword}:",
498
- "#{@step_keyword} a step",
499
- "#{@example_keyword}:",
506
+ source = ["#{OUTLINE_KEYWORD}:",
507
+ "#{STEP_KEYWORD} a step",
508
+ "#{EXAMPLE_KEYWORD}:",
500
509
  '| value |',
501
510
  '| x |',
502
- "#{@example_keyword}:",
511
+ "#{EXAMPLE_KEYWORD}:",
503
512
  '| value |',
504
513
  '| y |']
505
514
  source = source.join("\n")
@@ -507,31 +516,31 @@ describe 'Outline, Integration' do
507
516
 
508
517
  outline_output = outline.to_s.split("\n", -1)
509
518
 
510
- expect(outline_output).to eq(["#{@outline_keyword}:",
511
- " #{@step_keyword} a step",
519
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:",
520
+ " #{STEP_KEYWORD} a step",
512
521
  '',
513
- "#{@example_keyword}:",
522
+ "#{EXAMPLE_KEYWORD}:",
514
523
  ' | value |',
515
524
  ' | x |',
516
525
  '',
517
- "#{@example_keyword}:",
526
+ "#{EXAMPLE_KEYWORD}:",
518
527
  ' | value |',
519
528
  ' | y |'])
520
529
  end
521
530
 
522
531
  it 'can output a outline that has everything' do
523
532
  source = ['@tag1 @tag2 @tag3',
524
- "#{@outline_keyword}: A outline with everything it could have",
533
+ "#{OUTLINE_KEYWORD}: A outline with everything it could have",
525
534
  'Including a description',
526
535
  'and then some.',
527
- "#{@step_keyword} a step",
536
+ "#{STEP_KEYWORD} a step",
528
537
  '|value|',
529
- "#{@step_keyword} another step",
538
+ "#{STEP_KEYWORD} another step",
530
539
  '"""',
531
540
  'some string',
532
541
  '"""',
533
542
  '',
534
- "#{@example_keyword}:",
543
+ "#{EXAMPLE_KEYWORD}:",
535
544
  '',
536
545
  'Some description.',
537
546
  'Some more description.',
@@ -540,7 +549,7 @@ describe 'Outline, Integration' do
540
549
  '| x |',
541
550
  '',
542
551
  '@example_tag',
543
- "#{@example_keyword}:",
552
+ "#{EXAMPLE_KEYWORD}:",
544
553
  '| value |',
545
554
  '| y |']
546
555
  source = source.join("\n")
@@ -549,19 +558,19 @@ describe 'Outline, Integration' do
549
558
  outline_output = outline.to_s.split("\n", -1)
550
559
 
551
560
  expect(outline_output).to eq(['@tag1 @tag2 @tag3',
552
- "#{@outline_keyword}: A outline with everything it could have",
561
+ "#{OUTLINE_KEYWORD}: A outline with everything it could have",
553
562
  '',
554
563
  'Including a description',
555
564
  'and then some.',
556
565
  '',
557
- " #{@step_keyword} a step",
566
+ " #{STEP_KEYWORD} a step",
558
567
  ' | value |',
559
- " #{@step_keyword} another step",
568
+ " #{STEP_KEYWORD} another step",
560
569
  ' """',
561
570
  ' some string',
562
571
  ' """',
563
572
  '',
564
- "#{@example_keyword}:",
573
+ "#{EXAMPLE_KEYWORD}:",
565
574
  '',
566
575
  'Some description.',
567
576
  'Some more description.',
@@ -570,7 +579,7 @@ describe 'Outline, Integration' do
570
579
  ' | x |',
571
580
  '',
572
581
  '@example_tag',
573
- "#{@example_keyword}:",
582
+ "#{EXAMPLE_KEYWORD}:",
574
583
  ' | value |',
575
584
  ' | y |'])
576
585
  end