cuke_modeler 3.8.0 → 3.9.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/CHANGELOG.md +10 -2
- data/lib/cuke_modeler/adapters/gherkin_18_adapter.rb +10 -1
- data/lib/cuke_modeler/containing.rb +1 -0
- data/lib/cuke_modeler/models/rule.rb +8 -1
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/features/modeling/rule_modeling.feature +44 -2
- data/testing/cucumber/features/modeling/rule_output.feature +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac7201e203c0357c8137182d821bd7537968c2db97572dcc27e118ec3ccf489
|
4
|
+
data.tar.gz: c08252bb8906a1648bb3f846bd1a17481316003bacc0526cbcfb2b321c9675c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12647de1b642dbffff2c4a4567977c603dbbd138ce0ba465f0003ccf7455860e4fbf7abe82988da5878db2de6fbb8e4ac69541bca98005ecb9381fd40cc2d80e
|
7
|
+
data.tar.gz: 6362c9a41314a6b66ac73ab8d11111e08947e0e3d6e4d7d4f43a593270947400242aa29ec82bf514ea93b4f4497f769bbb856117e8e74c1a9271eeb90837639b
|
data/CHANGELOG.md
CHANGED
@@ -6,7 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
-
|
9
|
+
Nothing yet...
|
10
|
+
|
11
|
+
|
12
|
+
## [3.9.0] - 2021-04-23
|
13
|
+
|
14
|
+
### Added
|
15
|
+
- `Rule` models are now taggable elements
|
16
|
+
|
10
17
|
|
11
18
|
## [3.8.0] - 2021-04-18
|
12
19
|
|
@@ -369,7 +376,8 @@ Noting yet...
|
|
369
376
|
- Initial release
|
370
377
|
|
371
378
|
|
372
|
-
[Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.
|
379
|
+
[Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.9.0...HEAD
|
380
|
+
[3.9.0]: https://github.com/enkessler/cuke_modeler/compare/v3.8.0...v3.9.0
|
373
381
|
[3.8.0]: https://github.com/enkessler/cuke_modeler/compare/v3.7.0...v3.8.0
|
374
382
|
[3.7.0]: https://github.com/enkessler/cuke_modeler/compare/v3.6.0...v3.7.0
|
375
383
|
[3.6.0]: https://github.com/enkessler/cuke_modeler/compare/v3.5.0...v3.6.0
|
@@ -6,8 +6,17 @@ module CukeModeler
|
|
6
6
|
# NOT A PART OF THE PUBLIC API
|
7
7
|
# An adapter that can convert the output of version 18.x of the *cucumber-gherkin* gem into input that is consumable
|
8
8
|
# by this gem.
|
9
|
-
|
10
9
|
class Gherkin18Adapter < Gherkin9Adapter
|
11
10
|
|
11
|
+
# Adapts the AST sub-tree that is rooted at the given rule node.
|
12
|
+
def adapt_rule(rule_ast)
|
13
|
+
adapted_rule = super(rule_ast)
|
14
|
+
|
15
|
+
# Tagging of Rules was added in Gherkin 18
|
16
|
+
adapted_rule['tags'] = adapt_tags(rule_ast[:rule])
|
17
|
+
|
18
|
+
adapted_rule
|
19
|
+
end
|
20
|
+
|
12
21
|
end
|
13
22
|
end
|
@@ -150,6 +150,7 @@ module CukeModeler
|
|
150
150
|
populate_keyword(rule_object, parsed_rule_data)
|
151
151
|
populate_name(rule_object, parsed_rule_data)
|
152
152
|
populate_description(rule_object, parsed_rule_data)
|
153
|
+
populate_tags(rule_object, parsed_rule_data)
|
153
154
|
populate_children(rule_object, parsed_rule_data)
|
154
155
|
end
|
155
156
|
|
@@ -7,6 +7,7 @@ module CukeModeler
|
|
7
7
|
include Parsed
|
8
8
|
include Named
|
9
9
|
include Described
|
10
|
+
include Taggable
|
10
11
|
include Sourceable
|
11
12
|
|
12
13
|
|
@@ -23,6 +24,7 @@ module CukeModeler
|
|
23
24
|
# Creates a new Rule object and, if *source_text* is provided, populates the
|
24
25
|
# object.
|
25
26
|
def initialize(source_text = nil)
|
27
|
+
@tags = []
|
26
28
|
@tests = []
|
27
29
|
|
28
30
|
super(source_text)
|
@@ -52,17 +54,21 @@ module CukeModeler
|
|
52
54
|
|
53
55
|
# Returns the model objects that belong to this model.
|
54
56
|
def children
|
55
|
-
models = tests
|
57
|
+
models = tests + tags
|
56
58
|
models << background if background
|
57
59
|
|
58
60
|
models
|
59
61
|
end
|
60
62
|
|
63
|
+
# Building strings just isn't pretty
|
64
|
+
# rubocop:disable Metrics/AbcSize
|
65
|
+
|
61
66
|
# Returns a string representation of this model. For a rule model,
|
62
67
|
# this will be Gherkin text that is equivalent to the rule being modeled.
|
63
68
|
def to_s
|
64
69
|
text = ''
|
65
70
|
|
71
|
+
text << "#{tag_output_string}\n" unless tags.empty?
|
66
72
|
text << "#{@keyword}:#{name_output_string}"
|
67
73
|
text << "\n#{description_output_string}" unless no_description_to_output?
|
68
74
|
text << "\n\n#{background_output_string}" if background
|
@@ -70,6 +76,7 @@ module CukeModeler
|
|
70
76
|
|
71
77
|
text
|
72
78
|
end
|
79
|
+
# rubocop:enable Metrics/AbcSize
|
73
80
|
|
74
81
|
|
75
82
|
private
|
data/lib/cuke_modeler/version.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
Feature: Rule modeling
|
2
2
|
|
3
|
-
Rule models
|
4
|
-
containing models for any background, scenarios,
|
3
|
+
Rule models represent a Rule portion of a feature. They expose several attributes of the rule that they
|
4
|
+
represent, as well as containing models for any background, scenarios, outlines, and tags that are present
|
5
|
+
in that rule.
|
5
6
|
|
6
7
|
|
7
8
|
Background:
|
@@ -86,6 +87,47 @@ containing models for any background, scenarios, or outlines that are present in
|
|
86
87
|
Then the model returns models for the following outlines:
|
87
88
|
| Outline 1 |
|
88
89
|
|
90
|
+
@gherkin_min_version_18
|
91
|
+
Scenario: Modeling a rules's tags
|
92
|
+
Given the following gherkin:
|
93
|
+
"""
|
94
|
+
@feature_tag
|
95
|
+
Feature:
|
96
|
+
|
97
|
+
@rule_tag_1
|
98
|
+
@rule_tag_2
|
99
|
+
Rule:
|
100
|
+
"""
|
101
|
+
And a feature model based on that gherkin
|
102
|
+
"""
|
103
|
+
@model = CukeModeler::Feature.new(<source_text>)
|
104
|
+
"""
|
105
|
+
And the rule model of that feature model
|
106
|
+
"""
|
107
|
+
@model = @model.rules.first
|
108
|
+
"""
|
109
|
+
When the rules's tags are requested
|
110
|
+
"""
|
111
|
+
@model.tags
|
112
|
+
"""
|
113
|
+
Then the model returns models for the following tags:
|
114
|
+
| @rule_tag_1 |
|
115
|
+
| @rule_tag_2 |
|
116
|
+
When the rule's inherited tags are requested
|
117
|
+
"""
|
118
|
+
@model.applied_tags
|
119
|
+
"""
|
120
|
+
Then the model returns models for the following tags:
|
121
|
+
| @feature_tag |
|
122
|
+
When all of the rule's tags are requested
|
123
|
+
"""
|
124
|
+
@model.all_tags
|
125
|
+
"""
|
126
|
+
Then the model returns models for the following tags:
|
127
|
+
| @feature_tag |
|
128
|
+
| @rule_tag_1 |
|
129
|
+
| @rule_tag_2 |
|
130
|
+
|
89
131
|
Scenario: Modeling a rule's source line
|
90
132
|
Given the following gherkin:
|
91
133
|
"""
|
@@ -4,9 +4,12 @@ Feature: Rule output
|
|
4
4
|
input for the same kind of model.
|
5
5
|
|
6
6
|
|
7
|
+
@gherkin_min_version_18
|
7
8
|
Scenario: Outputting a rule model
|
8
9
|
Given the following gherkin:
|
9
10
|
"""
|
11
|
+
@tag1@tag2
|
12
|
+
@tag3
|
10
13
|
Rule: A rule with everything it could have
|
11
14
|
Including a description
|
12
15
|
and then some.
|
@@ -54,6 +57,7 @@ Feature: Rule output
|
|
54
57
|
"""
|
55
58
|
Then the following text is provided:
|
56
59
|
"""
|
60
|
+
@tag1 @tag2 @tag3
|
57
61
|
Rule: A rule with everything it could have
|
58
62
|
|
59
63
|
Including a description
|
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.9.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-04-
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber-gherkin
|