cuke_modeler 3.9.0 → 3.10.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 +13 -1
- data/cuke_modeler.gemspec +1 -1
- data/lib/cuke_modeler/adapters/gherkin_18_adapter.rb +2 -0
- data/lib/cuke_modeler/adapters/gherkin_19_adapter.rb +61 -0
- data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +3 -2
- data/lib/cuke_modeler/parsing.rb +18 -1
- data/lib/cuke_modeler/version.rb +1 -1
- 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: d7821b738cb9b7436e38de701654c9ca04d087ba2e482f01af0600f86383b47d
|
4
|
+
data.tar.gz: 8b71afb721c52cc198243a468807547d45254dab84dd5bafcbec49e9bb4befb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f114b4de2f4f2ef4ffd95078c7b8f72db2318174a75c4d4ed86a900ed21585e91e918afe97770afc1857b3cc80c904e471717f59a90c814bd7664575879e07e8
|
7
|
+
data.tar.gz: e870f0c73a8f296f6c8b108956d787586e9f47b3a2bff78db9a10db58c8df2ffc39fed04a1ace3629911c03f36ac6aee6c3e74475c60c58d7d0416f141d07037
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
9
9
|
Nothing yet...
|
10
10
|
|
11
11
|
|
12
|
+
## [3.10.0] - 2021-05-28
|
13
|
+
|
14
|
+
### Added
|
15
|
+
- Support added for more versions of the `cucumber-gherkin` gem
|
16
|
+
- 19.x
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
- `Rule` models now clear out parsing data for their tags. This data was an unintentional duplication of the
|
20
|
+
parsing data that the `Tag` models already contained.
|
21
|
+
|
22
|
+
|
12
23
|
## [3.9.0] - 2021-04-23
|
13
24
|
|
14
25
|
### Added
|
@@ -376,7 +387,8 @@ Nothing yet...
|
|
376
387
|
- Initial release
|
377
388
|
|
378
389
|
|
379
|
-
[Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.
|
390
|
+
[Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.10.0...HEAD
|
391
|
+
[3.10.0]: https://github.com/enkessler/cuke_modeler/compare/v3.9.0...v3.10.0
|
380
392
|
[3.9.0]: https://github.com/enkessler/cuke_modeler/compare/v3.8.0...v3.9.0
|
381
393
|
[3.8.0]: https://github.com/enkessler/cuke_modeler/compare/v3.7.0...v3.8.0
|
382
394
|
[3.7.0]: https://github.com/enkessler/cuke_modeler/compare/v3.6.0...v3.7.0
|
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', '< 20.0'
|
40
40
|
|
41
41
|
spec.add_development_dependency 'bundler', '< 3.0'
|
42
42
|
spec.add_development_dependency 'childprocess', '< 5.0'
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require_relative 'gherkin_18_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 19.x of the *cucumber-gherkin* gem into input that is consumable
|
8
|
+
# by this gem.
|
9
|
+
class Gherkin19Adapter < Gherkin18Adapter
|
10
|
+
|
11
|
+
# Adapts the AST sub-tree that is rooted at the given step node.
|
12
|
+
def adapt_step(step_ast)
|
13
|
+
adapted_step = super(step_ast)
|
14
|
+
|
15
|
+
clear_child_elements(adapted_step, [[:dataTable],
|
16
|
+
[:docString]])
|
17
|
+
|
18
|
+
if step_ast[:docString]
|
19
|
+
adapted_step['doc_string'] = adapt_doc_string(step_ast[:docString])
|
20
|
+
elsif step_ast[:dataTable]
|
21
|
+
adapted_step['table'] = adapt_step_table(step_ast[:dataTable])
|
22
|
+
end
|
23
|
+
|
24
|
+
adapted_step
|
25
|
+
end
|
26
|
+
|
27
|
+
# Adapts the AST sub-tree that is rooted at the given doc string node.
|
28
|
+
def adapt_doc_string(doc_string_ast)
|
29
|
+
adapted_doc_string = super(doc_string_ast)
|
30
|
+
|
31
|
+
adapted_doc_string['content_type'] = doc_string_ast[:mediaType]
|
32
|
+
|
33
|
+
adapted_doc_string
|
34
|
+
end
|
35
|
+
|
36
|
+
# Adapts the AST sub-tree that is rooted at the given example node.
|
37
|
+
def adapt_example(example_ast)
|
38
|
+
adapted_example = super(example_ast)
|
39
|
+
|
40
|
+
clear_child_elements(adapted_example, [[:tableHeader],
|
41
|
+
[:tableBody]])
|
42
|
+
|
43
|
+
adapted_example['rows'] << adapt_table_row(example_ast[:tableHeader]) if example_ast[:tableHeader]
|
44
|
+
|
45
|
+
example_ast[:tableBody].each do |row|
|
46
|
+
adapted_example['rows'] << adapt_table_row(row)
|
47
|
+
end
|
48
|
+
|
49
|
+
adapted_example
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
|
56
|
+
def test_has_examples?(ast_node)
|
57
|
+
ast_node[:scenario][:examples].any?
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
@@ -328,6 +328,7 @@ module CukeModeler
|
|
328
328
|
|
329
329
|
def clear_child_elements(ast, child_paths)
|
330
330
|
child_paths.each do |traversal_path|
|
331
|
+
# Wipe the value if it's there but don't add any keys to the hash if it didn't already have them
|
331
332
|
if ast['cuke_modeler_parsing_data'].dig(*traversal_path)
|
332
333
|
bury(ast['cuke_modeler_parsing_data'], traversal_path, nil)
|
333
334
|
end
|
@@ -346,11 +347,11 @@ module CukeModeler
|
|
346
347
|
end
|
347
348
|
|
348
349
|
def test_node?(ast_node)
|
349
|
-
ast_node[:scenario]
|
350
|
+
!ast_node[:scenario].nil?
|
350
351
|
end
|
351
352
|
|
352
353
|
def test_has_examples?(ast_node)
|
353
|
-
ast_node[:scenario][:examples]
|
354
|
+
!ast_node[:scenario][:examples].nil?
|
354
355
|
end
|
355
356
|
|
356
357
|
def test_uses_outline_keyword?(test_ast)
|
data/lib/cuke_modeler/parsing.rb
CHANGED
@@ -7,7 +7,7 @@ require 'gherkin'
|
|
7
7
|
# an 'adapter' appropriate to the version of the *cucumber-gherkin* gem that has been activated.
|
8
8
|
gherkin_version = Gem.loaded_specs['cucumber-gherkin'].version.version
|
9
9
|
gherkin_major_version = gherkin_version.match(/^(\d+)\./)[1].to_i
|
10
|
-
supported_gherkin_versions =
|
10
|
+
supported_gherkin_versions = (9..19)
|
11
11
|
|
12
12
|
raise("Unknown Gherkin version: '#{gherkin_version}'") unless supported_gherkin_versions.include?(gherkin_major_version)
|
13
13
|
|
@@ -61,6 +61,23 @@ module CukeModeler
|
|
61
61
|
# inside of it, so I'm leaving this here in case it changes again
|
62
62
|
# rubocop:disable Lint/DuplicateMethods
|
63
63
|
case gherkin_major_version
|
64
|
+
when 19
|
65
|
+
# TODO: make these methods private?
|
66
|
+
# NOT A PART OF THE PUBLIC API
|
67
|
+
# The method to use for parsing Gherkin text
|
68
|
+
def parsing_method(source_text, filename)
|
69
|
+
messages = Gherkin.from_source(filename,
|
70
|
+
source_text,
|
71
|
+
{ include_gherkin_document: true })
|
72
|
+
.to_a.map(&:to_hash)
|
73
|
+
|
74
|
+
error_message = messages.find { |message| message[:parseError] }
|
75
|
+
gherkin_ast_message = messages.find { |message| message[:gherkinDocument] }
|
76
|
+
|
77
|
+
raise error_message[:parseError][:message] if error_message
|
78
|
+
|
79
|
+
gherkin_ast_message[:gherkinDocument]
|
80
|
+
end
|
64
81
|
when 13, 14, 15, 16, 17, 18
|
65
82
|
# TODO: make these methods private?
|
66
83
|
# NOT A PART OF THE PUBLIC API
|
data/lib/cuke_modeler/version.rb
CHANGED
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.10.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: 2021-
|
11
|
+
date: 2021-05-29 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: '20.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: '20.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -225,6 +225,7 @@ files:
|
|
225
225
|
- lib/cuke_modeler/adapters/gherkin_16_adapter.rb
|
226
226
|
- lib/cuke_modeler/adapters/gherkin_17_adapter.rb
|
227
227
|
- lib/cuke_modeler/adapters/gherkin_18_adapter.rb
|
228
|
+
- lib/cuke_modeler/adapters/gherkin_19_adapter.rb
|
228
229
|
- lib/cuke_modeler/adapters/gherkin_9_adapter.rb
|
229
230
|
- lib/cuke_modeler/containing.rb
|
230
231
|
- lib/cuke_modeler/described.rb
|