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.
- checksums.yaml +4 -4
- data/.travis.yml +51 -33
- data/CHANGELOG.md +13 -2
- data/Gemfile +9 -2
- data/appveyor.yml +29 -2
- data/cuke_modeler.gemspec +1 -1
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +1 -1
- data/lib/cuke_modeler/adapters/gherkin_5_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_7_adapter.rb +307 -0
- data/lib/cuke_modeler/adapters/gherkin_8_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +12 -0
- data/lib/cuke_modeler/parsing.rb +116 -108
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/gemfiles/gherkin7.gemfile +9 -0
- data/testing/gemfiles/gherkin8.gemfile +9 -0
- data/testing/gemfiles/gherkin9.gemfile +9 -0
- data/testing/helper_methods.rb +23 -0
- data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +1 -1
- data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +1 -1
- data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +1 -1
- data/testing/rspec/spec/integration/adapters/gherkin_5_adapter_spec.rb +165 -0
- data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +1 -8
- data/testing/rspec/spec/integration/adapters/gherkin_7_adapter_spec.rb +162 -0
- data/testing/rspec/spec/integration/adapters/gherkin_8_adapter_spec.rb +162 -0
- data/testing/rspec/spec/integration/adapters/gherkin_9_adapter_spec.rb +162 -0
- data/testing/rspec/spec/integration/models/background_integration_spec.rb +19 -23
- data/testing/rspec/spec/integration/models/cell_integration_spec.rb +27 -24
- data/testing/rspec/spec/integration/models/comment_integration_spec.rb +26 -23
- data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +19 -23
- data/testing/rspec/spec/integration/models/example_integration_spec.rb +50 -38
- data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +32 -28
- data/testing/rspec/spec/integration/models/feature_integration_spec.rb +28 -23
- data/testing/rspec/spec/integration/models/outline_integration_spec.rb +39 -44
- data/testing/rspec/spec/integration/models/row_integration_spec.rb +35 -23
- data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +19 -23
- data/testing/rspec/spec/integration/models/step_integration_spec.rb +51 -47
- data/testing/rspec/spec/integration/models/table_integration_spec.rb +19 -23
- data/testing/rspec/spec/integration/models/tag_integration_spec.rb +35 -23
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +27 -6
- data/testing/rspec/spec/spec_helper.rb +39 -46
- metadata +16 -4
@@ -69,38 +69,43 @@ describe 'Feature, Integration' do
|
|
69
69
|
expect(tag.parent_model).to equal(feature)
|
70
70
|
end
|
71
71
|
|
72
|
-
|
73
|
-
feature = clazz.new("@tag\n#{FEATURE_KEYWORD}: test feature\ndescription\n#{BACKGROUND_KEYWORD}:\n#{SCENARIO_KEYWORD}:")
|
74
|
-
data = feature.parsing_data
|
72
|
+
describe 'parsing data' do
|
75
73
|
|
76
|
-
|
77
|
-
|
78
|
-
|
74
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
|
75
|
+
feature = clazz.new("@tag\n#{FEATURE_KEYWORD}: test feature\ndescription\n#{BACKGROUND_KEYWORD}:\n#{SCENARIO_KEYWORD}:")
|
76
|
+
data = feature.parsing_data
|
79
77
|
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
expect(data.keys).to match_array([:tags, :location, :language, :keyword, :name, :children, :description])
|
79
|
+
expect(data[:name]).to eq('test feature')
|
80
|
+
end
|
83
81
|
|
84
|
-
|
85
|
-
|
86
|
-
|
82
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
|
83
|
+
feature = clazz.new("@tag\n#{FEATURE_KEYWORD}: test feature\ndescription\n#{BACKGROUND_KEYWORD}:\n#{SCENARIO_KEYWORD}:")
|
84
|
+
data = feature.parsing_data
|
87
85
|
|
88
|
-
|
89
|
-
|
90
|
-
|
86
|
+
expect(data.keys).to match_array([:type, :tags, :location, :language, :keyword, :name, :children, :description])
|
87
|
+
expect(data[:type]).to eq(:Feature)
|
88
|
+
end
|
91
89
|
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
|
91
|
+
feature = clazz.new("@tag\n#{FEATURE_KEYWORD}: test feature\ndescription\n#{BACKGROUND_KEYWORD}:\n#{SCENARIO_KEYWORD}:")
|
92
|
+
data = feature.parsing_data
|
95
93
|
|
96
|
-
|
97
|
-
|
98
|
-
|
94
|
+
expect(data.keys).to match_array([:type, :tags, :location, :language, :keyword, :name, :scenarioDefinitions, :comments, :background, :description])
|
95
|
+
expect(data[:type]).to eq(:Feature)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
99
|
+
feature = clazz.new("@tag\n#{FEATURE_KEYWORD}: test feature\ndescription\n#{BACKGROUND_KEYWORD}:\n#{SCENARIO_KEYWORD}:")
|
100
|
+
data = feature.parsing_data
|
101
|
+
|
102
|
+
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'uri', 'elements', 'tags'])
|
103
|
+
expect(data['keyword']).to eq('Feature')
|
104
|
+
end
|
99
105
|
|
100
|
-
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'uri', 'elements', 'tags'])
|
101
|
-
expect(data['keyword']).to eq('Feature')
|
102
106
|
end
|
103
107
|
|
108
|
+
|
104
109
|
it 'trims whitespace from its source description' do
|
105
110
|
source = ["#{FEATURE_KEYWORD}:",
|
106
111
|
' ',
|
@@ -14,26 +14,14 @@ describe 'Outline, Integration' do
|
|
14
14
|
|
15
15
|
describe 'unique behavior' do
|
16
16
|
|
17
|
-
it 'can be instantiated with the minimum viable Gherkin', :
|
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', :gherkin4_5 => true do
|
24
|
-
source = "#{OUTLINE_KEYWORD}:"
|
25
|
-
|
26
|
-
expect { clazz.new(source) }.to_not raise_error
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'can be instantiated with the minimum viable Gherkin', :gherkin2 => true do
|
17
|
+
it 'can be instantiated with the minimum viable Gherkin', :unless => gherkin?(3) do
|
30
18
|
source = "#{OUTLINE_KEYWORD}:"
|
31
19
|
|
32
20
|
expect { clazz.new(source) }.to_not raise_error
|
33
21
|
end
|
34
22
|
|
35
23
|
# gherkin 3.x does not accept incomplete outlines
|
36
|
-
it 'can be instantiated with the minimum viable Gherkin', :
|
24
|
+
it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(3) do
|
37
25
|
source = "#{OUTLINE_KEYWORD}:
|
38
26
|
#{EXAMPLE_KEYWORD}:
|
39
27
|
| param |
|
@@ -63,36 +51,32 @@ describe 'Outline, Integration' do
|
|
63
51
|
end
|
64
52
|
end
|
65
53
|
|
66
|
-
|
67
|
-
outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
|
68
|
-
data = outline.parsing_data
|
54
|
+
describe 'parsing data' do
|
69
55
|
|
70
|
-
|
71
|
-
|
72
|
-
|
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
|
73
59
|
|
74
|
-
|
75
|
-
|
76
|
-
|
60
|
+
expect(data.keys).to match_array([:background, :rule, :scenario])
|
61
|
+
expect(data[:scenario][:name]).to eq('test outline')
|
62
|
+
end
|
77
63
|
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
81
67
|
|
82
|
-
|
83
|
-
|
84
|
-
|
68
|
+
expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples, :description])
|
69
|
+
expect(data[:type]).to eq(:ScenarioOutline)
|
70
|
+
end
|
85
71
|
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
89
75
|
|
90
|
-
|
91
|
-
|
92
|
-
|
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
|
93
79
|
|
94
|
-
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'examples', 'steps', 'tags'])
|
95
|
-
expect(data['keyword']).to eq('Scenario Outline')
|
96
80
|
end
|
97
81
|
|
98
82
|
it 'provides a descriptive filename when being parsed from stand alone text' do
|
@@ -176,10 +160,21 @@ describe 'Outline, Integration' do
|
|
176
160
|
|
177
161
|
|
178
162
|
# gherkin 3.x does not accept incomplete outlines
|
179
|
-
it "models the outline's keyword", :
|
163
|
+
it "models the outline's keyword", :unless => gherkin?(3) do
|
180
164
|
expect(outline.keyword).to eq("#{OUTLINE_KEYWORD}")
|
181
165
|
end
|
182
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
|
+
|
176
|
+
end
|
177
|
+
|
183
178
|
it "models the outline's source line" do
|
184
179
|
source_text = "#{FEATURE_KEYWORD}:
|
185
180
|
|
@@ -251,7 +246,7 @@ describe 'Outline, Integration' do
|
|
251
246
|
|
252
247
|
|
253
248
|
# gherkin 3.x does not accept incomplete outlines
|
254
|
-
context 'an empty outline', :
|
249
|
+
context 'an empty outline', :unless => gherkin?(3) do
|
255
250
|
|
256
251
|
let(:source_text) { "#{OUTLINE_KEYWORD}:" }
|
257
252
|
let(:outline) { clazz.new(source_text) }
|
@@ -433,7 +428,7 @@ describe 'Outline, Integration' do
|
|
433
428
|
context 'from source text' do
|
434
429
|
|
435
430
|
# gherkin 3.x does not accept incomplete outlines
|
436
|
-
it 'can output an empty outline', :
|
431
|
+
it 'can output an empty outline', :unless => gherkin?(3) do
|
437
432
|
source = ["#{OUTLINE_KEYWORD}:"]
|
438
433
|
source = source.join("\n")
|
439
434
|
outline = clazz.new(source)
|
@@ -444,7 +439,7 @@ describe 'Outline, Integration' do
|
|
444
439
|
end
|
445
440
|
|
446
441
|
# gherkin 3.x does not accept incomplete outlines
|
447
|
-
it 'can output a outline that has a name', :
|
442
|
+
it 'can output a outline that has a name', :unless => gherkin?(3) do
|
448
443
|
source = ["#{OUTLINE_KEYWORD}: test outline"]
|
449
444
|
source = source.join("\n")
|
450
445
|
outline = clazz.new(source)
|
@@ -455,7 +450,7 @@ describe 'Outline, Integration' do
|
|
455
450
|
end
|
456
451
|
|
457
452
|
# gherkin 3.x does not accept incomplete outlines
|
458
|
-
it 'can output a outline that has a description', :
|
453
|
+
it 'can output a outline that has a description', :unless => gherkin?(3) do
|
459
454
|
source = ["#{OUTLINE_KEYWORD}:",
|
460
455
|
'Some description.',
|
461
456
|
'Some more description.']
|
@@ -471,7 +466,7 @@ describe 'Outline, Integration' do
|
|
471
466
|
end
|
472
467
|
|
473
468
|
# gherkin 3.x does not accept incomplete outlines
|
474
|
-
it 'can output a outline that has steps', :
|
469
|
+
it 'can output a outline that has steps', :unless => gherkin?(3) do
|
475
470
|
source = ["#{OUTLINE_KEYWORD}:",
|
476
471
|
" #{STEP_KEYWORD} a step",
|
477
472
|
' | value |',
|
@@ -494,7 +489,7 @@ describe 'Outline, Integration' do
|
|
494
489
|
end
|
495
490
|
|
496
491
|
# gherkin 3.x does not accept incomplete outlines
|
497
|
-
it 'can output a outline that has tags', :
|
492
|
+
it 'can output a outline that has tags', :unless => gherkin?(3) do
|
498
493
|
source = ['@tag1 @tag2',
|
499
494
|
'@tag3',
|
500
495
|
"#{OUTLINE_KEYWORD}:"]
|
@@ -44,36 +44,48 @@ describe 'Row, Integration' do
|
|
44
44
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_row\.feature'/)
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
example_row = clazz.new("| a | row |")
|
49
|
-
data = example_row.parsing_data
|
47
|
+
describe 'parsing data' do
|
50
48
|
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(8, 9) do
|
50
|
+
example_row = clazz.new("| a | row |")
|
51
|
+
data = example_row.parsing_data
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
expect(data.keys).to match_array([:location, :cells, :id])
|
54
|
+
expect(data[:location][:line]).to eq(5)
|
55
|
+
end
|
58
56
|
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7) do
|
58
|
+
example_row = clazz.new("| a | row |")
|
59
|
+
data = example_row.parsing_data
|
62
60
|
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
expect(data.keys).to match_array([:location, :cells])
|
62
|
+
expect(data[:location][:line]).to eq(5)
|
63
|
+
end
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
|
66
|
+
example_row = clazz.new("| a | row |")
|
67
|
+
data = example_row.parsing_data
|
68
|
+
|
69
|
+
expect(data.keys).to match_array([:type, :location, :cells])
|
70
|
+
expect(data[:type]).to eq(:TableRow)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
|
74
|
+
example_row = clazz.new("| a | row |")
|
75
|
+
data = example_row.parsing_data
|
76
|
+
|
77
|
+
expect(data.keys).to match_array([:type, :location, :cells])
|
78
|
+
expect(data[:type]).to eq('TableRow')
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
82
|
+
example_row = clazz.new("| a | row |")
|
83
|
+
data = example_row.parsing_data
|
70
84
|
|
71
|
-
|
72
|
-
|
73
|
-
|
85
|
+
expect(data.keys).to match_array(['cells', 'line'])
|
86
|
+
expect(data['line']).to eq(5)
|
87
|
+
end
|
74
88
|
|
75
|
-
expect(data.keys).to match_array(['cells', 'line'])
|
76
|
-
expect(data['line']).to eq(5)
|
77
89
|
end
|
78
90
|
|
79
91
|
it 'properly sets its child models' do
|
@@ -43,36 +43,32 @@ describe 'Scenario, Integration' do
|
|
43
43
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_scenario\.feature'/)
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
scenario = clazz.new("@tag\n#{SCENARIO_KEYWORD}: test scenario\ndescription\n#{STEP_KEYWORD} a step")
|
48
|
-
data = scenario.parsing_data
|
46
|
+
describe 'parsing data' do
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
|
49
|
+
scenario = clazz.new("@tag\n#{SCENARIO_KEYWORD}: test scenario\ndescription\n#{STEP_KEYWORD} a step")
|
50
|
+
data = scenario.parsing_data
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
expect(data.keys).to match_array([:background, :rule, :scenario])
|
53
|
+
expect(data[:scenario][:name]).to eq('test scenario')
|
54
|
+
end
|
57
55
|
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
|
57
|
+
scenario = clazz.new("@tag\n#{SCENARIO_KEYWORD}: test scenario\ndescription\n#{STEP_KEYWORD} a step")
|
58
|
+
data = scenario.parsing_data
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :description])
|
61
|
+
expect(data[:type]).to eq(:Scenario)
|
62
|
+
end
|
65
63
|
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
65
|
+
scenario = clazz.new("@tag\n#{SCENARIO_KEYWORD}: test scenario\ndescription\n#{STEP_KEYWORD} a step")
|
66
|
+
data = scenario.parsing_data
|
69
67
|
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'steps', 'tags'])
|
69
|
+
expect(data['keyword']).to eq('Scenario')
|
70
|
+
end
|
73
71
|
|
74
|
-
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'steps', 'tags'])
|
75
|
-
expect(data['keyword']).to eq('Scenario')
|
76
72
|
end
|
77
73
|
|
78
74
|
it 'properly sets its child models' do
|
@@ -43,68 +43,72 @@ describe 'Step, Integration' do
|
|
43
43
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_step\.feature'/)
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
step = clazz.new("#{STEP_KEYWORD} test step\n|table|")
|
48
|
-
data = step.parsing_data
|
46
|
+
describe 'parsing data' do
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
it 'stores the original data generated by the parsing adapter (with a table)', :if => gherkin?(8, 9) do
|
49
|
+
step = clazz.new("#{STEP_KEYWORD} test step\n|table|")
|
50
|
+
data = step.parsing_data
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
expect(data.keys).to match_array([:location, :keyword, :text, :data_table, :doc_string, :id])
|
53
|
+
expect(data[:text]).to eq('test step')
|
54
|
+
end
|
57
55
|
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
it 'stores the original data generated by the parsing adapter (with a doc string)', :if => gherkin?(8, 9) do
|
57
|
+
step = clazz.new("#{STEP_KEYWORD} test step\n\"\"\"\na doc string\n\"\"\"")
|
58
|
+
data = step.parsing_data
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
expect(data.keys).to match_array([:location, :keyword, :text, :data_table, :doc_string, :id])
|
61
|
+
expect(data[:text]).to eq('test step')
|
62
|
+
end
|
65
63
|
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
it 'stores the original data generated by the parsing adapter (with a table)', :if => gherkin?(6, 7) do
|
65
|
+
step = clazz.new("#{STEP_KEYWORD} test step\n|table|")
|
66
|
+
data = step.parsing_data
|
69
67
|
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
expect(data.keys).to match_array([:location, :keyword, :text, :data_table, :doc_string])
|
69
|
+
expect(data[:text]).to eq('test step')
|
70
|
+
end
|
73
71
|
|
74
|
-
|
75
|
-
|
76
|
-
|
72
|
+
it 'stores the original data generated by the parsing adapter (with a doc string)', :if => gherkin?(6, 7) do
|
73
|
+
step = clazz.new("#{STEP_KEYWORD} test step\n\"\"\"\na doc string\n\"\"\"")
|
74
|
+
data = step.parsing_data
|
77
75
|
|
78
|
-
|
79
|
-
|
80
|
-
|
76
|
+
expect(data.keys).to match_array([:location, :keyword, :text, :data_table, :doc_string])
|
77
|
+
expect(data[:text]).to eq('test step')
|
78
|
+
end
|
81
79
|
|
82
|
-
|
83
|
-
|
84
|
-
|
80
|
+
it 'stores the original data generated by the parsing adapter (with a table)', :if => gherkin?(3, 4, 5) do
|
81
|
+
step = clazz.new("#{STEP_KEYWORD} test step\n|table|")
|
82
|
+
data = step.parsing_data
|
85
83
|
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
expect(data.keys).to match_array([:type, :location, :keyword, :text, :argument])
|
85
|
+
expect(data[:type]).to eq(:Step)
|
86
|
+
end
|
89
87
|
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
it 'stores the original data generated by the parsing adapter (with a doc string)', :if => gherkin?(3, 4, 5) do
|
89
|
+
step = clazz.new("#{STEP_KEYWORD} test step\n\"\"\"\na doc string\n\"\"\"")
|
90
|
+
data = step.parsing_data
|
93
91
|
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
expect(data.keys).to match_array([:type, :location, :keyword, :text, :argument])
|
93
|
+
expect(data[:type]).to eq(:Step)
|
94
|
+
end
|
97
95
|
|
98
|
-
|
99
|
-
|
100
|
-
|
96
|
+
it 'stores the original data generated by the parsing adapter (with a table)', :if => gherkin?(2) do
|
97
|
+
step = clazz.new("#{STEP_KEYWORD} test step\n|table|")
|
98
|
+
data = step.parsing_data
|
101
99
|
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
expect(data.keys).to match_array(['keyword', 'name', 'line', 'rows'])
|
101
|
+
expect(data['keyword']).to eq("#{STEP_KEYWORD} ")
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'stores the original data generated by the parsing adapter (with a doc string)', :if => gherkin?(2) do
|
105
|
+
step = clazz.new("#{STEP_KEYWORD} test step\n\"\"\"\na doc string\n\"\"\"")
|
106
|
+
data = step.parsing_data
|
107
|
+
|
108
|
+
expect(data.keys).to match_array(['keyword', 'name', 'line', 'doc_string'])
|
109
|
+
expect(data['keyword']).to eq("#{STEP_KEYWORD} ")
|
110
|
+
end
|
105
111
|
|
106
|
-
expect(data.keys).to match_array(['keyword', 'name', 'line', 'doc_string'])
|
107
|
-
expect(data['keyword']).to eq("#{STEP_KEYWORD} ")
|
108
112
|
end
|
109
113
|
|
110
114
|
describe 'model population' do
|