cuke_modeler 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +16 -0
- data/Gemfile +11 -3
- data/History.md +5 -0
- data/LICENSE.txt +1 -1
- data/Rakefile +8 -1
- data/appveyor.yml +7 -12
- data/cuke_modeler.gemspec +2 -2
- data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +309 -0
- data/lib/cuke_modeler/parsing.rb +28 -5
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/step_definitions/feature_file_steps.rb +1 -1
- data/testing/cucumber/step_definitions/modeling_steps.rb +2 -2
- data/testing/cucumber/step_definitions/verification_steps.rb +3 -2
- data/testing/file_helper.rb +3 -0
- data/testing/gemfiles/gherkin2.gemfile +7 -0
- data/testing/gemfiles/gherkin3.gemfile +6 -0
- data/testing/gemfiles/gherkin4.gemfile +7 -0
- data/testing/gemfiles/gherkin5.gemfile +6 -0
- data/testing/gemfiles/gherkin6.gemfile +10 -0
- data/testing/rspec/spec/integration/background_integration_spec.rb +80 -72
- data/testing/rspec/spec/integration/cell_integration_spec.rb +28 -20
- data/testing/rspec/spec/integration/comment_integration_spec.rb +11 -3
- data/testing/rspec/spec/integration/directory_integration_spec.rb +2 -2
- data/testing/rspec/spec/integration/doc_string_integration_spec.rb +26 -18
- data/testing/rspec/spec/integration/example_integration_spec.rb +75 -61
- data/testing/rspec/spec/integration/feature_file_integration_spec.rb +30 -20
- data/testing/rspec/spec/integration/feature_integration_spec.rb +106 -98
- data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +11 -11
- data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +11 -11
- data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +12 -12
- data/testing/rspec/spec/integration/gherkin_6_adapter_spec.rb +166 -0
- data/testing/rspec/spec/integration/outline_integration_spec.rb +116 -102
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +16 -4
- data/testing/rspec/spec/integration/row_integration_spec.rb +26 -18
- data/testing/rspec/spec/integration/scenario_integration_spec.rb +82 -74
- data/testing/rspec/spec/integration/step_integration_spec.rb +65 -49
- data/testing/rspec/spec/integration/table_integration_spec.rb +25 -17
- data/testing/rspec/spec/integration/tag_integration_spec.rb +27 -19
- data/testing/rspec/spec/spec_helper.rb +64 -35
- data/todo.txt +3 -1
- metadata +10 -8
- data/testing/cucumber/support/transforms.rb +0 -3
@@ -44,7 +44,15 @@ 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', :
|
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
|
50
|
+
|
51
|
+
expect(data.keys).to match_array([:location, :value])
|
52
|
+
expect(data[:value]).to eq('a cell')
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
|
48
56
|
cell = clazz.new('a cell')
|
49
57
|
data = cell.parsing_data
|
50
58
|
|
@@ -77,10 +85,10 @@ describe 'Cell, Integration' do
|
|
77
85
|
|
78
86
|
|
79
87
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
80
|
-
let(:source_gherkin) { "#{
|
88
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
81
89
|
|
82
|
-
#{
|
83
|
-
#{
|
90
|
+
#{SCENARIO_KEYWORD}: Test test
|
91
|
+
#{STEP_KEYWORD} a step
|
84
92
|
| a value |"
|
85
93
|
}
|
86
94
|
|
@@ -109,11 +117,11 @@ describe 'Cell, Integration' do
|
|
109
117
|
context 'a cell that is part of an outline' do
|
110
118
|
|
111
119
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
112
|
-
let(:source_gherkin) { "#{
|
120
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
113
121
|
|
114
|
-
#{
|
115
|
-
#{
|
116
|
-
#{
|
122
|
+
#{OUTLINE_KEYWORD}: Test outline
|
123
|
+
#{STEP_KEYWORD} a step
|
124
|
+
#{EXAMPLE_KEYWORD}:
|
117
125
|
| param |
|
118
126
|
| value |"
|
119
127
|
}
|
@@ -146,10 +154,10 @@ describe 'Cell, Integration' do
|
|
146
154
|
context 'a cell that is part of a scenario' do
|
147
155
|
|
148
156
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
149
|
-
let(:source_gherkin) { "#{
|
157
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
150
158
|
|
151
|
-
#{
|
152
|
-
#{
|
159
|
+
#{SCENARIO_KEYWORD}: Test test
|
160
|
+
#{STEP_KEYWORD} a step:
|
153
161
|
| a | table |"
|
154
162
|
}
|
155
163
|
|
@@ -168,10 +176,10 @@ describe 'Cell, Integration' do
|
|
168
176
|
context 'a cell that is part of a background' do
|
169
177
|
|
170
178
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
171
|
-
let(:source_gherkin) { "#{
|
179
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
172
180
|
|
173
|
-
#{
|
174
|
-
#{
|
181
|
+
#{BACKGROUND_KEYWORD}: Test background
|
182
|
+
#{STEP_KEYWORD} a step:
|
175
183
|
| a | table |"
|
176
184
|
}
|
177
185
|
|
@@ -190,10 +198,10 @@ describe 'Cell, Integration' do
|
|
190
198
|
context 'a cell that is part of a step' do
|
191
199
|
|
192
200
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
193
|
-
let(:source_gherkin) { "#{
|
201
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
194
202
|
|
195
|
-
#{
|
196
|
-
#{
|
203
|
+
#{SCENARIO_KEYWORD}: Test test
|
204
|
+
#{STEP_KEYWORD} a step:
|
197
205
|
| a | table |"
|
198
206
|
}
|
199
207
|
|
@@ -243,10 +251,10 @@ describe 'Cell, Integration' do
|
|
243
251
|
end
|
244
252
|
|
245
253
|
it "models the cell's source line" do
|
246
|
-
source_text = "#{
|
254
|
+
source_text = "#{FEATURE_KEYWORD}:
|
247
255
|
|
248
|
-
#{
|
249
|
-
#{
|
256
|
+
#{SCENARIO_KEYWORD}:
|
257
|
+
#{STEP_KEYWORD} a step
|
250
258
|
| value |"
|
251
259
|
cell = CukeModeler::Feature.new(source_text).tests.first.steps.first.block.rows.first.cells.first
|
252
260
|
|
@@ -44,7 +44,15 @@ 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', :
|
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
|
50
|
+
|
51
|
+
expect(data.keys).to match_array([:location, :text])
|
52
|
+
expect(data[:text]).to eq('# a comment')
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
|
48
56
|
comment = clazz.new('# a comment')
|
49
57
|
data = comment.parsing_data
|
50
58
|
|
@@ -77,7 +85,7 @@ describe 'Comment, Integration' do
|
|
77
85
|
|
78
86
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
79
87
|
let(:source_gherkin) { "# feature comment
|
80
|
-
#{
|
88
|
+
#{FEATURE_KEYWORD}: Test feature"
|
81
89
|
}
|
82
90
|
|
83
91
|
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
@@ -119,7 +127,7 @@ describe 'Comment, Integration' do
|
|
119
127
|
|
120
128
|
it "models the comment's source line" do
|
121
129
|
source_text = "# a comment
|
122
|
-
#{
|
130
|
+
#{FEATURE_KEYWORD}:"
|
123
131
|
|
124
132
|
test_file_path = CukeModeler::FileHelper.create_feature_file(:text => source_text, :name => 'comment_test_file')
|
125
133
|
comment = CukeModeler::FeatureFile.new(test_file_path).comments.first
|
@@ -46,7 +46,7 @@ describe 'Directory, Integration' do
|
|
46
46
|
before(:each) do
|
47
47
|
feature_files.each do |file_name|
|
48
48
|
# Some versions of Gherkin require feature content to be present in feature files
|
49
|
-
CukeModeler::FileHelper.create_feature_file(:text => "#{
|
49
|
+
CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: Test feature", :name => file_name, :directory => directory_path)
|
50
50
|
end
|
51
51
|
|
52
52
|
non_feature_files.each do |file_name|
|
@@ -146,7 +146,7 @@ describe 'Directory, Integration' do
|
|
146
146
|
directory_path = CukeModeler::FileHelper.create_directory
|
147
147
|
_nested_directory_path = CukeModeler::FileHelper.create_directory(:name => 'nested_directory', :directory => directory_path)
|
148
148
|
|
149
|
-
CukeModeler::FileHelper.create_feature_file(:text => "#{
|
149
|
+
CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: Test feature", :name => 'test_file', :directory => directory_path)
|
150
150
|
|
151
151
|
|
152
152
|
directory_model = clazz.new(directory_path)
|
@@ -43,7 +43,15 @@ 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', :
|
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
|
49
|
+
|
50
|
+
expect(data.keys).to match_array([:location, :content, :content_type, :delimiter])
|
51
|
+
expect(data[:content]).to eq('some doc string')
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
|
47
55
|
doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
|
48
56
|
data = doc_string.parsing_data
|
49
57
|
|
@@ -85,10 +93,10 @@ describe 'DocString, Integration' do
|
|
85
93
|
|
86
94
|
|
87
95
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
88
|
-
let(:source_gherkin) { "#{
|
96
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
89
97
|
|
90
|
-
#{
|
91
|
-
#{
|
98
|
+
#{SCENARIO_KEYWORD}: Test test
|
99
|
+
#{STEP_KEYWORD} a big step:
|
92
100
|
\"\"\"
|
93
101
|
a
|
94
102
|
doc
|
@@ -121,10 +129,10 @@ describe 'DocString, Integration' do
|
|
121
129
|
context 'a doc string that is part of a scenario' do
|
122
130
|
|
123
131
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
124
|
-
let(:source_gherkin) { "#{
|
132
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
125
133
|
|
126
|
-
#{
|
127
|
-
#{
|
134
|
+
#{SCENARIO_KEYWORD}: Test test
|
135
|
+
#{STEP_KEYWORD} a big step:
|
128
136
|
\"\"\"
|
129
137
|
a
|
130
138
|
doc
|
@@ -147,16 +155,16 @@ describe 'DocString, Integration' do
|
|
147
155
|
context 'a doc string that is part of an outline' do
|
148
156
|
|
149
157
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
150
|
-
let(:source_gherkin) { "#{
|
158
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
151
159
|
|
152
|
-
#{
|
153
|
-
#{
|
160
|
+
#{OUTLINE_KEYWORD}: Test outline
|
161
|
+
#{STEP_KEYWORD} a big step:
|
154
162
|
\"\"\"
|
155
163
|
a
|
156
164
|
doc
|
157
165
|
string
|
158
166
|
\"\"\"
|
159
|
-
#{
|
167
|
+
#{EXAMPLE_KEYWORD}:
|
160
168
|
| param |
|
161
169
|
| value |"
|
162
170
|
}
|
@@ -176,10 +184,10 @@ describe 'DocString, Integration' do
|
|
176
184
|
context 'a doc string that is part of a background' do
|
177
185
|
|
178
186
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
179
|
-
let(:source_gherkin) { "#{
|
187
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
180
188
|
|
181
|
-
#{
|
182
|
-
#{
|
189
|
+
#{BACKGROUND_KEYWORD}: Test background
|
190
|
+
#{STEP_KEYWORD} a big step:
|
183
191
|
\"\"\"
|
184
192
|
a
|
185
193
|
doc
|
@@ -253,10 +261,10 @@ describe 'DocString, Integration' do
|
|
253
261
|
end
|
254
262
|
|
255
263
|
it "models the doc string's source line" do
|
256
|
-
source_text = "#{
|
264
|
+
source_text = "#{FEATURE_KEYWORD}:
|
257
265
|
|
258
|
-
#{
|
259
|
-
#{
|
266
|
+
#{SCENARIO_KEYWORD}:
|
267
|
+
#{STEP_KEYWORD} step
|
260
268
|
\"\"\"
|
261
269
|
foo
|
262
270
|
\"\"\""
|
@@ -274,7 +282,7 @@ describe 'DocString, Integration' do
|
|
274
282
|
|
275
283
|
it 'can be remade from its own output' do
|
276
284
|
source = ['"""" the type',
|
277
|
-
"#{
|
285
|
+
"#{STEP_KEYWORD} a step",
|
278
286
|
' \"\"\"',
|
279
287
|
' that also has a doc string',
|
280
288
|
' \"\"\"',
|
@@ -15,14 +15,20 @@ describe 'Example, Integration' do
|
|
15
15
|
|
16
16
|
describe 'unique behavior' do
|
17
17
|
|
18
|
-
it 'can be instantiated with the minimum viable Gherkin', :
|
19
|
-
source = "#{
|
18
|
+
it 'can be instantiated with the minimum viable Gherkin', :gherkin6 => true do
|
19
|
+
source = "#{EXAMPLE_KEYWORD}:"
|
20
|
+
|
21
|
+
expect { @model = clazz.new(source) }.to_not raise_error
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'can be instantiated with the minimum viable Gherkin', :gherkin4_5 => true do
|
25
|
+
source = "#{EXAMPLE_KEYWORD}:"
|
20
26
|
|
21
27
|
expect { @model = clazz.new(source) }.to_not raise_error
|
22
28
|
end
|
23
29
|
|
24
30
|
it 'can be instantiated with the minimum viable Gherkin', :gherkin3 => true do
|
25
|
-
source = "#{
|
31
|
+
source = "#{EXAMPLE_KEYWORD}:
|
26
32
|
|param|
|
27
33
|
|value|"
|
28
34
|
|
@@ -30,7 +36,7 @@ describe 'Example, Integration' do
|
|
30
36
|
end
|
31
37
|
|
32
38
|
it 'can be instantiated with the minimum viable Gherkin', :gherkin2 => true do
|
33
|
-
source = "#{
|
39
|
+
source = "#{EXAMPLE_KEYWORD}:
|
34
40
|
|param|"
|
35
41
|
|
36
42
|
expect { @model = clazz.new(source) }.to_not raise_error
|
@@ -55,8 +61,16 @@ describe 'Example, Integration' do
|
|
55
61
|
end
|
56
62
|
end
|
57
63
|
|
58
|
-
it 'stores the original data generated by the parsing adapter', :
|
59
|
-
example = clazz.new("@tag\n#{
|
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
|
67
|
+
|
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
|
71
|
+
|
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|")
|
60
74
|
data = example.parsing_data
|
61
75
|
|
62
76
|
expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody, :description])
|
@@ -64,7 +78,7 @@ describe 'Example, Integration' do
|
|
64
78
|
end
|
65
79
|
|
66
80
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
67
|
-
example = clazz.new("@tag\n#{
|
81
|
+
example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
|
68
82
|
data = example.parsing_data
|
69
83
|
|
70
84
|
expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody, :description])
|
@@ -72,7 +86,7 @@ describe 'Example, Integration' do
|
|
72
86
|
end
|
73
87
|
|
74
88
|
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
75
|
-
example = clazz.new("@tag\n#{
|
89
|
+
example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
|
76
90
|
data = example.parsing_data
|
77
91
|
|
78
92
|
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows', 'tags'])
|
@@ -86,7 +100,7 @@ describe 'Example, Integration' do
|
|
86
100
|
end
|
87
101
|
|
88
102
|
it 'trims whitespace from its source description' do
|
89
|
-
source = ["#{
|
103
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
90
104
|
' ',
|
91
105
|
' description line 1',
|
92
106
|
'',
|
@@ -113,21 +127,21 @@ describe 'Example, Integration' do
|
|
113
127
|
|
114
128
|
context 'from source text' do
|
115
129
|
|
116
|
-
let(:source_text) { "#{
|
130
|
+
let(:source_text) { "#{EXAMPLE_KEYWORD}:" }
|
117
131
|
let(:example) { clazz.new(source_text) }
|
118
132
|
|
119
133
|
|
120
134
|
# gherkin 2.x/3.x does not accept incomplete examples
|
121
135
|
it "models the example's keyword", :gherkin2 => false, :gherkin3 => false do
|
122
|
-
expect(example.keyword).to eq("#{
|
136
|
+
expect(example.keyword).to eq("#{EXAMPLE_KEYWORD}")
|
123
137
|
end
|
124
138
|
|
125
139
|
it "models the example's source line" do
|
126
|
-
source_text = "#{
|
140
|
+
source_text = "#{FEATURE_KEYWORD}:
|
127
141
|
|
128
|
-
#{
|
129
|
-
#{
|
130
|
-
#{
|
142
|
+
#{OUTLINE_KEYWORD}:
|
143
|
+
#{STEP_KEYWORD} step
|
144
|
+
#{EXAMPLE_KEYWORD}:
|
131
145
|
| param |
|
132
146
|
| value |"
|
133
147
|
example = CukeModeler::Feature.new(source_text).tests.first.examples.first
|
@@ -139,7 +153,7 @@ describe 'Example, Integration' do
|
|
139
153
|
context 'a filled example' do
|
140
154
|
|
141
155
|
let(:source_text) { "@tag1 @tag2 @tag3
|
142
|
-
#{
|
156
|
+
#{EXAMPLE_KEYWORD}: test example
|
143
157
|
|
144
158
|
Some example description.
|
145
159
|
|
@@ -185,7 +199,7 @@ describe 'Example, Integration' do
|
|
185
199
|
# gherkin 2.x/3.x does not accept incomplete examples
|
186
200
|
context 'an empty example', :gherkin2 => false, :gherkin3 => false do
|
187
201
|
|
188
|
-
let(:source_text) { "#{
|
202
|
+
let(:source_text) { "#{EXAMPLE_KEYWORD}:" }
|
189
203
|
let(:example) { clazz.new(source_text) }
|
190
204
|
|
191
205
|
|
@@ -214,7 +228,7 @@ describe 'Example, Integration' do
|
|
214
228
|
|
215
229
|
it 'properly sets its child models' do
|
216
230
|
source = "@a_tag
|
217
|
-
#{
|
231
|
+
#{EXAMPLE_KEYWORD}:
|
218
232
|
| param |
|
219
233
|
| value 1 |"
|
220
234
|
|
@@ -228,7 +242,7 @@ describe 'Example, Integration' do
|
|
228
242
|
end
|
229
243
|
|
230
244
|
it 'does not include the parameter row when accessing argument rows' do
|
231
|
-
source = "#{
|
245
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
232
246
|
example = clazz.new(source)
|
233
247
|
|
234
248
|
rows = example.argument_rows
|
@@ -238,7 +252,7 @@ describe 'Example, Integration' do
|
|
238
252
|
end
|
239
253
|
|
240
254
|
it 'does not include argument rows when accessing the parameter row' do
|
241
|
-
source = "#{
|
255
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
242
256
|
example = clazz.new(source)
|
243
257
|
|
244
258
|
row = example.parameter_row
|
@@ -251,7 +265,7 @@ describe 'Example, Integration' do
|
|
251
265
|
describe 'adding rows' do
|
252
266
|
|
253
267
|
it 'can add a new row as a hash, string values' do
|
254
|
-
source = "#{
|
268
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
255
269
|
example = clazz.new(source)
|
256
270
|
|
257
271
|
new_row = {'param1' => 'value3', 'param2' => 'value4'}
|
@@ -262,7 +276,7 @@ describe 'Example, Integration' do
|
|
262
276
|
end
|
263
277
|
|
264
278
|
it 'can add a new row as a hash, non-string values' do
|
265
|
-
source = "#{
|
279
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
266
280
|
example = clazz.new(source)
|
267
281
|
|
268
282
|
new_row = {:param1 => 'value3', 'param2' => 4}
|
@@ -273,7 +287,7 @@ describe 'Example, Integration' do
|
|
273
287
|
end
|
274
288
|
|
275
289
|
it 'can add a new row as a hash, random key order' do
|
276
|
-
source = "#{
|
290
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
277
291
|
example = clazz.new(source)
|
278
292
|
|
279
293
|
new_row = {'param2' => 'value4', 'param1' => 'value3'}
|
@@ -284,7 +298,7 @@ describe 'Example, Integration' do
|
|
284
298
|
end
|
285
299
|
|
286
300
|
it 'can add a new row as an array, string values' do
|
287
|
-
source = "#{
|
301
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
288
302
|
example = clazz.new(source)
|
289
303
|
|
290
304
|
new_row = ['value3', 'value4']
|
@@ -295,7 +309,7 @@ describe 'Example, Integration' do
|
|
295
309
|
end
|
296
310
|
|
297
311
|
it 'can add a new row as an array, non-string values' do
|
298
|
-
source = "#{
|
312
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|param3|\n|value1|value2|value3|"
|
299
313
|
example = clazz.new(source)
|
300
314
|
|
301
315
|
new_row = [:value4, 5, 'value6']
|
@@ -306,7 +320,7 @@ describe 'Example, Integration' do
|
|
306
320
|
end
|
307
321
|
|
308
322
|
it 'can only use a Hash or an Array to add a new row' do
|
309
|
-
source = "#{
|
323
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param|\n|value|"
|
310
324
|
example = clazz.new(source)
|
311
325
|
|
312
326
|
expect { example.add_row({}) }.to_not raise_error
|
@@ -315,7 +329,7 @@ describe 'Example, Integration' do
|
|
315
329
|
end
|
316
330
|
|
317
331
|
it 'trims whitespace from added rows' do
|
318
|
-
source = "#{
|
332
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
319
333
|
example = clazz.new(source)
|
320
334
|
|
321
335
|
hash_row = {'param1' => 'value3 ', 'param2' => ' value4'}
|
@@ -339,7 +353,7 @@ describe 'Example, Integration' do
|
|
339
353
|
end
|
340
354
|
|
341
355
|
it 'does not modify its row input' do
|
342
|
-
source = "#{
|
356
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
343
357
|
example = clazz.new(source)
|
344
358
|
|
345
359
|
array_row = ['value1'.freeze, 'value2'.freeze].freeze
|
@@ -355,7 +369,7 @@ describe 'Example, Integration' do
|
|
355
369
|
describe 'removing rows' do
|
356
370
|
|
357
371
|
it 'can remove an existing row as a hash' do
|
358
|
-
source = "#{
|
372
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
359
373
|
example = clazz.new(source)
|
360
374
|
|
361
375
|
old_row = {'param1' => 'value3', 'param2' => 'value4'}
|
@@ -366,7 +380,7 @@ describe 'Example, Integration' do
|
|
366
380
|
end
|
367
381
|
|
368
382
|
it 'can remove an existing row as a hash, random key order' do
|
369
|
-
source = "#{
|
383
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
370
384
|
example = clazz.new(source)
|
371
385
|
|
372
386
|
old_row = {'param2' => 'value4', 'param1' => 'value3'}
|
@@ -377,7 +391,7 @@ describe 'Example, Integration' do
|
|
377
391
|
end
|
378
392
|
|
379
393
|
it 'can remove an existing row as an array' do
|
380
|
-
source = "#{
|
394
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
381
395
|
example = clazz.new(source)
|
382
396
|
|
383
397
|
old_row = ['value3', 'value4']
|
@@ -394,7 +408,7 @@ describe 'Example, Integration' do
|
|
394
408
|
end
|
395
409
|
|
396
410
|
it 'trims whitespace from removed rows' do
|
397
|
-
source = "#{
|
411
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|\n|value5|value6|"
|
398
412
|
example = clazz.new(source)
|
399
413
|
|
400
414
|
# These will affect different rows
|
@@ -417,7 +431,7 @@ describe 'Example, Integration' do
|
|
417
431
|
end
|
418
432
|
|
419
433
|
it 'will not remove the parameter row' do
|
420
|
-
source = "#{
|
434
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
421
435
|
example = clazz.new(source)
|
422
436
|
|
423
437
|
hash_row = {'param1' => 'param1', 'param2' => 'param2'}
|
@@ -435,7 +449,7 @@ describe 'Example, Integration' do
|
|
435
449
|
end
|
436
450
|
|
437
451
|
it 'will remove an argument row that is the same as the parameter row' do
|
438
|
-
source = "#{
|
452
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|param1|param2|"
|
439
453
|
example = clazz.new(source)
|
440
454
|
|
441
455
|
hash_row = {'param1' => 'param1', 'param2' => 'param2'}
|
@@ -463,11 +477,11 @@ describe 'Example, Integration' do
|
|
463
477
|
|
464
478
|
|
465
479
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
466
|
-
let(:source_gherkin) { "#{
|
480
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
467
481
|
|
468
|
-
#{
|
469
|
-
#{
|
470
|
-
#{
|
482
|
+
#{OUTLINE_KEYWORD}: Test test
|
483
|
+
#{STEP_KEYWORD} a step
|
484
|
+
#{EXAMPLE_KEYWORD}: Test example
|
471
485
|
| a param |
|
472
486
|
| a value |"
|
473
487
|
}
|
@@ -497,11 +511,11 @@ describe 'Example, Integration' do
|
|
497
511
|
context 'an example that is part of an outline' do
|
498
512
|
|
499
513
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
500
|
-
let(:source_gherkin) { "#{
|
514
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
501
515
|
|
502
|
-
#{
|
503
|
-
#{
|
504
|
-
#{
|
516
|
+
#{OUTLINE_KEYWORD}: Test outline
|
517
|
+
#{STEP_KEYWORD} a step
|
518
|
+
#{EXAMPLE_KEYWORD}:
|
505
519
|
| param |
|
506
520
|
| value |"
|
507
521
|
}
|
@@ -531,7 +545,7 @@ describe 'Example, Integration' do
|
|
531
545
|
|
532
546
|
it 'can be remade from its own output' do
|
533
547
|
source = "@tag1 @tag2 @tag3
|
534
|
-
#{
|
548
|
+
#{EXAMPLE_KEYWORD}: with everything it could have
|
535
549
|
|
536
550
|
Some description.
|
537
551
|
Some more description.
|
@@ -553,7 +567,7 @@ describe 'Example, Integration' do
|
|
553
567
|
# and it is possible that during that process it messes up the cell's output.
|
554
568
|
|
555
569
|
it 'can correctly output a row that has special characters in it' do
|
556
|
-
source = ["#{
|
570
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
557
571
|
' | param with \| |',
|
558
572
|
' | a value with \| and \\\\ |',
|
559
573
|
' | a value with \\\\ |']
|
@@ -562,7 +576,7 @@ describe 'Example, Integration' do
|
|
562
576
|
|
563
577
|
example_output = example.to_s.split("\n", -1)
|
564
578
|
|
565
|
-
expect(example_output).to eq(["#{
|
579
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
566
580
|
' | param with \| |',
|
567
581
|
' | a value with \| and \\\\ |',
|
568
582
|
' | a value with \\\\ |'])
|
@@ -573,29 +587,29 @@ describe 'Example, Integration' do
|
|
573
587
|
|
574
588
|
# gherkin 2.x/3.x does not accept incomplete examples
|
575
589
|
it 'can output an empty example', :gherkin2 => false, :gherkin3 => false do
|
576
|
-
source = ["#{
|
590
|
+
source = ["#{EXAMPLE_KEYWORD}:"]
|
577
591
|
source = source.join("\n")
|
578
592
|
example = clazz.new(source)
|
579
593
|
|
580
594
|
example_output = example.to_s.split("\n", -1)
|
581
595
|
|
582
|
-
expect(example_output).to eq(["#{
|
596
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:"])
|
583
597
|
end
|
584
598
|
|
585
599
|
# gherkin 2.x/3.x does not accept incomplete examples
|
586
600
|
it 'can output an example that has a name', :gherkin2 => false, :gherkin3 => false do
|
587
|
-
source = ["#{
|
601
|
+
source = ["#{EXAMPLE_KEYWORD}: test example"]
|
588
602
|
source = source.join("\n")
|
589
603
|
example = clazz.new(source)
|
590
604
|
|
591
605
|
example_output = example.to_s.split("\n", -1)
|
592
606
|
|
593
|
-
expect(example_output).to eq(["#{
|
607
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}: test example"])
|
594
608
|
end
|
595
609
|
|
596
610
|
# gherkin 2.x/3.x does not accept incomplete examples
|
597
611
|
it 'can output an example that has a description', :gherkin2 => false, :gherkin3 => false do
|
598
|
-
source = ["#{
|
612
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
599
613
|
'Some description.',
|
600
614
|
'Some more description.']
|
601
615
|
source = source.join("\n")
|
@@ -603,7 +617,7 @@ describe 'Example, Integration' do
|
|
603
617
|
|
604
618
|
example_output = example.to_s.split("\n", -1)
|
605
619
|
|
606
|
-
expect(example_output).to eq(["#{
|
620
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
607
621
|
'',
|
608
622
|
'Some description.',
|
609
623
|
'Some more description.'])
|
@@ -612,19 +626,19 @@ describe 'Example, Integration' do
|
|
612
626
|
|
613
627
|
# gherkin 3.x does not accept incomplete examples
|
614
628
|
it 'can output an example that has a single row', :gherkin3 => false do
|
615
|
-
source = ["#{
|
629
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
616
630
|
'|param1|param2|']
|
617
631
|
source = source.join("\n")
|
618
632
|
example = clazz.new(source)
|
619
633
|
|
620
634
|
example_output = example.to_s.split("\n", -1)
|
621
635
|
|
622
|
-
expect(example_output).to eq(["#{
|
636
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
623
637
|
' | param1 | param2 |'])
|
624
638
|
end
|
625
639
|
|
626
640
|
it 'can output an example that has multiple rows' do
|
627
|
-
source = ["#{
|
641
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
628
642
|
'|param1|param2|',
|
629
643
|
'|value1|value2|',
|
630
644
|
'|value3|value4|']
|
@@ -633,7 +647,7 @@ describe 'Example, Integration' do
|
|
633
647
|
|
634
648
|
example_output = example.to_s.split("\n", -1)
|
635
649
|
|
636
|
-
expect(example_output).to eq(["#{
|
650
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
637
651
|
' | param1 | param2 |',
|
638
652
|
' | value1 | value2 |',
|
639
653
|
' | value3 | value4 |'])
|
@@ -642,7 +656,7 @@ describe 'Example, Integration' do
|
|
642
656
|
it 'can output an example that has tags' do
|
643
657
|
source = ['@tag1',
|
644
658
|
'@tag2 @tag3',
|
645
|
-
"#{
|
659
|
+
"#{EXAMPLE_KEYWORD}:",
|
646
660
|
'|param1|param2|',
|
647
661
|
'|value1|value2|',
|
648
662
|
'|value3|value4|']
|
@@ -652,7 +666,7 @@ describe 'Example, Integration' do
|
|
652
666
|
example_output = example.to_s.split("\n", -1)
|
653
667
|
|
654
668
|
expect(example_output).to eq(['@tag1 @tag2 @tag3',
|
655
|
-
"#{
|
669
|
+
"#{EXAMPLE_KEYWORD}:",
|
656
670
|
' | param1 | param2 |',
|
657
671
|
' | value1 | value2 |',
|
658
672
|
' | value3 | value4 |'])
|
@@ -661,7 +675,7 @@ describe 'Example, Integration' do
|
|
661
675
|
it 'can output an example that has everything' do
|
662
676
|
source = ['@tag1',
|
663
677
|
'@tag2 @tag3',
|
664
|
-
"#{
|
678
|
+
"#{EXAMPLE_KEYWORD}: with everything it could have",
|
665
679
|
'Some description.',
|
666
680
|
'Some more description.',
|
667
681
|
'|param1|param2|',
|
@@ -673,7 +687,7 @@ describe 'Example, Integration' do
|
|
673
687
|
example_output = example.to_s.split("\n", -1)
|
674
688
|
|
675
689
|
expect(example_output).to eq(['@tag1 @tag2 @tag3',
|
676
|
-
"#{
|
690
|
+
"#{EXAMPLE_KEYWORD}: with everything it could have",
|
677
691
|
'',
|
678
692
|
'Some description.',
|
679
693
|
'Some more description.',
|
@@ -684,7 +698,7 @@ describe 'Example, Integration' do
|
|
684
698
|
end
|
685
699
|
|
686
700
|
it 'buffers row cells based on the longest value in a column' do
|
687
|
-
source = "#{
|
701
|
+
source = "#{EXAMPLE_KEYWORD}:
|
688
702
|
|parameter 1| x|
|
689
703
|
|y|value 1|
|
690
704
|
|a|b|"
|
@@ -692,7 +706,7 @@ describe 'Example, Integration' do
|
|
692
706
|
|
693
707
|
example_output = example.to_s.split("\n", -1)
|
694
708
|
|
695
|
-
expect(example_output).to eq(["#{
|
709
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
696
710
|
' | parameter 1 | x |',
|
697
711
|
' | y | value 1 |',
|
698
712
|
' | a | b |'])
|