cuke_modeler 2.0.0 → 2.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +51 -33
  3. data/CHANGELOG.md +13 -2
  4. data/Gemfile +9 -2
  5. data/appveyor.yml +29 -2
  6. data/cuke_modeler.gemspec +1 -1
  7. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +1 -1
  8. data/lib/cuke_modeler/adapters/gherkin_5_adapter.rb +12 -0
  9. data/lib/cuke_modeler/adapters/gherkin_7_adapter.rb +307 -0
  10. data/lib/cuke_modeler/adapters/gherkin_8_adapter.rb +12 -0
  11. data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +12 -0
  12. data/lib/cuke_modeler/parsing.rb +116 -108
  13. data/lib/cuke_modeler/version.rb +1 -1
  14. data/testing/gemfiles/gherkin7.gemfile +9 -0
  15. data/testing/gemfiles/gherkin8.gemfile +9 -0
  16. data/testing/gemfiles/gherkin9.gemfile +9 -0
  17. data/testing/helper_methods.rb +23 -0
  18. data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +1 -1
  19. data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +1 -1
  20. data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +1 -1
  21. data/testing/rspec/spec/integration/adapters/gherkin_5_adapter_spec.rb +165 -0
  22. data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +1 -8
  23. data/testing/rspec/spec/integration/adapters/gherkin_7_adapter_spec.rb +162 -0
  24. data/testing/rspec/spec/integration/adapters/gherkin_8_adapter_spec.rb +162 -0
  25. data/testing/rspec/spec/integration/adapters/gherkin_9_adapter_spec.rb +162 -0
  26. data/testing/rspec/spec/integration/models/background_integration_spec.rb +19 -23
  27. data/testing/rspec/spec/integration/models/cell_integration_spec.rb +27 -24
  28. data/testing/rspec/spec/integration/models/comment_integration_spec.rb +26 -23
  29. data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +19 -23
  30. data/testing/rspec/spec/integration/models/example_integration_spec.rb +50 -38
  31. data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +32 -28
  32. data/testing/rspec/spec/integration/models/feature_integration_spec.rb +28 -23
  33. data/testing/rspec/spec/integration/models/outline_integration_spec.rb +39 -44
  34. data/testing/rspec/spec/integration/models/row_integration_spec.rb +35 -23
  35. data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +19 -23
  36. data/testing/rspec/spec/integration/models/step_integration_spec.rb +51 -47
  37. data/testing/rspec/spec/integration/models/table_integration_spec.rb +19 -23
  38. data/testing/rspec/spec/integration/models/tag_integration_spec.rb +35 -23
  39. data/testing/rspec/spec/integration/parsing_integration_spec.rb +27 -6
  40. data/testing/rspec/spec/spec_helper.rb +39 -46
  41. metadata +16 -4
@@ -37,36 +37,32 @@ describe 'Background, Integration' do
37
37
  end
38
38
  end
39
39
 
40
- it 'stores the original data generated by the parsing adapter', :gherkin6 => true do
41
- background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
42
- data = background.parsing_data
40
+ describe 'parsing data' do
43
41
 
44
- expect(data.keys).to match_array([:background, :rule, :scenario])
45
- expect(data[:background][:name]).to eq('test background')
46
- end
42
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
43
+ background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
44
+ data = background.parsing_data
47
45
 
48
- it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
49
- background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
50
- data = background.parsing_data
46
+ expect(data.keys).to match_array([:background, :rule, :scenario])
47
+ expect(data[:background][:name]).to eq('test background')
48
+ end
51
49
 
52
- expect(data.keys).to match_array([:type, :location, :keyword, :name, :steps, :description])
53
- expect(data[:type]).to eq(:Background)
54
- end
50
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
51
+ background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
52
+ data = background.parsing_data
55
53
 
56
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
57
- background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
58
- data = background.parsing_data
54
+ expect(data.keys).to match_array([:type, :location, :keyword, :name, :steps, :description])
55
+ expect(data[:type]).to eq(:Background)
56
+ end
59
57
 
60
- expect(data.keys).to match_array([:type, :location, :keyword, :name, :steps, :description])
61
- expect(data[:type]).to eq(:Background)
62
- end
58
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
59
+ background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
60
+ data = background.parsing_data
63
61
 
64
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
65
- background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
66
- data = background.parsing_data
62
+ expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'steps', 'type'])
63
+ expect(data['keyword']).to eq('Background')
64
+ end
67
65
 
68
- expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'steps', 'type'])
69
- expect(data['keyword']).to eq('Background')
70
66
  end
71
67
 
72
68
  it 'provides a descriptive filename when being parsed from stand alone text' do
@@ -44,38 +44,41 @@ describe 'Cell, Integration' do
44
44
  expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_cell\.feature'/)
45
45
  end
46
46
 
47
- it 'stores the original data generated by the parsing adapter', :gherkin6 => true do
48
- cell = clazz.new('a cell')
49
- data = cell.parsing_data
47
+ describe 'parsing data' do
50
48
 
51
- expect(data.keys).to match_array([:location, :value])
52
- expect(data[:value]).to eq('a cell')
53
- end
49
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
50
+ cell = clazz.new('a cell')
51
+ data = cell.parsing_data
54
52
 
55
- it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
56
- cell = clazz.new('a cell')
57
- data = cell.parsing_data
53
+ expect(data.keys).to match_array([:location, :value])
54
+ expect(data[:value]).to eq('a cell')
55
+ end
58
56
 
59
- expect(data.keys).to match_array([:type, :location, :value])
60
- expect(data[:type]).to eq(:TableCell)
61
- end
57
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
58
+ cell = clazz.new('a cell')
59
+ data = cell.parsing_data
62
60
 
63
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
64
- cell = clazz.new("a cell")
65
- data = cell.parsing_data
61
+ expect(data.keys).to match_array([:type, :location, :value])
62
+ expect(data[:type]).to eq(:TableCell)
63
+ end
66
64
 
67
- expect(data.keys).to match_array([:type, :location, :value])
68
- expect(data[:type]).to eq('TableCell')
69
- end
65
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
66
+ cell = clazz.new("a cell")
67
+ data = cell.parsing_data
70
68
 
71
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
72
- cell = clazz.new("a cell")
73
- data = cell.parsing_data
69
+ expect(data.keys).to match_array([:type, :location, :value])
70
+ expect(data[:type]).to eq('TableCell')
71
+ end
74
72
 
75
- # Cells did not exist as full fledged objects in the Gherkin2 parser
76
- expect(data).to eq('a cell')
77
- end
73
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
74
+ cell = clazz.new("a cell")
75
+ data = cell.parsing_data
78
76
 
77
+ # Cells did not exist as full fledged objects in the Gherkin2 parser
78
+ expect(data).to eq('a cell')
79
+ end
80
+
81
+ end
79
82
 
80
83
  describe 'getting ancestors' do
81
84
 
@@ -44,37 +44,40 @@ describe 'Comment, Integration' do
44
44
  expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_comment\.feature'/)
45
45
  end
46
46
 
47
- it 'stores the original data generated by the parsing adapter', :gherkin6 => true do
48
- comment = clazz.new('# a comment')
49
- data = comment.parsing_data
47
+ describe 'parsing data' do
50
48
 
51
- expect(data.keys).to match_array([:location, :text])
52
- expect(data[:text]).to eq('# a comment')
53
- end
49
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
50
+ comment = clazz.new('# a comment')
51
+ data = comment.parsing_data
54
52
 
55
- it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
56
- comment = clazz.new('# a comment')
57
- data = comment.parsing_data
53
+ expect(data.keys).to match_array([:location, :text])
54
+ expect(data[:text]).to eq('# a comment')
55
+ end
58
56
 
59
- expect(data.keys).to match_array([:type, :location, :text])
60
- expect(data[:type]).to eq(:Comment)
61
- end
57
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
58
+ comment = clazz.new('# a comment')
59
+ data = comment.parsing_data
62
60
 
63
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
64
- comment = clazz.new('# a comment')
65
- data = comment.parsing_data
61
+ expect(data.keys).to match_array([:type, :location, :text])
62
+ expect(data[:type]).to eq(:Comment)
63
+ end
66
64
 
67
- expect(data.keys).to match_array([:type, :location, :text])
68
- expect(data[:type]).to eq('Comment')
69
- end
65
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
66
+ comment = clazz.new('# a comment')
67
+ data = comment.parsing_data
70
68
 
71
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
72
- comment = clazz.new('# a comment')
73
- data = comment.parsing_data
69
+ expect(data.keys).to match_array([:type, :location, :text])
70
+ expect(data[:type]).to eq('Comment')
71
+ end
74
72
 
75
- expect(data.keys).to match_array(['value', 'line'])
76
- end
73
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
74
+ comment = clazz.new('# a comment')
75
+ data = comment.parsing_data
77
76
 
77
+ expect(data.keys).to match_array(['value', 'line'])
78
+ end
79
+
80
+ end
78
81
 
79
82
  describe 'getting ancestors' do
80
83
 
@@ -43,36 +43,32 @@ describe 'DocString, Integration' do
43
43
  expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_doc_string\.feature'/)
44
44
  end
45
45
 
46
- it 'stores the original data generated by the parsing adapter', :gherkin6 => true do
47
- doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
48
- data = doc_string.parsing_data
46
+ describe 'parsing data' do
49
47
 
50
- expect(data.keys).to match_array([:location, :content, :content_type, :delimiter])
51
- expect(data[:content]).to eq('some doc string')
52
- end
48
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
49
+ doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
50
+ data = doc_string.parsing_data
53
51
 
54
- it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
55
- doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
56
- data = doc_string.parsing_data
52
+ expect(data.keys).to match_array([:location, :content, :content_type, :delimiter])
53
+ expect(data[:content]).to eq('some doc string')
54
+ end
57
55
 
58
- expect(data.keys).to match_array([:type, :location, :content, :contentType])
59
- expect(data[:type]).to eq(:DocString)
60
- end
56
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
57
+ doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
58
+ data = doc_string.parsing_data
61
59
 
62
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
63
- doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
64
- data = doc_string.parsing_data
60
+ expect(data.keys).to match_array([:type, :location, :content, :contentType])
61
+ expect(data[:type]).to eq(:DocString)
62
+ end
65
63
 
66
- expect(data.keys).to match_array([:type, :location, :content, :contentType])
67
- expect(data[:type]).to eq(:DocString)
68
- end
64
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
65
+ doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
66
+ data = doc_string.parsing_data
69
67
 
70
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
71
- doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
72
- data = doc_string.parsing_data
68
+ expect(data.keys).to match_array(['value', 'content_type', 'line'])
69
+ expect(data['value']).to eq('some doc string')
70
+ end
73
71
 
74
- expect(data.keys).to match_array(['value', 'content_type', 'line'])
75
- expect(data['value']).to eq('some doc string')
76
72
  end
77
73
 
78
74
  it 'stores its content as a String' do
@@ -15,19 +15,13 @@ describe 'Example, Integration' do
15
15
 
16
16
  describe 'unique behavior' do
17
17
 
18
- it 'can be instantiated with the minimum viable Gherkin', :gherkin6 => true do
18
+ it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(4, 5, 6, 7, 8, 9) do
19
19
  source = "#{EXAMPLE_KEYWORD}:"
20
20
 
21
21
  expect { @model = clazz.new(source) }.to_not raise_error
22
22
  end
23
23
 
24
- it 'can be instantiated with the minimum viable Gherkin', :gherkin4_5 => true do
25
- source = "#{EXAMPLE_KEYWORD}:"
26
-
27
- expect { @model = clazz.new(source) }.to_not raise_error
28
- end
29
-
30
- it 'can be instantiated with the minimum viable Gherkin', :gherkin3 => true do
24
+ it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(3) do
31
25
  source = "#{EXAMPLE_KEYWORD}:
32
26
  |param|
33
27
  |value|"
@@ -35,7 +29,7 @@ describe 'Example, Integration' do
35
29
  expect { @model = clazz.new(source) }.to_not raise_error
36
30
  end
37
31
 
38
- it 'can be instantiated with the minimum viable Gherkin', :gherkin2 => true do
32
+ it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(2) do
39
33
  source = "#{EXAMPLE_KEYWORD}:
40
34
  |param|"
41
35
 
@@ -61,36 +55,32 @@ describe 'Example, Integration' do
61
55
  end
62
56
  end
63
57
 
64
- it 'stores the original data generated by the parsing adapter', :gherkin6 => true do
65
- example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
66
- data = example.parsing_data
58
+ describe 'parsing data' do
67
59
 
68
- expect(data.keys).to match_array([:tags, :location, :keyword, :name, :table_header, :table_body, :description])
69
- expect(data[:name]).to eq('test example')
70
- end
60
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
61
+ example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
62
+ data = example.parsing_data
71
63
 
72
- it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
73
- example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
74
- data = example.parsing_data
64
+ expect(data.keys).to match_array([:tags, :location, :keyword, :name, :table_header, :table_body, :description])
65
+ expect(data[:name]).to eq('test example')
66
+ end
75
67
 
76
- expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody, :description])
77
- expect(data[:type]).to eq(:Examples)
78
- end
68
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
69
+ example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
70
+ data = example.parsing_data
79
71
 
80
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
81
- example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
82
- data = example.parsing_data
72
+ expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody, :description])
73
+ expect(data[:type]).to eq(:Examples)
74
+ end
83
75
 
84
- expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody, :description])
85
- expect(data[:type]).to eq(:Examples)
86
- end
76
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
77
+ example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
78
+ data = example.parsing_data
87
79
 
88
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
89
- example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
90
- data = example.parsing_data
80
+ expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows', 'tags'])
81
+ expect(data['keyword']).to eq('Examples')
82
+ end
91
83
 
92
- expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows', 'tags'])
93
- expect(data['keyword']).to eq('Examples')
94
84
  end
95
85
 
96
86
  it 'provides a descriptive filename when being parsed from stand alone text' do
@@ -132,10 +122,32 @@ describe 'Example, Integration' do
132
122
 
133
123
 
134
124
  # gherkin 2.x/3.x does not accept incomplete examples
135
- it "models the example's keyword", :gherkin2 => false, :gherkin3 => false do
125
+ it "models the example's keyword", :unless => gherkin?(2, 3) do
136
126
  expect(example.keyword).to eq("#{EXAMPLE_KEYWORD}")
137
127
  end
138
128
 
129
+ context 'using gherkin 2.x', :if => gherkin?(2) do
130
+
131
+ let(:source_text) { "#{EXAMPLE_KEYWORD}:\n|param|" }
132
+ let(:example) { clazz.new(source_text) }
133
+
134
+ it "models the example's keyword" do
135
+ expect(example.keyword).to eq(EXAMPLE_KEYWORD)
136
+ end
137
+
138
+ end
139
+
140
+ context 'using gherkin 3.x', :if => gherkin?(3) do
141
+
142
+ let(:source_text) { "#{EXAMPLE_KEYWORD}:\n|param|\n|value|" }
143
+ let(:example) { clazz.new(source_text) }
144
+
145
+ it "models the example's keyword" do
146
+ expect(example.keyword).to eq(EXAMPLE_KEYWORD)
147
+ end
148
+
149
+ end
150
+
139
151
  it "models the example's source line" do
140
152
  source_text = "#{FEATURE_KEYWORD}:
141
153
 
@@ -197,7 +209,7 @@ describe 'Example, Integration' do
197
209
  end
198
210
 
199
211
  # gherkin 2.x/3.x does not accept incomplete examples
200
- context 'an empty example', :gherkin2 => false, :gherkin3 => false do
212
+ context 'an empty example', :unless => gherkin?(2, 3) do
201
213
 
202
214
  let(:source_text) { "#{EXAMPLE_KEYWORD}:" }
203
215
  let(:example) { clazz.new(source_text) }
@@ -586,7 +598,7 @@ describe 'Example, Integration' do
586
598
  context 'from source text' do
587
599
 
588
600
  # gherkin 2.x/3.x does not accept incomplete examples
589
- it 'can output an empty example', :gherkin2 => false, :gherkin3 => false do
601
+ it 'can output an empty example', :unless => gherkin?(2, 3) do
590
602
  source = ["#{EXAMPLE_KEYWORD}:"]
591
603
  source = source.join("\n")
592
604
  example = clazz.new(source)
@@ -597,7 +609,7 @@ describe 'Example, Integration' do
597
609
  end
598
610
 
599
611
  # gherkin 2.x/3.x does not accept incomplete examples
600
- it 'can output an example that has a name', :gherkin2 => false, :gherkin3 => false do
612
+ it 'can output an example that has a name', :unless => gherkin?(2, 3) do
601
613
  source = ["#{EXAMPLE_KEYWORD}: test example"]
602
614
  source = source.join("\n")
603
615
  example = clazz.new(source)
@@ -608,7 +620,7 @@ describe 'Example, Integration' do
608
620
  end
609
621
 
610
622
  # gherkin 2.x/3.x does not accept incomplete examples
611
- it 'can output an example that has a description', :gherkin2 => false, :gherkin3 => false do
623
+ it 'can output an example that has a description', :unless => gherkin?(2, 3) do
612
624
  source = ["#{EXAMPLE_KEYWORD}:",
613
625
  'Some description.',
614
626
  'Some more description.']
@@ -625,7 +637,7 @@ describe 'Example, Integration' do
625
637
 
626
638
 
627
639
  # gherkin 3.x does not accept incomplete examples
628
- it 'can output an example that has a single row', :gherkin3 => false do
640
+ it 'can output an example that has a single row', :unless => gherkin?(3) do
629
641
  source = ["#{EXAMPLE_KEYWORD}:",
630
642
  '|param1|param2|']
631
643
  source = source.join("\n")
@@ -14,44 +14,48 @@ 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', :gherkin6 => true do
18
- test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
17
+ describe 'parsing data' do
19
18
 
20
- feature_file = clazz.new(test_file_path)
21
- data = feature_file.parsing_data
19
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
20
+ test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
22
21
 
23
- expect(data.keys).to match_array([:uri, :feature, :comments])
24
- expect(File.basename(data[:uri])).to eq('test_file.feature')
25
- end
22
+ feature_file = clazz.new(test_file_path)
23
+ data = feature_file.parsing_data
26
24
 
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')
25
+ expect(data.keys).to match_array([:uri, :feature, :comments])
26
+ expect(File.basename(data[:uri])).to eq('test_file.feature')
27
+ end
29
28
 
30
- feature_file = clazz.new(test_file_path)
31
- data = feature_file.parsing_data
29
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
30
+ test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
32
31
 
33
- expect(data.keys).to match_array([:type, :feature, :comments])
34
- expect(data[:type]).to eq(:GherkinDocument)
35
- end
32
+ feature_file = clazz.new(test_file_path)
33
+ data = feature_file.parsing_data
36
34
 
37
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
38
- test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
35
+ expect(data.keys).to match_array([:type, :feature, :comments])
36
+ expect(data[:type]).to eq(:GherkinDocument)
37
+ end
39
38
 
40
- feature_file = clazz.new(test_file_path)
41
- data = feature_file.parsing_data
39
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
40
+ test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
42
41
 
43
- # There is no parsing data stored above the feature level for gherkin 3.x
44
- expect(data).to be_nil
45
- end
42
+ feature_file = clazz.new(test_file_path)
43
+ data = feature_file.parsing_data
46
44
 
47
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
48
- test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
45
+ # There is no parsing data stored above the feature level for gherkin 3.x
46
+ expect(data).to be_nil
47
+ end
48
+
49
+ it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
50
+ test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
49
51
 
50
- feature_file = clazz.new(test_file_path)
51
- data = feature_file.parsing_data
52
+ feature_file = clazz.new(test_file_path)
53
+ data = feature_file.parsing_data
54
+
55
+ # There is no parsing data stored above the feature level for gherkin 2.x
56
+ expect(data).to eq([])
57
+ end
52
58
 
53
- # There is no parsing data stored above the feature level for gherkin 2.x
54
- expect(data).to eq([])
55
59
  end
56
60
 
57
61
  it 'provides its own filename when being parsed' do
@@ -183,7 +187,7 @@ describe 'FeatureFile, Integration' do
183
187
 
184
188
 
185
189
  # gherkin 3.x does not accept empty feature files
186
- context 'an empty feature file', :gherkin3 => false do
190
+ context 'an empty feature file', :unless => gherkin?(3) do
187
191
 
188
192
  let(:source_text) { '' }
189
193