cuke_modeler 3.13.0 → 3.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -1
- data/LICENSE.txt +1 -1
- data/cuke_modeler.gemspec +1 -1
- data/lib/cuke_modeler/adapters/gherkin_20_adapter.rb +14 -0
- data/lib/cuke_modeler/adapters/gherkin_23_adapter.rb +13 -0
- data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +14 -0
- data/lib/cuke_modeler/containing.rb +18 -13
- data/lib/cuke_modeler/models/feature.rb +3 -0
- data/lib/cuke_modeler/parsing.rb +2 -4
- data/lib/cuke_modeler/sourceable.rb +4 -1
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/features/modeling/background_modeling.feature +28 -5
- data/testing/cucumber/features/modeling/cell_modeling.feature +46 -0
- data/testing/cucumber/features/modeling/comment_modeling.feature +20 -0
- data/testing/cucumber/features/modeling/doc_string_modeling.feature +26 -0
- data/testing/cucumber/features/modeling/example_modeling.feature +25 -0
- data/testing/cucumber/features/modeling/feature_modeling.feature +16 -1
- data/testing/cucumber/features/modeling/outline_modeling.feature +26 -1
- data/testing/cucumber/features/modeling/row_modeling.feature +23 -0
- data/testing/cucumber/features/modeling/rule_modeling.feature +21 -0
- data/testing/cucumber/features/modeling/scenario_modeling.feature +22 -0
- data/testing/cucumber/features/modeling/step_modeling.feature +22 -0
- data/testing/cucumber/features/modeling/table_modeling.feature +24 -0
- data/testing/cucumber/features/modeling/tag_modeling.feature +20 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cd72d6cdcc97b1802563f6cef298f9efbf0fea704d395bb8bfa22f15a63ecbe
|
4
|
+
data.tar.gz: c884d7eb4ce70f5934cc9916d39602bfaf44be5e6c9ebd468614e5b3363a9511
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88d6ad6cee0150b534f2a4b69f5492f37b2c2f0b4e844f232c074ca9a31a51a6d437c4f38b191b34bf56bb31abc55d2ee514a5ceb9c281fafa0ffe11ce31243c
|
7
|
+
data.tar.gz: d0bbb9585f0040c9f20537d87b2761ec9ee06372bc5ad4e5b486e56e2a4990dd8b2189b7354ffe0ee593a7b9ad84e87eee1083cc37ccc91880785c7c3e7ce099
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
8
8
|
|
9
9
|
Nothing yet...
|
10
10
|
|
11
|
+
## [3.16.0] - 2022-05-30
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- Support added for more versions of the `cucumber-gherkin` gem
|
15
|
+
- 23.x
|
16
|
+
|
17
|
+
## [3.15.0] - 2021-11-27
|
18
|
+
|
19
|
+
### Added
|
20
|
+
- The language of a feature (e.g. 'en', 'hi', 'zh-CN', etc.) is now a modeled attribute on `Feature` models.
|
21
|
+
|
22
|
+
## [3.14.0] - 2021-11-22
|
23
|
+
|
24
|
+
### Added
|
25
|
+
- All models for Gherkin elements now track the column number from which they originate in a source file.
|
26
|
+
|
11
27
|
## [3.13.0] - 2021-09-25
|
12
28
|
|
13
29
|
### Added
|
@@ -408,7 +424,10 @@ Nothing yet...
|
|
408
424
|
- Initial release
|
409
425
|
|
410
426
|
|
411
|
-
[Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.
|
427
|
+
[Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.16.0...HEAD
|
428
|
+
[3.16.0]: https://github.com/enkessler/cuke_modeler/compare/v3.15.0...v3.16.0
|
429
|
+
[3.15.0]: https://github.com/enkessler/cuke_modeler/compare/v3.14.0...v3.15.0
|
430
|
+
[3.14.0]: https://github.com/enkessler/cuke_modeler/compare/v3.13.0...v3.14.0
|
412
431
|
[3.13.0]: https://github.com/enkessler/cuke_modeler/compare/v3.12.0...v3.13.0
|
413
432
|
[3.12.0]: https://github.com/enkessler/cuke_modeler/compare/v3.11.0...v3.12.0
|
414
433
|
[3.11.0]: https://github.com/enkessler/cuke_modeler/compare/v3.10.0...v3.11.0
|
data/LICENSE.txt
CHANGED
data/cuke_modeler.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
|
37
37
|
spec.required_ruby_version = '>= 2.3', '< 4.0'
|
38
38
|
|
39
|
-
spec.add_runtime_dependency 'cucumber-gherkin', '<
|
39
|
+
spec.add_runtime_dependency 'cucumber-gherkin', '< 24.0'
|
40
40
|
|
41
41
|
spec.add_development_dependency 'bundler', '< 3.0'
|
42
42
|
spec.add_development_dependency 'childprocess', '< 5.0'
|
@@ -35,10 +35,12 @@ module CukeModeler
|
|
35
35
|
clear_child_elements(adapted_feature, [[:tags],
|
36
36
|
[:children]])
|
37
37
|
|
38
|
+
adapted_feature['language'] = feature_ast.language
|
38
39
|
adapted_feature['keyword'] = feature_ast.keyword
|
39
40
|
adapted_feature['name'] = feature_ast.name
|
40
41
|
adapted_feature['description'] = feature_ast.description
|
41
42
|
adapted_feature['line'] = feature_ast.location.line
|
43
|
+
adapted_feature['column'] = feature_ast.location.column
|
42
44
|
|
43
45
|
adapted_feature['elements'] = adapt_child_elements(feature_ast)
|
44
46
|
adapted_feature['tags'] = adapt_tags(feature_ast)
|
@@ -59,6 +61,7 @@ module CukeModeler
|
|
59
61
|
adapted_background['name'] = background_ast.background.name
|
60
62
|
adapted_background['description'] = background_ast.background.description
|
61
63
|
adapted_background['line'] = background_ast.background.location.line
|
64
|
+
adapted_background['column'] = background_ast.background.location.column
|
62
65
|
|
63
66
|
adapted_background['steps'] = adapt_steps(background_ast.background)
|
64
67
|
|
@@ -79,6 +82,7 @@ module CukeModeler
|
|
79
82
|
adapted_rule['name'] = rule_ast.rule.name
|
80
83
|
adapted_rule['description'] = rule_ast.rule.description
|
81
84
|
adapted_rule['line'] = rule_ast.rule.location.line
|
85
|
+
adapted_rule['column'] = rule_ast.rule.location.column
|
82
86
|
|
83
87
|
adapted_rule['elements'] = adapt_child_elements(rule_ast.rule)
|
84
88
|
adapted_rule['tags'] = adapt_tags(rule_ast.rule)
|
@@ -100,6 +104,7 @@ module CukeModeler
|
|
100
104
|
adapted_scenario['name'] = test_ast.scenario.name
|
101
105
|
adapted_scenario['description'] = test_ast.scenario.description
|
102
106
|
adapted_scenario['line'] = test_ast.scenario.location.line
|
107
|
+
adapted_scenario['column'] = test_ast.scenario.location.column
|
103
108
|
|
104
109
|
adapted_scenario['tags'] = adapt_tags(test_ast.scenario)
|
105
110
|
adapted_scenario['steps'] = adapt_steps(test_ast.scenario)
|
@@ -122,6 +127,7 @@ module CukeModeler
|
|
122
127
|
adapted_outline['name'] = test_ast.scenario.name
|
123
128
|
adapted_outline['description'] = test_ast.scenario.description
|
124
129
|
adapted_outline['line'] = test_ast.scenario.location.line
|
130
|
+
adapted_outline['column'] = test_ast.scenario.location.column
|
125
131
|
|
126
132
|
adapted_outline['tags'] = adapt_tags(test_ast.scenario)
|
127
133
|
adapted_outline['steps'] = adapt_steps(test_ast.scenario)
|
@@ -143,6 +149,7 @@ module CukeModeler
|
|
143
149
|
adapted_example['keyword'] = example_ast.keyword
|
144
150
|
adapted_example['name'] = example_ast.name
|
145
151
|
adapted_example['line'] = example_ast.location.line
|
152
|
+
adapted_example['column'] = example_ast.location.column
|
146
153
|
adapted_example['description'] = example_ast.description
|
147
154
|
|
148
155
|
adapted_example['rows'] = []
|
@@ -166,6 +173,7 @@ module CukeModeler
|
|
166
173
|
|
167
174
|
adapted_tag['name'] = tag_ast.name
|
168
175
|
adapted_tag['line'] = tag_ast.location.line
|
176
|
+
adapted_tag['column'] = tag_ast.location.column
|
169
177
|
|
170
178
|
adapted_tag
|
171
179
|
end
|
@@ -179,6 +187,7 @@ module CukeModeler
|
|
179
187
|
|
180
188
|
adapted_comment['text'] = comment_ast.text
|
181
189
|
adapted_comment['line'] = comment_ast.location.line
|
190
|
+
adapted_comment['column'] = comment_ast.location.column
|
182
191
|
|
183
192
|
adapted_comment
|
184
193
|
end
|
@@ -195,6 +204,7 @@ module CukeModeler
|
|
195
204
|
adapted_step['keyword'] = step_ast.keyword
|
196
205
|
adapted_step['name'] = step_ast.text
|
197
206
|
adapted_step['line'] = step_ast.location.line
|
207
|
+
adapted_step['column'] = step_ast.location.column
|
198
208
|
|
199
209
|
if step_ast.doc_string
|
200
210
|
adapted_step['doc_string'] = adapt_doc_string(step_ast.doc_string)
|
@@ -215,6 +225,7 @@ module CukeModeler
|
|
215
225
|
adapted_doc_string['value'] = doc_string_ast.content
|
216
226
|
adapted_doc_string['content_type'] = doc_string_ast.media_type
|
217
227
|
adapted_doc_string['line'] = doc_string_ast.location.line
|
228
|
+
adapted_doc_string['column'] = doc_string_ast.location.column
|
218
229
|
|
219
230
|
adapted_doc_string
|
220
231
|
end
|
@@ -232,6 +243,7 @@ module CukeModeler
|
|
232
243
|
adapted_step_table['rows'] << adapt_table_row(row)
|
233
244
|
end
|
234
245
|
adapted_step_table['line'] = step_table_ast.location.line
|
246
|
+
adapted_step_table['column'] = step_table_ast.location.column
|
235
247
|
|
236
248
|
adapted_step_table
|
237
249
|
end
|
@@ -245,6 +257,7 @@ module CukeModeler
|
|
245
257
|
clear_child_elements(adapted_table_row, [[:cells]])
|
246
258
|
|
247
259
|
adapted_table_row['line'] = table_row_ast.location.line
|
260
|
+
adapted_table_row['column'] = table_row_ast.location.column
|
248
261
|
|
249
262
|
adapted_table_row['cells'] = []
|
250
263
|
table_row_ast.cells.each do |row|
|
@@ -263,6 +276,7 @@ module CukeModeler
|
|
263
276
|
|
264
277
|
adapted_cell['value'] = cell_ast.value
|
265
278
|
adapted_cell['line'] = cell_ast.location.line
|
279
|
+
adapted_cell['column'] = cell_ast.location.column
|
266
280
|
|
267
281
|
adapted_cell
|
268
282
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'gherkin_20_adapter'
|
2
|
+
|
3
|
+
|
4
|
+
module CukeModeler
|
5
|
+
|
6
|
+
# NOT A PART OF THE PUBLIC API
|
7
|
+
# An adapter that can convert the output of version 23.x of the *cucumber-gherkin* gem into input that is consumable
|
8
|
+
# by this gem.
|
9
|
+
|
10
|
+
class Gherkin23Adapter < Gherkin20Adapter
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -36,10 +36,12 @@ module CukeModeler
|
|
36
36
|
clear_child_elements(adapted_feature, [[:tags],
|
37
37
|
[:children]])
|
38
38
|
|
39
|
+
adapted_feature['language'] = feature_ast[:language]
|
39
40
|
adapted_feature['keyword'] = feature_ast[:keyword]
|
40
41
|
adapted_feature['name'] = feature_ast[:name]
|
41
42
|
adapted_feature['description'] = feature_ast[:description] || ''
|
42
43
|
adapted_feature['line'] = feature_ast[:location][:line]
|
44
|
+
adapted_feature['column'] = feature_ast[:location][:column]
|
43
45
|
|
44
46
|
adapted_feature['elements'] = adapt_child_elements(feature_ast)
|
45
47
|
adapted_feature['tags'] = adapt_tags(feature_ast)
|
@@ -60,6 +62,7 @@ module CukeModeler
|
|
60
62
|
adapted_background['name'] = background_ast[:background][:name]
|
61
63
|
adapted_background['description'] = background_ast[:background][:description] || ''
|
62
64
|
adapted_background['line'] = background_ast[:background][:location][:line]
|
65
|
+
adapted_background['column'] = background_ast[:background][:location][:column]
|
63
66
|
|
64
67
|
adapted_background['steps'] = adapt_steps(background_ast[:background])
|
65
68
|
|
@@ -79,6 +82,7 @@ module CukeModeler
|
|
79
82
|
adapted_rule['name'] = rule_ast[:rule][:name]
|
80
83
|
adapted_rule['description'] = rule_ast[:rule][:description] || ''
|
81
84
|
adapted_rule['line'] = rule_ast[:rule][:location][:line]
|
85
|
+
adapted_rule['column'] = rule_ast[:rule][:location][:column]
|
82
86
|
|
83
87
|
adapted_rule['elements'] = adapt_child_elements(rule_ast[:rule])
|
84
88
|
|
@@ -99,6 +103,7 @@ module CukeModeler
|
|
99
103
|
adapted_scenario['name'] = test_ast[:scenario][:name]
|
100
104
|
adapted_scenario['description'] = test_ast[:scenario][:description] || ''
|
101
105
|
adapted_scenario['line'] = test_ast[:scenario][:location][:line]
|
106
|
+
adapted_scenario['column'] = test_ast[:scenario][:location][:column]
|
102
107
|
|
103
108
|
adapted_scenario['tags'] = adapt_tags(test_ast[:scenario])
|
104
109
|
adapted_scenario['steps'] = adapt_steps(test_ast[:scenario])
|
@@ -121,6 +126,7 @@ module CukeModeler
|
|
121
126
|
adapted_outline['name'] = test_ast[:scenario][:name]
|
122
127
|
adapted_outline['description'] = test_ast[:scenario][:description] || ''
|
123
128
|
adapted_outline['line'] = test_ast[:scenario][:location][:line]
|
129
|
+
adapted_outline['column'] = test_ast[:scenario][:location][:column]
|
124
130
|
|
125
131
|
adapted_outline['tags'] = adapt_tags(test_ast[:scenario])
|
126
132
|
adapted_outline['steps'] = adapt_steps(test_ast[:scenario])
|
@@ -142,6 +148,7 @@ module CukeModeler
|
|
142
148
|
adapted_example['keyword'] = example_ast[:keyword]
|
143
149
|
adapted_example['name'] = example_ast[:name]
|
144
150
|
adapted_example['line'] = example_ast[:location][:line]
|
151
|
+
adapted_example['column'] = example_ast[:location][:column]
|
145
152
|
adapted_example['description'] = example_ast[:description] || ''
|
146
153
|
|
147
154
|
adapted_example['rows'] = []
|
@@ -165,6 +172,7 @@ module CukeModeler
|
|
165
172
|
|
166
173
|
adapted_tag['name'] = tag_ast[:name]
|
167
174
|
adapted_tag['line'] = tag_ast[:location][:line]
|
175
|
+
adapted_tag['column'] = tag_ast[:location][:column]
|
168
176
|
|
169
177
|
adapted_tag
|
170
178
|
end
|
@@ -178,6 +186,7 @@ module CukeModeler
|
|
178
186
|
|
179
187
|
adapted_comment['text'] = comment_ast[:text]
|
180
188
|
adapted_comment['line'] = comment_ast[:location][:line]
|
189
|
+
adapted_comment['column'] = comment_ast[:location][:column]
|
181
190
|
|
182
191
|
adapted_comment
|
183
192
|
end
|
@@ -194,6 +203,7 @@ module CukeModeler
|
|
194
203
|
adapted_step['keyword'] = step_ast[:keyword]
|
195
204
|
adapted_step['name'] = step_ast[:text]
|
196
205
|
adapted_step['line'] = step_ast[:location][:line]
|
206
|
+
adapted_step['column'] = step_ast[:location][:column]
|
197
207
|
|
198
208
|
if step_ast[:doc_string]
|
199
209
|
adapted_step['doc_string'] = adapt_doc_string(step_ast[:doc_string])
|
@@ -214,6 +224,7 @@ module CukeModeler
|
|
214
224
|
adapted_doc_string['value'] = doc_string_ast[:content]
|
215
225
|
adapted_doc_string['content_type'] = doc_string_ast[:media_type]
|
216
226
|
adapted_doc_string['line'] = doc_string_ast[:location][:line]
|
227
|
+
adapted_doc_string['column'] = doc_string_ast[:location][:column]
|
217
228
|
|
218
229
|
adapted_doc_string
|
219
230
|
end
|
@@ -231,6 +242,7 @@ module CukeModeler
|
|
231
242
|
adapted_step_table['rows'] << adapt_table_row(row)
|
232
243
|
end
|
233
244
|
adapted_step_table['line'] = step_table_ast[:location][:line]
|
245
|
+
adapted_step_table['column'] = step_table_ast[:location][:column]
|
234
246
|
|
235
247
|
adapted_step_table
|
236
248
|
end
|
@@ -244,6 +256,7 @@ module CukeModeler
|
|
244
256
|
clear_child_elements(adapted_table_row, [[:cells]])
|
245
257
|
|
246
258
|
adapted_table_row['line'] = table_row_ast[:location][:line]
|
259
|
+
adapted_table_row['column'] = table_row_ast[:location][:column]
|
247
260
|
|
248
261
|
adapted_table_row['cells'] = []
|
249
262
|
table_row_ast[:cells].each do |row|
|
@@ -262,6 +275,7 @@ module CukeModeler
|
|
262
275
|
|
263
276
|
adapted_cell['value'] = cell_ast[:value]
|
264
277
|
adapted_cell['line'] = cell_ast[:location][:line]
|
278
|
+
adapted_cell['column'] = cell_ast[:location][:column]
|
265
279
|
|
266
280
|
adapted_cell
|
267
281
|
end
|
@@ -55,7 +55,7 @@ module CukeModeler
|
|
55
55
|
|
56
56
|
def populate_scenario(scenario_object, parsed_scenario_data)
|
57
57
|
populate_parsing_data(scenario_object, parsed_scenario_data)
|
58
|
-
|
58
|
+
populate_source_location(scenario_object, parsed_scenario_data)
|
59
59
|
populate_keyword(scenario_object, parsed_scenario_data)
|
60
60
|
populate_name(scenario_object, parsed_scenario_data)
|
61
61
|
populate_description(scenario_object, parsed_scenario_data)
|
@@ -65,7 +65,7 @@ module CukeModeler
|
|
65
65
|
|
66
66
|
def populate_outline(outline_object, parsed_outline_data)
|
67
67
|
populate_parsing_data(outline_object, parsed_outline_data)
|
68
|
-
|
68
|
+
populate_source_location(outline_object, parsed_outline_data)
|
69
69
|
populate_keyword(outline_object, parsed_outline_data)
|
70
70
|
populate_name(outline_object, parsed_outline_data)
|
71
71
|
populate_description(outline_object, parsed_outline_data)
|
@@ -79,7 +79,7 @@ module CukeModeler
|
|
79
79
|
populate_keyword(background_object, parsed_background_data)
|
80
80
|
populate_name(background_object, parsed_background_data)
|
81
81
|
populate_description(background_object, parsed_background_data)
|
82
|
-
|
82
|
+
populate_source_location(background_object, parsed_background_data)
|
83
83
|
populate_steps(background_object, parsed_background_data)
|
84
84
|
end
|
85
85
|
|
@@ -87,7 +87,7 @@ module CukeModeler
|
|
87
87
|
populate_text(step_object, parsed_step_data)
|
88
88
|
populate_block(step_object, parsed_step_data)
|
89
89
|
populate_keyword(step_object, parsed_step_data)
|
90
|
-
|
90
|
+
populate_source_location(step_object, parsed_step_data)
|
91
91
|
populate_parsing_data(step_object, parsed_step_data)
|
92
92
|
end
|
93
93
|
|
@@ -102,12 +102,12 @@ module CukeModeler
|
|
102
102
|
def populate_table(table_object, parsed_table_data)
|
103
103
|
populate_row_models(table_object, parsed_table_data)
|
104
104
|
populate_parsing_data(table_object, parsed_table_data)
|
105
|
-
|
105
|
+
populate_source_location(table_object, parsed_table_data)
|
106
106
|
end
|
107
107
|
|
108
108
|
def populate_cell(cell_object, parsed_cell_data)
|
109
109
|
populate_cell_value(cell_object, parsed_cell_data)
|
110
|
-
|
110
|
+
populate_source_location(cell_object, parsed_cell_data)
|
111
111
|
populate_parsing_data(cell_object, parsed_cell_data)
|
112
112
|
end
|
113
113
|
|
@@ -115,13 +115,13 @@ module CukeModeler
|
|
115
115
|
populate_content_type(doc_string_object, parsed_doc_string_data)
|
116
116
|
populate_content(doc_string_object, parsed_doc_string_data)
|
117
117
|
populate_parsing_data(doc_string_object, parsed_doc_string_data)
|
118
|
-
|
118
|
+
populate_source_location(doc_string_object, parsed_doc_string_data)
|
119
119
|
end
|
120
120
|
|
121
121
|
def populate_example(example_object, parsed_example_data)
|
122
122
|
populate_parsing_data(example_object, parsed_example_data)
|
123
123
|
populate_keyword(example_object, parsed_example_data)
|
124
|
-
|
124
|
+
populate_source_location(example_object, parsed_example_data)
|
125
125
|
populate_name(example_object, parsed_example_data)
|
126
126
|
populate_description(example_object, parsed_example_data)
|
127
127
|
populate_tags(example_object, parsed_example_data)
|
@@ -129,14 +129,15 @@ module CukeModeler
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def populate_row(row_object, parsed_row_data)
|
132
|
-
|
132
|
+
populate_source_location(row_object, parsed_row_data)
|
133
133
|
populate_row_cells(row_object, parsed_row_data)
|
134
134
|
populate_parsing_data(row_object, parsed_row_data)
|
135
135
|
end
|
136
136
|
|
137
137
|
def populate_feature(feature_object, parsed_feature_data)
|
138
138
|
populate_parsing_data(feature_object, parsed_feature_data)
|
139
|
-
|
139
|
+
populate_source_location(feature_object, parsed_feature_data)
|
140
|
+
populate_language(feature_object, parsed_feature_data)
|
140
141
|
populate_keyword(feature_object, parsed_feature_data)
|
141
142
|
populate_name(feature_object, parsed_feature_data)
|
142
143
|
populate_description(feature_object, parsed_feature_data)
|
@@ -146,7 +147,7 @@ module CukeModeler
|
|
146
147
|
|
147
148
|
def populate_rule(rule_object, parsed_rule_data)
|
148
149
|
populate_parsing_data(rule_object, parsed_rule_data)
|
149
|
-
|
150
|
+
populate_source_location(rule_object, parsed_rule_data)
|
150
151
|
populate_keyword(rule_object, parsed_rule_data)
|
151
152
|
populate_name(rule_object, parsed_rule_data)
|
152
153
|
populate_description(rule_object, parsed_rule_data)
|
@@ -182,13 +183,17 @@ module CukeModeler
|
|
182
183
|
def populate_tag(tag_object, processed_tag_data)
|
183
184
|
populate_name(tag_object, processed_tag_data)
|
184
185
|
populate_parsing_data(tag_object, processed_tag_data)
|
185
|
-
|
186
|
+
populate_source_location(tag_object, processed_tag_data)
|
186
187
|
end
|
187
188
|
|
188
189
|
def populate_comment(comment_object, processed_comment_data)
|
189
190
|
populate_comment_text(comment_object, processed_comment_data)
|
190
191
|
populate_parsing_data(comment_object, processed_comment_data)
|
191
|
-
|
192
|
+
populate_source_location(comment_object, processed_comment_data)
|
193
|
+
end
|
194
|
+
|
195
|
+
def populate_language(feature_model, parsed_feature_data)
|
196
|
+
feature_model.language = parsed_feature_data['language']
|
192
197
|
end
|
193
198
|
|
194
199
|
def populate_comment_text(comment_model, parsed_comment_data)
|
data/lib/cuke_modeler/parsing.rb
CHANGED
@@ -9,7 +9,7 @@ require 'gherkin'
|
|
9
9
|
# an 'adapter' appropriate to the version of the *cucumber-gherkin* gem that has been activated.
|
10
10
|
gherkin_version = Gem.loaded_specs['cucumber-gherkin'].version.version
|
11
11
|
gherkin_major_version = gherkin_version.match(/^(\d+)\./)[1].to_i
|
12
|
-
supported_gherkin_versions = (9..
|
12
|
+
supported_gherkin_versions = (9..23)
|
13
13
|
|
14
14
|
raise("Unknown Gherkin version: '#{gherkin_version}'") unless supported_gherkin_versions.include?(gherkin_major_version)
|
15
15
|
|
@@ -63,7 +63,7 @@ module CukeModeler
|
|
63
63
|
# inside of it, so I'm leaving this here in case it changes again
|
64
64
|
# rubocop:disable Lint/DuplicateMethods
|
65
65
|
case gherkin_major_version
|
66
|
-
when 20, 21, 22
|
66
|
+
when 20, 21, 22, 23
|
67
67
|
# TODO: make these methods private?
|
68
68
|
# NOT A PART OF THE PUBLIC API
|
69
69
|
# The method to use for parsing Gherkin text
|
@@ -152,8 +152,6 @@ module CukeModeler
|
|
152
152
|
|
153
153
|
gherkin_ast_message[:gherkin_document]
|
154
154
|
end
|
155
|
-
else
|
156
|
-
raise("Unknown Gherkin version: '#{gherkin_version}'")
|
157
155
|
end
|
158
156
|
# rubocop:enable Lint/DuplicateMethods
|
159
157
|
|
@@ -8,12 +8,15 @@ module CukeModeler
|
|
8
8
|
# The line number where the element began in the source code
|
9
9
|
attr_accessor :source_line
|
10
10
|
|
11
|
+
# The column number where the element began in the source code
|
12
|
+
attr_accessor :source_column
|
11
13
|
|
12
14
|
private
|
13
15
|
|
14
16
|
|
15
|
-
def
|
17
|
+
def populate_source_location(model, parsed_model_data)
|
16
18
|
model.source_line = parsed_model_data['line']
|
19
|
+
model.source_column = parsed_model_data['column']
|
17
20
|
end
|
18
21
|
|
19
22
|
end
|
data/lib/cuke_modeler/version.rb
CHANGED
@@ -23,21 +23,21 @@ Feature: Background modeling
|
|
23
23
|
"""
|
24
24
|
|
25
25
|
|
26
|
-
Scenario: Modeling a
|
26
|
+
Scenario: Modeling a background's keyword
|
27
27
|
When the backgrounds's keyword is requested
|
28
28
|
"""
|
29
29
|
@model.keyword
|
30
30
|
"""
|
31
31
|
Then the model returns "Background"
|
32
32
|
|
33
|
-
Scenario: Modeling a
|
33
|
+
Scenario: Modeling a background's name
|
34
34
|
When the background's name is requested
|
35
35
|
"""
|
36
36
|
@model.name
|
37
37
|
"""
|
38
38
|
Then the model returns "Some general test setup stuff."
|
39
39
|
|
40
|
-
Scenario: Modeling a
|
40
|
+
Scenario: Modeling a background's description
|
41
41
|
When the background's description is requested
|
42
42
|
"""
|
43
43
|
@model.description
|
@@ -50,7 +50,7 @@ Feature: Background modeling
|
|
50
50
|
Even more.
|
51
51
|
"""
|
52
52
|
|
53
|
-
Scenario: Modeling a
|
53
|
+
Scenario: Modeling a background's steps
|
54
54
|
When the background's steps are requested
|
55
55
|
"""
|
56
56
|
@model.steps
|
@@ -60,7 +60,7 @@ Feature: Background modeling
|
|
60
60
|
| another setup step |
|
61
61
|
| an action step |
|
62
62
|
|
63
|
-
Scenario: Modeling a
|
63
|
+
Scenario: Modeling a background's source line
|
64
64
|
Given the following gherkin:
|
65
65
|
"""
|
66
66
|
Feature:
|
@@ -81,3 +81,26 @@ Feature: Background modeling
|
|
81
81
|
@model.source_line
|
82
82
|
"""
|
83
83
|
Then the model returns "3"
|
84
|
+
|
85
|
+
Scenario: Modeling a background's source column
|
86
|
+
Given the following gherkin:
|
87
|
+
"""
|
88
|
+
Feature:
|
89
|
+
|
90
|
+
|
91
|
+
Background:
|
92
|
+
* a step
|
93
|
+
"""
|
94
|
+
And a feature model based on that gherkin
|
95
|
+
"""
|
96
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
97
|
+
"""
|
98
|
+
And the background model of that feature model
|
99
|
+
"""
|
100
|
+
@model = @model.background
|
101
|
+
"""
|
102
|
+
When the background's source column is requested
|
103
|
+
"""
|
104
|
+
@model.source_column
|
105
|
+
"""
|
106
|
+
Then the model returns "3"
|
@@ -20,3 +20,49 @@ Feature: Cell modeling
|
|
20
20
|
@model.value
|
21
21
|
"""
|
22
22
|
Then the model returns "foo"
|
23
|
+
|
24
|
+
Scenario: Modeling a cell's source line
|
25
|
+
Given the following gherkin:
|
26
|
+
"""
|
27
|
+
Feature:
|
28
|
+
|
29
|
+
Scenario:
|
30
|
+
* a step
|
31
|
+
| foo |
|
32
|
+
"""
|
33
|
+
And a feature model based on that gherkin
|
34
|
+
"""
|
35
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
36
|
+
"""
|
37
|
+
And the cell model inside of that feature model
|
38
|
+
"""
|
39
|
+
@model = @model.tests.first.steps.first.block.rows.first.cells.first
|
40
|
+
"""
|
41
|
+
When the cell's source line is requested
|
42
|
+
"""
|
43
|
+
@model.source_line
|
44
|
+
"""
|
45
|
+
Then the model returns "5"
|
46
|
+
|
47
|
+
Scenario: Modeling a cell's source column
|
48
|
+
Given the following gherkin:
|
49
|
+
"""
|
50
|
+
Feature:
|
51
|
+
|
52
|
+
Scenario:
|
53
|
+
* a step
|
54
|
+
| foo |
|
55
|
+
"""
|
56
|
+
And a feature model based on that gherkin
|
57
|
+
"""
|
58
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
59
|
+
"""
|
60
|
+
And the cell model inside of that feature model
|
61
|
+
"""
|
62
|
+
@model = @model.tests.first.steps.first.block.rows.first.cells.first
|
63
|
+
"""
|
64
|
+
When the cell's source column is requested
|
65
|
+
"""
|
66
|
+
@model.source_column
|
67
|
+
"""
|
68
|
+
Then the model returns "9"
|
@@ -40,3 +40,23 @@ Feature: Comment modeling
|
|
40
40
|
@model.source_line
|
41
41
|
"""
|
42
42
|
Then the model returns "1"
|
43
|
+
|
44
|
+
Scenario: Modeling a comment's source column
|
45
|
+
Given a feature file with the following gherkin:
|
46
|
+
"""
|
47
|
+
# a comment
|
48
|
+
Feature:
|
49
|
+
"""
|
50
|
+
And a feature file model based on that file
|
51
|
+
"""
|
52
|
+
@model = CukeModeler::FeatureFile.new(<file_path>)
|
53
|
+
"""
|
54
|
+
And the comment model of that feature file model
|
55
|
+
"""
|
56
|
+
@model = @model.comments.first
|
57
|
+
"""
|
58
|
+
When the comment's source column is requested
|
59
|
+
"""
|
60
|
+
@model.source_column
|
61
|
+
"""
|
62
|
+
Then the model returns "1"
|
@@ -57,3 +57,29 @@ Feature: Doc string modeling
|
|
57
57
|
@model.source_line
|
58
58
|
"""
|
59
59
|
Then the model returns "5"
|
60
|
+
|
61
|
+
|
62
|
+
Scenario: Modeling a doc string's source column
|
63
|
+
Given the following gherkin:
|
64
|
+
"""
|
65
|
+
Feature:
|
66
|
+
|
67
|
+
Scenario:
|
68
|
+
* a step
|
69
|
+
\"\"\"
|
70
|
+
foo
|
71
|
+
\"\"\"
|
72
|
+
"""
|
73
|
+
And a feature model based on that gherkin
|
74
|
+
"""
|
75
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
76
|
+
"""
|
77
|
+
And the doc string model inside of that feature model
|
78
|
+
"""
|
79
|
+
@model = @model.tests.first.steps.first.block
|
80
|
+
"""
|
81
|
+
When the doc string's source column is requested
|
82
|
+
"""
|
83
|
+
@model.source_column
|
84
|
+
"""
|
85
|
+
Then the model returns "7"
|
@@ -128,3 +128,28 @@ Feature: Example modeling
|
|
128
128
|
@model.source_line
|
129
129
|
"""
|
130
130
|
Then the model returns "5"
|
131
|
+
|
132
|
+
Scenario: Modeling an example's source column
|
133
|
+
Given the following gherkin:
|
134
|
+
"""
|
135
|
+
Feature:
|
136
|
+
|
137
|
+
Scenario Outline:
|
138
|
+
* a step
|
139
|
+
Examples:
|
140
|
+
| param |
|
141
|
+
| value |
|
142
|
+
"""
|
143
|
+
And a feature model based on that gherkin
|
144
|
+
"""
|
145
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
146
|
+
"""
|
147
|
+
And the example model inside of that feature model
|
148
|
+
"""
|
149
|
+
@model = @model.tests.first.examples.first
|
150
|
+
"""
|
151
|
+
When the example's source column is requested
|
152
|
+
"""
|
153
|
+
@model.source_column
|
154
|
+
"""
|
155
|
+
Then the model returns "3"
|
@@ -8,6 +8,7 @@ that feature.
|
|
8
8
|
Background:
|
9
9
|
Given the following gherkin:
|
10
10
|
"""
|
11
|
+
# language: en
|
11
12
|
@tag_1 @tag_2
|
12
13
|
Feature: Feature Foo
|
13
14
|
|
@@ -131,4 +132,18 @@ that feature.
|
|
131
132
|
"""
|
132
133
|
@model.source_line
|
133
134
|
"""
|
134
|
-
Then the model returns "
|
135
|
+
Then the model returns "3"
|
136
|
+
|
137
|
+
Scenario: Modeling a feature's source column
|
138
|
+
When the feature's source column is requested
|
139
|
+
"""
|
140
|
+
@model.source_column
|
141
|
+
"""
|
142
|
+
Then the model returns "1"
|
143
|
+
|
144
|
+
Scenario: Modeling a feature's language
|
145
|
+
When the feature's language is requested
|
146
|
+
"""
|
147
|
+
@model.language
|
148
|
+
"""
|
149
|
+
Then the model returns "en"
|
@@ -124,7 +124,7 @@ Feature: Outline modeling
|
|
124
124
|
| @outline_tag_1 |
|
125
125
|
| @outline_tag_2 |
|
126
126
|
|
127
|
-
Scenario: Modeling
|
127
|
+
Scenario: Modeling an outline's source line
|
128
128
|
Given the following gherkin:
|
129
129
|
"""
|
130
130
|
Feature:
|
@@ -148,3 +148,28 @@ Feature: Outline modeling
|
|
148
148
|
@model.source_line
|
149
149
|
"""
|
150
150
|
Then the model returns "3"
|
151
|
+
|
152
|
+
Scenario: Modeling an outline's source column
|
153
|
+
Given the following gherkin:
|
154
|
+
"""
|
155
|
+
Feature:
|
156
|
+
|
157
|
+
Scenario Outline:
|
158
|
+
* a step
|
159
|
+
Examples:
|
160
|
+
| param |
|
161
|
+
| value |
|
162
|
+
"""
|
163
|
+
And a feature model based on that gherkin
|
164
|
+
"""
|
165
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
166
|
+
"""
|
167
|
+
And the outline model of that feature model
|
168
|
+
"""
|
169
|
+
@model = @model.outlines.first
|
170
|
+
"""
|
171
|
+
When the outline's source column is requested
|
172
|
+
"""
|
173
|
+
@model.source_column
|
174
|
+
"""
|
175
|
+
Then the model returns "3"
|
@@ -45,3 +45,26 @@ Feature: Row modeling
|
|
45
45
|
@model.source_line
|
46
46
|
"""
|
47
47
|
Then the model returns "5"
|
48
|
+
|
49
|
+
Scenario: Modeling a row's source column
|
50
|
+
Given the following gherkin:
|
51
|
+
"""
|
52
|
+
Feature:
|
53
|
+
|
54
|
+
Scenario:
|
55
|
+
* a step
|
56
|
+
| foo |
|
57
|
+
"""
|
58
|
+
And a feature model based on that gherkin
|
59
|
+
"""
|
60
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
61
|
+
"""
|
62
|
+
And the row model inside of that feature model
|
63
|
+
"""
|
64
|
+
@model = @model.tests.first.steps.first.block.rows.first
|
65
|
+
"""
|
66
|
+
When the rows's source column is requested
|
67
|
+
"""
|
68
|
+
@model.source_column
|
69
|
+
"""
|
70
|
+
Then the model returns "7"
|
@@ -148,3 +148,24 @@ in that rule.
|
|
148
148
|
@model.source_line
|
149
149
|
"""
|
150
150
|
Then the model returns "3"
|
151
|
+
|
152
|
+
Scenario: Modeling a rule's source column
|
153
|
+
Given the following gherkin:
|
154
|
+
"""
|
155
|
+
Feature:
|
156
|
+
|
157
|
+
Rule:
|
158
|
+
"""
|
159
|
+
And a feature model based on that gherkin
|
160
|
+
"""
|
161
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
162
|
+
"""
|
163
|
+
And the rule model of that feature model
|
164
|
+
"""
|
165
|
+
@model = @model.rules.first
|
166
|
+
"""
|
167
|
+
When the rule's source column is requested
|
168
|
+
"""
|
169
|
+
@model.source_column
|
170
|
+
"""
|
171
|
+
Then the model returns "3"
|
@@ -122,3 +122,25 @@ Feature: Scenario modeling
|
|
122
122
|
@model.source_line
|
123
123
|
"""
|
124
124
|
Then the model returns "3"
|
125
|
+
|
126
|
+
Scenario: Modeling a scenario's source column
|
127
|
+
Given the following gherkin:
|
128
|
+
"""
|
129
|
+
Feature:
|
130
|
+
|
131
|
+
Scenario:
|
132
|
+
* a step
|
133
|
+
"""
|
134
|
+
And a feature model based on that gherkin
|
135
|
+
"""
|
136
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
137
|
+
"""
|
138
|
+
And the scenario model of that feature model
|
139
|
+
"""
|
140
|
+
@model = @model.scenarios.first
|
141
|
+
"""
|
142
|
+
When the scenario's source column is requested
|
143
|
+
"""
|
144
|
+
@model.source_column
|
145
|
+
"""
|
146
|
+
Then the model returns "3"
|
@@ -50,6 +50,28 @@ Feature: Step modeling
|
|
50
50
|
"""
|
51
51
|
Then the model returns "4"
|
52
52
|
|
53
|
+
Scenario: Modeling a step's source column
|
54
|
+
Given the following gherkin:
|
55
|
+
"""
|
56
|
+
Feature:
|
57
|
+
|
58
|
+
Scenario:
|
59
|
+
* a step
|
60
|
+
"""
|
61
|
+
And a feature model based on that gherkin
|
62
|
+
"""
|
63
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
64
|
+
"""
|
65
|
+
And the step model inside of that feature model
|
66
|
+
"""
|
67
|
+
@model = @model.tests.first.steps.first
|
68
|
+
"""
|
69
|
+
When the step's source column is requested
|
70
|
+
"""
|
71
|
+
@model.source_column
|
72
|
+
"""
|
73
|
+
Then the model returns "5"
|
74
|
+
|
53
75
|
Scenario: Modeling a step's table
|
54
76
|
Given a step model based on the following gherkin:
|
55
77
|
"""
|
@@ -47,3 +47,27 @@ Feature: Table modeling
|
|
47
47
|
@model.source_line
|
48
48
|
"""
|
49
49
|
Then the model returns "5"
|
50
|
+
|
51
|
+
Scenario: Modeling a table's source column
|
52
|
+
Given the following gherkin:
|
53
|
+
"""
|
54
|
+
Feature:
|
55
|
+
|
56
|
+
Scenario:
|
57
|
+
* a step
|
58
|
+
| value 1 |
|
59
|
+
| value 2 |
|
60
|
+
"""
|
61
|
+
And a feature model based on that gherkin
|
62
|
+
"""
|
63
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
64
|
+
"""
|
65
|
+
And the table model inside of that feature model
|
66
|
+
"""
|
67
|
+
@model = @model.tests.first.steps.first.block
|
68
|
+
"""
|
69
|
+
When the table's source column is requested
|
70
|
+
"""
|
71
|
+
@model.source_column
|
72
|
+
"""
|
73
|
+
Then the model returns "7"
|
@@ -40,3 +40,23 @@ Feature: Tag modeling
|
|
40
40
|
@model.source_line
|
41
41
|
"""
|
42
42
|
Then the model returns "1"
|
43
|
+
|
44
|
+
Scenario: Modeling a tag's source column
|
45
|
+
Given the following gherkin:
|
46
|
+
"""
|
47
|
+
@a_tag
|
48
|
+
Feature:
|
49
|
+
"""
|
50
|
+
And a feature model based on that gherkin
|
51
|
+
"""
|
52
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
53
|
+
"""
|
54
|
+
And the tag model of that feature model
|
55
|
+
"""
|
56
|
+
@model = @model.tags.first
|
57
|
+
"""
|
58
|
+
When the tag's source column is requested
|
59
|
+
"""
|
60
|
+
@model.source_column
|
61
|
+
"""
|
62
|
+
Then the model returns "1"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuke_modeler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kessler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber-gherkin
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "<"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '24.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '24.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -229,6 +229,7 @@ files:
|
|
229
229
|
- lib/cuke_modeler/adapters/gherkin_20_adapter.rb
|
230
230
|
- lib/cuke_modeler/adapters/gherkin_21_adapter.rb
|
231
231
|
- lib/cuke_modeler/adapters/gherkin_22_adapter.rb
|
232
|
+
- lib/cuke_modeler/adapters/gherkin_23_adapter.rb
|
232
233
|
- lib/cuke_modeler/adapters/gherkin_9_adapter.rb
|
233
234
|
- lib/cuke_modeler/adapters/gherkin_base_adapter.rb
|
234
235
|
- lib/cuke_modeler/containing.rb
|