cuke_modeler 1.2.1 → 1.3.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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.simplecov +1 -2
  3. data/.travis.yml +4 -3
  4. data/Gemfile +1 -1
  5. data/History.md +5 -0
  6. data/README.md +2 -1
  7. data/Rakefile +19 -0
  8. data/appveyor.yml +19 -18
  9. data/cuke_modeler.gemspec +1 -1
  10. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +1 -1
  11. data/lib/cuke_modeler/parsing.rb +1 -1
  12. data/lib/cuke_modeler/version.rb +1 -1
  13. data/testing/cucumber/features/analysis/test_comparison.feature +1 -4
  14. data/testing/cucumber/features/modeling/background_modeling.feature +1 -2
  15. data/testing/cucumber/features/modeling/background_output.feature +1 -2
  16. data/testing/cucumber/features/modeling/cell_modeling.feature +1 -2
  17. data/testing/cucumber/features/modeling/comment_modeling.feature +1 -2
  18. data/testing/cucumber/features/modeling/comment_output.feature +1 -2
  19. data/testing/cucumber/features/modeling/directory_modeling.feature +1 -4
  20. data/testing/cucumber/features/modeling/directory_output.feature +1 -2
  21. data/testing/cucumber/features/modeling/doc_string_modeling.feature +1 -3
  22. data/testing/cucumber/features/modeling/doc_string_output.feature +1 -2
  23. data/testing/cucumber/features/modeling/example_modeling.feature +1 -3
  24. data/testing/cucumber/features/modeling/example_output.feature +1 -2
  25. data/testing/cucumber/features/modeling/feature_file_modeling.feature +1 -3
  26. data/testing/cucumber/features/modeling/feature_file_output.feature +1 -2
  27. data/testing/cucumber/features/modeling/feature_modeling.feature +2 -5
  28. data/testing/cucumber/features/modeling/feature_output.feature +1 -2
  29. data/testing/cucumber/features/modeling/model_output.feature +1 -3
  30. data/testing/cucumber/features/modeling/model_structure.feature +3 -9
  31. data/testing/cucumber/features/modeling/outline_modeling.feature +1 -2
  32. data/testing/cucumber/features/modeling/outline_output.feature +1 -2
  33. data/testing/cucumber/features/modeling/row_modeling.feature +1 -2
  34. data/testing/cucumber/features/modeling/row_output.feature +1 -2
  35. data/testing/cucumber/features/modeling/scenario_modeling.feature +1 -2
  36. data/testing/cucumber/features/modeling/scenario_output.feature +1 -2
  37. data/testing/cucumber/features/modeling/step_modeling.feature +1 -2
  38. data/testing/cucumber/features/modeling/step_output.feature +1 -2
  39. data/testing/cucumber/features/modeling/table_modeling.feature +1 -2
  40. data/testing/cucumber/features/modeling/table_output.feature +1 -2
  41. data/testing/cucumber/features/modeling/tag_modeling.feature +1 -2
  42. data/testing/cucumber/features/modeling/tag_output.feature +1 -2
  43. data/testing/cucumber/step_definitions/directory_steps.rb +1 -1
  44. data/testing/cucumber/step_definitions/feature_file_steps.rb +1 -1
  45. data/testing/cucumber/step_definitions/modeling_steps.rb +1 -1
  46. data/testing/cucumber/step_definitions/setup_steps.rb +4 -6
  47. data/testing/cucumber/step_definitions/verification_steps.rb +3 -3
  48. data/testing/cucumber/support/env.rb +7 -14
  49. data/testing/file_helper.rb +44 -0
  50. data/testing/gemfiles/gherkin5.gemfile +20 -0
  51. data/testing/rspec/spec/integration/background_integration_spec.rb +17 -15
  52. data/testing/rspec/spec/integration/cell_integration_spec.rb +69 -79
  53. data/testing/rspec/spec/integration/comment_integration_spec.rb +16 -15
  54. data/testing/rspec/spec/integration/directory_integration_spec.rb +46 -55
  55. data/testing/rspec/spec/integration/doc_string_integration_spec.rb +73 -80
  56. data/testing/rspec/spec/integration/example_integration_spec.rb +53 -36
  57. data/testing/rspec/spec/integration/feature_file_integration_spec.rb +27 -42
  58. data/testing/rspec/spec/integration/feature_integration_spec.rb +12 -11
  59. data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +14 -16
  60. data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +14 -16
  61. data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +14 -16
  62. data/testing/rspec/spec/integration/outline_integration_spec.rb +20 -18
  63. data/testing/rspec/spec/integration/parsing_integration_spec.rb +1 -1
  64. data/testing/rspec/spec/integration/row_integration_spec.rb +57 -64
  65. data/testing/rspec/spec/integration/scenario_integration_spec.rb +17 -15
  66. data/testing/rspec/spec/integration/step_integration_spec.rb +48 -55
  67. data/testing/rspec/spec/integration/table_integration_spec.rb +54 -61
  68. data/testing/rspec/spec/integration/tag_integration_spec.rb +61 -67
  69. data/testing/rspec/spec/spec_helper.rb +5 -16
  70. data/testing/rspec/spec/unit/background_unit_spec.rb +0 -5
  71. data/testing/rspec/spec/unit/cell_unit_spec.rb +0 -5
  72. data/testing/rspec/spec/unit/comment_unit_spec.rb +0 -6
  73. data/testing/rspec/spec/unit/directory_unit_spec.rb +0 -5
  74. data/testing/rspec/spec/unit/doc_string_unit_spec.rb +0 -5
  75. data/testing/rspec/spec/unit/example_unit_spec.rb +0 -5
  76. data/testing/rspec/spec/unit/feature_file_unit_spec.rb +0 -5
  77. data/testing/rspec/spec/unit/feature_unit_spec.rb +0 -5
  78. data/testing/rspec/spec/unit/outline_unit_spec.rb +0 -5
  79. data/testing/rspec/spec/unit/row_unit_spec.rb +0 -5
  80. data/testing/rspec/spec/unit/scenario_unit_spec.rb +0 -5
  81. data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +1 -1
  82. data/testing/rspec/spec/unit/step_unit_spec.rb +0 -5
  83. data/testing/rspec/spec/unit/table_unit_spec.rb +0 -5
  84. data/testing/rspec/spec/unit/tag_unit_spec.rb +0 -5
  85. data/todo.txt +0 -4
  86. metadata +6 -4
@@ -420,8 +420,26 @@ describe 'Example, Integration' do
420
420
  source = "#{@example_keyword}:\n|param1|param2|\n|value1|value2|"
421
421
  example = clazz.new(source)
422
422
 
423
- hash_row = {'param1' => 'param1 ', 'param2' => ' param2'}
424
- array_row = ['param1', ' param2 ']
423
+ hash_row = {'param1' => 'param1', 'param2' => 'param2'}
424
+ array_row = ['param1', 'param2']
425
+
426
+ example.remove_row(hash_row)
427
+ row_cell_values = example.rows.collect { |row| row.cells.collect { |cell| cell.value } }
428
+
429
+ expect(row_cell_values).to eq([['param1', 'param2'], ['value1', 'value2']])
430
+
431
+ example.remove_row(array_row)
432
+ row_cell_values = example.rows.collect { |row| row.cells.collect { |cell| cell.value } }
433
+
434
+ expect(row_cell_values).to eq([['param1', 'param2'], ['value1', 'value2']])
435
+ end
436
+
437
+ it 'will remove an argument row that is the same as the parameter row' do
438
+ source = "#{@example_keyword}:\n|param1|param2|\n|value1|value2|\n|param1|param2|"
439
+ example = clazz.new(source)
440
+
441
+ hash_row = {'param1' => 'param1', 'param2' => 'param2'}
442
+ array_row = ['param1', 'param2']
425
443
 
426
444
  example.remove_row(hash_row)
427
445
  row_cell_values = example.rows.collect { |row| row.cells.collect { |cell| cell.value } }
@@ -440,69 +458,68 @@ describe 'Example, Integration' do
440
458
  describe 'getting ancestors' do
441
459
 
442
460
  before(:each) do
443
- source = "#{@feature_keyword}: Test feature
461
+ CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'example_test_file', :directory => test_directory)
462
+ end
444
463
 
445
- #{@outline_keyword}: Test test
446
- #{@step_keyword} a step
447
- #{@example_keyword}: Test example
448
- | a param |
449
- | a value |"
450
464
 
451
- file_path = "#{@default_file_directory}/example_test_file.feature"
452
- File.open(file_path, 'w') { |file| file.write(source) }
453
- end
465
+ let(:test_directory) { CukeModeler::FileHelper.create_directory }
466
+ let(:source_gherkin) { "#{@feature_keyword}: Test feature
467
+
468
+ #{@outline_keyword}: Test test
469
+ #{@step_keyword} a step
470
+ #{@example_keyword}: Test example
471
+ | a param |
472
+ | a value |"
473
+ }
454
474
 
455
- let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
456
- let(:example) { directory.feature_files.first.feature.tests.first.examples.first }
475
+ let(:directory_model) { CukeModeler::Directory.new(test_directory) }
476
+ let(:example_model) { directory_model.feature_files.first.feature.tests.first.examples.first }
457
477
 
458
478
 
459
479
  it 'can get its directory' do
460
- ancestor = example.get_ancestor(:directory)
480
+ ancestor = example_model.get_ancestor(:directory)
461
481
 
462
- expect(ancestor).to equal(directory)
482
+ expect(ancestor).to equal(directory_model)
463
483
  end
464
484
 
465
485
  it 'can get its feature file' do
466
- ancestor = example.get_ancestor(:feature_file)
486
+ ancestor = example_model.get_ancestor(:feature_file)
467
487
 
468
- expect(ancestor).to equal(directory.feature_files.first)
488
+ expect(ancestor).to equal(directory_model.feature_files.first)
469
489
  end
470
490
 
471
491
  it 'can get its feature' do
472
- ancestor = example.get_ancestor(:feature)
492
+ ancestor = example_model.get_ancestor(:feature)
473
493
 
474
- expect(ancestor).to equal(directory.feature_files.first.feature)
494
+ expect(ancestor).to equal(directory_model.feature_files.first.feature)
475
495
  end
476
496
 
477
497
  context 'an example that is part of an outline' do
478
498
 
479
- before(:each) do
480
- source = "#{@feature_keyword}: Test feature
481
-
482
- #{@outline_keyword}: Test outline
483
- #{@step_keyword} a step
484
- #{@example_keyword}:
485
- | param |
486
- | value |"
487
-
488
- file_path = "#{@default_file_directory}/example_test_file.feature"
489
- File.open(file_path, 'w') { |file| file.write(source) }
490
- end
499
+ let(:test_directory) { CukeModeler::FileHelper.create_directory }
500
+ let(:source_gherkin) { "#{@feature_keyword}: Test feature
501
+
502
+ #{@outline_keyword}: Test outline
503
+ #{@step_keyword} a step
504
+ #{@example_keyword}:
505
+ | param |
506
+ | value |"
507
+ }
491
508
 
492
- let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
493
- let(:example) { directory.feature_files.first.feature.tests.first.examples.first }
509
+ let(:directory_model) { CukeModeler::Directory.new(test_directory) }
510
+ let(:example_model) { directory_model.feature_files.first.feature.tests.first.examples.first }
494
511
 
495
512
 
496
513
  it 'can get its outline' do
497
- ancestor = example.get_ancestor(:outline)
514
+ ancestor = example_model.get_ancestor(:outline)
498
515
 
499
- expect(ancestor).to equal(directory.feature_files.first.feature.tests.first)
516
+ expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
500
517
  end
501
518
 
502
519
  end
503
520
 
504
521
  it 'returns nil if it does not have the requested type of ancestor' do
505
- ancestor = example.get_ancestor(:example)
522
+ ancestor = example_model.get_ancestor(:example)
506
523
 
507
524
  expect(ancestor).to be_nil
508
525
  end
@@ -15,10 +15,9 @@ describe 'FeatureFile, Integration' do
15
15
  describe 'unique behavior' do
16
16
 
17
17
  it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
18
- path = "#{@default_file_directory}/#{@default_feature_file_name}"
19
- File.open(path, "w") { |file| file.puts "#{@feature_keyword}: test feature" }
18
+ test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{@feature_keyword}: test feature", :name => 'test_file')
20
19
 
21
- feature_file = clazz.new(path)
20
+ feature_file = clazz.new(test_file_path)
22
21
  data = feature_file.parsing_data
23
22
 
24
23
  expect(data.keys).to match_array([:type, :feature, :comments])
@@ -26,10 +25,9 @@ describe 'FeatureFile, Integration' do
26
25
  end
27
26
 
28
27
  it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
29
- path = "#{@default_file_directory}/#{@default_feature_file_name}"
30
- File.open(path, "w") { |file| file.puts "#{@feature_keyword}: test feature" }
28
+ test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{@feature_keyword}: test feature", :name => 'test_file')
31
29
 
32
- feature_file = clazz.new(path)
30
+ feature_file = clazz.new(test_file_path)
33
31
  data = feature_file.parsing_data
34
32
 
35
33
  # There is no parsing data stored above the feature level for gherkin 3.x
@@ -37,10 +35,9 @@ describe 'FeatureFile, Integration' do
37
35
  end
38
36
 
39
37
  it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
40
- path = "#{@default_file_directory}/#{@default_feature_file_name}"
41
- File.open(path, "w") { |file| file.puts "#{@feature_keyword}: test feature" }
38
+ test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{@feature_keyword}: test feature", :name => 'test_file')
42
39
 
43
- feature_file = clazz.new(path)
40
+ feature_file = clazz.new(test_file_path)
44
41
  data = feature_file.parsing_data
45
42
 
46
43
  # There is no parsing data stored above the feature level for gherkin 2.x
@@ -48,14 +45,13 @@ describe 'FeatureFile, Integration' do
48
45
  end
49
46
 
50
47
  it 'provides its own filename when being parsed' do
51
- path = "#{@default_file_directory}/#{@default_feature_file_name}"
52
- File.open(path, "w") { |file| file.puts 'bad feature text' }
48
+ test_file_path = CukeModeler::FileHelper.create_feature_file(:text => 'bad feature text', :name => 'test_file')
53
49
 
54
- expect { clazz.new(path) }.to raise_error(/'#{path}'/)
50
+ expect { clazz.new(test_file_path) }.to raise_error(/'#{test_file_path}'/)
55
51
  end
56
52
 
57
53
  it 'cannot model a non-existent feature file' do
58
- path = "#{@default_file_directory}/missing_file.txt"
54
+ path = "#{CukeModeler::FileHelper.create_directory}/missing_file.feature"
59
55
 
60
56
  expect { clazz.new(path) }.to raise_error(ArgumentError)
61
57
  end
@@ -64,15 +60,15 @@ describe 'FeatureFile, Integration' do
64
60
  describe 'model population' do
65
61
 
66
62
  let(:source_text) { "#{@feature_keyword}: Test feature" }
67
- let(:feature_file_path) { "#{@default_file_directory}/#{@default_feature_file_name}" }
63
+ let(:feature_file_path) { CukeModeler::FileHelper.create_feature_file }
68
64
  let(:feature_file) { clazz.new(feature_file_path) }
69
65
 
70
66
  before(:each) do
71
- File.open(feature_file_path, "w") { |file| file.puts source_text }
67
+ File.open(feature_file_path, 'w') { |file| file.write(source_text) }
72
68
  end
73
69
 
74
70
  it "models the feature file's name" do
75
- expect(feature_file.name).to eq(@default_feature_file_name)
71
+ expect(feature_file.name).to eq(File.basename(feature_file_path))
76
72
  end
77
73
 
78
74
  it "models the feature file's path" do
@@ -149,7 +145,7 @@ describe 'FeatureFile, Integration' do
149
145
  | value |
150
146
  # final comment"
151
147
 
152
- File.open(feature_file_path, "w") { |file| file.puts source_text }
148
+ File.open(feature_file_path, 'w') { |file| file.write(source_text) }
153
149
 
154
150
  feature_file = clazz.new(feature_file_path)
155
151
  comments = feature_file.comments.collect { |comment| comment.text }
@@ -180,12 +176,6 @@ describe 'FeatureFile, Integration' do
180
176
  context 'an empty feature file', :gherkin3 => false do
181
177
 
182
178
  let(:source_text) { '' }
183
- let(:feature_file_path) { "#{@default_file_directory}/#{@default_feature_file_name}" }
184
- let(:feature_file) { clazz.new(feature_file_path) }
185
-
186
- before(:each) do
187
- File.open(feature_file_path, "w") { |file| file.puts source_text }
188
- end
189
179
 
190
180
 
191
181
  it "models the feature file's feature" do
@@ -197,11 +187,7 @@ describe 'FeatureFile, Integration' do
197
187
  end
198
188
 
199
189
  it 'properly sets its child models' do
200
- file_path = "#{@default_file_directory}/#{@default_feature_file_name}"
201
-
202
- File.open(file_path, "w") { |file|
203
- file.puts("#{@feature_keyword}: Test feature")
204
- }
190
+ file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{@feature_keyword}: Test feature", :name => 'test_file')
205
191
 
206
192
  file = clazz.new(file_path)
207
193
  feature = file.feature
@@ -212,23 +198,25 @@ describe 'FeatureFile, Integration' do
212
198
 
213
199
  describe 'getting ancestors' do
214
200
 
201
+ let(:directory_path) { CukeModeler::FileHelper.create_directory }
202
+ let(:feature_file_path) { CukeModeler::FileHelper.create_feature_file(:text => '', :name => 'feature_file_test_file', :directory => directory_path) }
203
+
215
204
  before(:each) do
216
- file_path = "#{@default_file_directory}/feature_file_test_file.feature"
217
- File.open(file_path, 'w') { |file| file.write("#{@feature_keyword}: Test feature") }
205
+ File.open(feature_file_path, 'w') { |file| file.write("#{@feature_keyword}: Test feature") }
218
206
  end
219
207
 
220
- let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
221
- let(:feature_file) { directory.feature_files.first }
208
+ let(:directory_model) { CukeModeler::Directory.new(directory_path) }
209
+ let(:feature_file_model) { directory_model.feature_files.first }
222
210
 
223
211
 
224
212
  it 'can get its directory' do
225
- ancestor = feature_file.get_ancestor(:directory)
213
+ ancestor = feature_file_model.get_ancestor(:directory)
226
214
 
227
- expect(ancestor).to equal(directory)
215
+ expect(ancestor).to equal(directory_model)
228
216
  end
229
217
 
230
218
  it 'returns nil if it does not have the requested type of ancestor' do
231
- ancestor = feature_file.get_ancestor(:example)
219
+ ancestor = feature_file_model.get_ancestor(:example)
232
220
 
233
221
  expect(ancestor).to be_nil
234
222
  end
@@ -241,11 +229,11 @@ describe 'FeatureFile, Integration' do
241
229
  context 'from source text' do
242
230
 
243
231
  let(:source_text) { "#{@feature_keyword}: Test feature" }
244
- let(:feature_file_path) { "#{@default_file_directory}/#{@default_feature_file_name}" }
232
+ let(:feature_file_path) { CukeModeler::FileHelper.create_feature_file(:text => '', :name => 'feature_file_test_file') }
245
233
  let(:feature_file) { clazz.new(feature_file_path) }
246
234
 
247
235
  before(:each) do
248
- File.open(feature_file_path, "w") { |file| file.puts source_text }
236
+ File.open(feature_file_path, 'w') { |file| file.write(source_text) }
249
237
  end
250
238
 
251
239
 
@@ -258,11 +246,8 @@ describe 'FeatureFile, Integration' do
258
246
  end
259
247
 
260
248
  it 'can be remade from its own output' do
261
- path = "#{@default_file_directory}/#{@default_feature_file_name}"
262
- File.open(path, "w") { |file| file.puts "#{@feature_keyword}:" }
263
-
264
- source = path
265
- feature_file = clazz.new(source)
249
+ path = CukeModeler::FileHelper.create_feature_file(:text => "#{@feature_keyword}:", :name => 'feature_file_test_file')
250
+ feature_file = clazz.new(path)
266
251
 
267
252
  feature_file_output = feature_file.to_s
268
253
  remade_feature_file_output = clazz.new(feature_file_output).to_s
@@ -277,30 +277,31 @@ describe 'Feature, Integration' do
277
277
  describe 'getting ancestors' do
278
278
 
279
279
  before(:each) do
280
- source = "#{@feature_keyword}: Test feature"
281
-
282
- file_path = "#{@default_file_directory}/feature_test_file.feature"
283
- File.open(file_path, 'w') { |file| file.write(source) }
280
+ CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'feature_test_file', :directory => test_directory)
284
281
  end
285
282
 
286
- let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
287
- let(:feature) { directory.feature_files.first.feature }
283
+
284
+ let(:test_directory) { CukeModeler::FileHelper.create_directory }
285
+ let(:source_gherkin) { "#{@feature_keyword}: Test feature" }
286
+
287
+ let(:directory_model) { CukeModeler::Directory.new(test_directory) }
288
+ let(:feature_model) { directory_model.feature_files.first.feature }
288
289
 
289
290
 
290
291
  it 'can get its directory' do
291
- ancestor = feature.get_ancestor(:directory)
292
+ ancestor = feature_model.get_ancestor(:directory)
292
293
 
293
- expect(ancestor).to equal(directory)
294
+ expect(ancestor).to equal(directory_model)
294
295
  end
295
296
 
296
297
  it 'can get its feature file' do
297
- ancestor = feature.get_ancestor(:feature_file)
298
+ ancestor = feature_model.get_ancestor(:feature_file)
298
299
 
299
- expect(ancestor).to equal(directory.feature_files.first)
300
+ expect(ancestor).to equal(directory_model.feature_files.first)
300
301
  end
301
302
 
302
303
  it 'returns nil if it does not have the requested type of ancestor' do
303
- ancestor = feature.get_ancestor(:test)
304
+ ancestor = feature_model.get_ancestor(:test)
304
305
 
305
306
  expect(ancestor).to be_nil
306
307
  end
@@ -67,21 +67,19 @@ describe 'Gherkin2Adapter, Integration', :gherkin2 => true do
67
67
  | param |
68
68
  | value |
69
69
  # final comment" }
70
- let(:feature_file) { path = "#{@default_file_directory}/#{@default_feature_file_name}"
71
- File.open(path, "w") { |file| file.puts source_text }
72
-
73
- CukeModeler::FeatureFile.new(path) }
74
- let(:feature) { feature_file.feature }
70
+ let(:feature_file_model) { test_file_path = CukeModeler::FileHelper.create_feature_file(:text => source_text, :name => 'adapter_test_file')
71
+ CukeModeler::FeatureFile.new(test_file_path) }
72
+ let(:feature_model) { feature_file_model.feature }
75
73
 
76
74
 
77
75
  it "does not store parsing data for a feature file's children" do
78
- model = feature_file
76
+ model = feature_file_model
79
77
 
80
78
  expect(model.parsing_data).to eq([])
81
79
  end
82
80
 
83
81
  it "does not store parsing data for a feature's children" do
84
- model = feature
82
+ model = feature_model
85
83
 
86
84
  expect(model.parsing_data['comments']).to be_nil
87
85
  expect(model.parsing_data['tags']).to be_nil
@@ -89,14 +87,14 @@ describe 'Gherkin2Adapter, Integration', :gherkin2 => true do
89
87
  end
90
88
 
91
89
  it "does not store parsing data for a background's children" do
92
- model = feature.background
90
+ model = feature_model.background
93
91
 
94
92
  expect(model.parsing_data['comments']).to be_nil
95
93
  expect(model.parsing_data['steps']).to be_nil
96
94
  end
97
95
 
98
96
  it "does not store parsing data for a scenario's children" do
99
- model = feature.scenarios.first
97
+ model = feature_model.scenarios.first
100
98
 
101
99
  expect(model.parsing_data['comments']).to be_nil
102
100
  expect(model.parsing_data['tags']).to be_nil
@@ -104,7 +102,7 @@ describe 'Gherkin2Adapter, Integration', :gherkin2 => true do
104
102
  end
105
103
 
106
104
  it "does not store parsing data for an outline's children" do
107
- model = feature.outlines.first
105
+ model = feature_model.outlines.first
108
106
 
109
107
  expect(model.parsing_data['comments']).to be_nil
110
108
  expect(model.parsing_data['tags']).to be_nil
@@ -113,7 +111,7 @@ describe 'Gherkin2Adapter, Integration', :gherkin2 => true do
113
111
  end
114
112
 
115
113
  it "does not store parsing data for an example's children" do
116
- model = feature.outlines.first.examples.first
114
+ model = feature_model.outlines.first.examples.first
117
115
 
118
116
  expect(model.parsing_data['comments']).to be_nil
119
117
  expect(model.parsing_data['tags']).to be_nil
@@ -121,34 +119,34 @@ describe 'Gherkin2Adapter, Integration', :gherkin2 => true do
121
119
  end
122
120
 
123
121
  it "does not store parsing data for an example row's children" do
124
- model = feature.outlines.first.examples.first.rows.first
122
+ model = feature_model.outlines.first.examples.first.rows.first
125
123
 
126
124
  expect(model.parsing_data['comments']).to be_nil
127
125
  expect(model.parsing_data['cells']).to be_nil
128
126
  end
129
127
 
130
128
  it "does not store parsing data for a step's children, table" do
131
- model = feature.outlines.first.steps.first
129
+ model = feature_model.outlines.first.steps.first
132
130
 
133
131
  expect(model.parsing_data['comments']).to be_nil
134
132
  expect(model.parsing_data['rows']).to be_nil
135
133
  end
136
134
 
137
135
  it "does not store parsing data for a step's children, doc string" do
138
- model = feature.outlines.first.steps.last
136
+ model = feature_model.outlines.first.steps.last
139
137
 
140
138
  expect(model.parsing_data['comments']).to be_nil
141
139
  expect(model.parsing_data['doc_string']).to be_nil
142
140
  end
143
141
 
144
142
  it "does not store parsing data for a table's children" do
145
- model = feature.outlines.first.steps.first.block
143
+ model = feature_model.outlines.first.steps.first.block
146
144
 
147
145
  expect(model.parsing_data).to be_empty
148
146
  end
149
147
 
150
148
  it "does not store parsing data for a table row's children" do
151
- model = feature.outlines.first.steps.first.block.rows.first
149
+ model = feature_model.outlines.first.steps.first.block.rows.first
152
150
 
153
151
  expect(model.parsing_data['comments']).to be_nil
154
152
  expect(model.parsing_data['cells']).to be_nil
@@ -67,21 +67,19 @@ describe 'Gherkin3Adapter, Integration', :gherkin3 => true do
67
67
  | param |
68
68
  | value |
69
69
  # final comment" }
70
- let(:feature_file) { path = "#{@default_file_directory}/#{@default_feature_file_name}"
71
- File.open(path, "w") { |file| file.puts source_text }
72
-
73
- CukeModeler::FeatureFile.new(path) }
74
- let(:feature) { feature_file.feature }
70
+ let(:feature_file_model) { test_file_path = CukeModeler::FileHelper.create_feature_file(:text => source_text, :name => 'adapter_test_file')
71
+ CukeModeler::FeatureFile.new(test_file_path) }
72
+ let(:feature_model) { feature_file_model.feature }
75
73
 
76
74
 
77
75
  it "does not store parsing data for a feature file's children" do
78
- model = feature_file
76
+ model = feature_file_model
79
77
 
80
78
  expect(model.parsing_data).to be_nil
81
79
  end
82
80
 
83
81
  it "does not store parsing data for a feature's children" do
84
- model = feature
82
+ model = feature_model
85
83
 
86
84
  expect(model.parsing_data[:comments]).to be_nil
87
85
  expect(model.parsing_data[:tags]).to be_nil
@@ -90,20 +88,20 @@ describe 'Gherkin3Adapter, Integration', :gherkin3 => true do
90
88
  end
91
89
 
92
90
  it "does not store parsing data for a background's children" do
93
- model = feature.background
91
+ model = feature_model.background
94
92
 
95
93
  expect(model.parsing_data[:steps]).to be_nil
96
94
  end
97
95
 
98
96
  it "does not store parsing data for a scenario's children" do
99
- model = feature.scenarios.first
97
+ model = feature_model.scenarios.first
100
98
 
101
99
  expect(model.parsing_data[:tags]).to be_nil
102
100
  expect(model.parsing_data[:steps]).to be_nil
103
101
  end
104
102
 
105
103
  it "does not store parsing data for an outline's children" do
106
- model = feature.outlines.first
104
+ model = feature_model.outlines.first
107
105
 
108
106
  expect(model.parsing_data[:tags]).to be_nil
109
107
  expect(model.parsing_data[:steps]).to be_nil
@@ -111,7 +109,7 @@ describe 'Gherkin3Adapter, Integration', :gherkin3 => true do
111
109
  end
112
110
 
113
111
  it "does not store parsing data for an example's children" do
114
- model = feature.outlines.first.examples.first
112
+ model = feature_model.outlines.first.examples.first
115
113
 
116
114
  expect(model.parsing_data[:tags]).to be_nil
117
115
  expect(model.parsing_data[:tableHeader]).to be_nil
@@ -119,31 +117,31 @@ describe 'Gherkin3Adapter, Integration', :gherkin3 => true do
119
117
  end
120
118
 
121
119
  it "does not store parsing data for an example row's children" do
122
- model = feature.outlines.first.examples.first.rows.first
120
+ model = feature_model.outlines.first.examples.first.rows.first
123
121
 
124
122
  expect(model.parsing_data[:cells]).to be_nil
125
123
  end
126
124
 
127
125
  it "does not store parsing data for a step's children, table" do
128
- model = feature.outlines.first.steps.first
126
+ model = feature_model.outlines.first.steps.first
129
127
 
130
128
  expect(model.parsing_data[:argument]).to be_nil
131
129
  end
132
130
 
133
131
  it "does not store parsing data for a step's children, doc string" do
134
- model = feature.outlines.first.steps.last
132
+ model = feature_model.outlines.first.steps.last
135
133
 
136
134
  expect(model.parsing_data[:argument]).to be_nil
137
135
  end
138
136
 
139
137
  it "does not store parsing data for a table's children" do
140
- model = feature.outlines.first.steps.first.block
138
+ model = feature_model.outlines.first.steps.first.block
141
139
 
142
140
  expect(model.parsing_data[:rows]).to be_nil
143
141
  end
144
142
 
145
143
  it "does not store parsing data for a table row's children" do
146
- model = feature.outlines.first.steps.first.block.rows.first
144
+ model = feature_model.outlines.first.steps.first.block.rows.first
147
145
 
148
146
  expect(model.parsing_data[:cells]).to be_nil
149
147
  end