cuke_modeler 3.20.1 → 3.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cfecfdb9d15e82e2c516e0fdd8787391258b0b7b17278fb06832a3caaf1ade2
4
- data.tar.gz: 055c7e2c74c325fedc1b4b5a89594733276b44b1585ff1bf98eec0da5715b48d
3
+ metadata.gz: bf4f1d5138416caa14ba5bf9f9e646c9fad013008ea24796dc08fc40aacac026
4
+ data.tar.gz: 4db652f4b23cd03e227fe5f97149075d9ac609bed930e512b0a6f13b04cabb5f
5
5
  SHA512:
6
- metadata.gz: a21c007aeff0f702eaed164c2e9d27beed205532c2a0855aef90816ad61da1bc6658ee42df01319bea8d058ff49dab8872f74a6e35849601f2f68b1d2d40a67d
7
- data.tar.gz: 36b498a0d7e1bb9bbf004a0b906ba4adc23f7cc1b895c7ecaba1dd76c5f575d351042c307d8f1807454faf0747495c32b3fea4d20633e74eb75f497702ec0e13
6
+ metadata.gz: daba53277c9bd55e344d4c11ef75af4543399040559042fd7ce5c0af25743e8cc56b0796239886425d3be7a61d2b3d2d99b86ad59c00fc39b10ef2a33383829c
7
+ data.tar.gz: 9b28d7021eb73a6b3a788cfa456e42d2a75b9c0bf84f3083fe84de2ef64cf784eb6de55b0c90d481a634edfd0a1b58690f2ce9835dfbc551084e88d4845abcca
data/CHANGELOG.md CHANGED
@@ -9,6 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
  Nothing yet...
10
10
 
11
11
 
12
+ ## [3.22.0] - 2024-10-01
13
+
14
+ ### Added
15
+ - Support added for more versions of the `cucumber-gherkin` gem
16
+ - 29.x
17
+
18
+
19
+ ## [3.21.0] - 2024-03-11
20
+
21
+ ### Added
22
+ - Support added for more versions of the `cucumber-gherkin` gem
23
+ - 28.x
24
+
25
+
12
26
  ## [3.20.1] - 2023-10-16
13
27
 
14
28
  ### Changed
@@ -465,7 +479,9 @@ Nothing yet...
465
479
  - Initial release
466
480
 
467
481
 
468
- [Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.20.1...HEAD
482
+ [Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.22.0...HEAD
483
+ [3.22.0]: https://github.com/enkessler/cuke_modeler/compare/v3.21.1...v3.22.0
484
+ [3.21.0]: https://github.com/enkessler/cuke_modeler/compare/v3.20.1...v3.21.0
469
485
  [3.20.1]: https://github.com/enkessler/cuke_modeler/compare/v3.20.0...v3.20.1
470
486
  [3.20.0]: https://github.com/enkessler/cuke_modeler/compare/v3.19.0...v3.20.0
471
487
  [3.19.0]: https://github.com/enkessler/cuke_modeler/compare/v3.18.0...v3.19.0
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2023 Eric Kessler, et al
1
+ Copyright (c) 2014-2024 Eric Kessler, et al
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -19,7 +19,7 @@ Developer stuff:
19
19
  There comes a time in every programmer's adventures with Cucumber when they
20
20
  want to do Really Cool Stuff with their tests. This usually necessitates
21
21
  scanning all of their feature files and playing with the output. While the
22
- **[cucumber-gherkin](https://github.com/cucumber/cucumber/tree/master/gherkin)** gem ([previously](https://github.com/enkessler/cuke_modeler/blob/master/CHANGELOG.md#300---2020-06-08) just the `gherkin` gem) does a fine job of parsing feature files, reading or even manipulating
22
+ **[cucumber-gherkin](https://github.com/cucumber/gherkin)** gem ([previously](https://github.com/enkessler/cuke_modeler/blob/master/CHANGELOG.md#300---2020-06-08) just the `gherkin` gem) does a fine job of parsing feature files, reading or even manipulating
23
23
  the resulting Abstract Syntax Tree is not always fun. **cuke_modeler** comes to
24
24
  the rescue by providing a modeling layer that is easier to work with.
25
25
 
data/cuke_modeler.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.required_ruby_version = '>= 2.3', '< 4.0'
39
39
 
40
- spec.add_runtime_dependency 'cucumber-gherkin', '< 28.0'
40
+ spec.add_runtime_dependency 'cucumber-gherkin', '< 30.0'
41
41
 
42
42
  spec.add_development_dependency 'bundler', '< 3.0'
43
43
  spec.add_development_dependency 'childprocess', '< 5.0'
@@ -11,7 +11,7 @@ module CukeModeler
11
11
 
12
12
  # Adapts the AST sub-tree that is rooted at the given rule node.
13
13
  def adapt_rule(rule_ast)
14
- adapted_rule = super(rule_ast)
14
+ adapted_rule = super
15
15
 
16
16
  clear_child_elements(adapted_rule, [[:rule, :tags]])
17
17
 
@@ -11,7 +11,7 @@ module CukeModeler
11
11
 
12
12
  # Adapts the AST sub-tree that is rooted at the given step node.
13
13
  def adapt_step(step_ast)
14
- adapted_step = super(step_ast)
14
+ adapted_step = super
15
15
 
16
16
  clear_child_elements(adapted_step, [[:dataTable],
17
17
  [:docString]])
@@ -27,7 +27,7 @@ module CukeModeler
27
27
 
28
28
  # Adapts the AST sub-tree that is rooted at the given doc string node.
29
29
  def adapt_doc_string(doc_string_ast)
30
- adapted_doc_string = super(doc_string_ast)
30
+ adapted_doc_string = super
31
31
 
32
32
  adapted_doc_string['content_type'] = doc_string_ast[:mediaType]
33
33
 
@@ -36,7 +36,7 @@ module CukeModeler
36
36
 
37
37
  # Adapts the AST sub-tree that is rooted at the given example node.
38
38
  def adapt_example(example_ast)
39
- adapted_example = super(example_ast)
39
+ adapted_example = super
40
40
 
41
41
  clear_child_elements(adapted_example, [[:tableHeader],
42
42
  [:tableBody]])
@@ -303,19 +303,15 @@ module CukeModeler
303
303
  end
304
304
 
305
305
  def adapt_child_elements(element_ast)
306
- adapted_children = []
307
-
308
- element_ast.children.each do |child_element|
309
- adapted_children << if child_element.background
310
- adapt_background(child_element)
311
- elsif child_element.respond_to?(:rule) && child_element.rule
312
- adapt_rule(child_element)
313
- else
314
- adapt_test(child_element)
315
- end
306
+ element_ast.children.map do |child_element|
307
+ if child_element.background
308
+ adapt_background(child_element)
309
+ elsif child_element.respond_to?(:rule) && child_element.rule
310
+ adapt_rule(child_element)
311
+ else
312
+ adapt_test(child_element)
313
+ end
316
314
  end
317
-
318
- adapted_children
319
315
  end
320
316
 
321
317
  def adapt_test(test_ast)
@@ -0,0 +1,13 @@
1
+ require_relative 'gherkin_20_adapter'
2
+
3
+
4
+ module CukeModeler
5
+
6
+ # @api private
7
+ #
8
+ # An adapter that can convert the output of version 28.x of the *cucumber-gherkin* gem into input that is consumable
9
+ # by this gem. Internal helper class.
10
+ class Gherkin28Adapter < Gherkin20Adapter; end
11
+
12
+ private_constant :Gherkin28Adapter
13
+ end
@@ -0,0 +1,13 @@
1
+ require_relative 'gherkin_20_adapter'
2
+
3
+
4
+ module CukeModeler
5
+
6
+ # @api private
7
+ #
8
+ # An adapter that can convert the output of version 29.x of the *cucumber-gherkin* gem into input that is consumable
9
+ # by this gem. Internal helper class.
10
+ class Gherkin29Adapter < Gherkin20Adapter; end
11
+
12
+ private_constant :Gherkin29Adapter
13
+ end
@@ -312,19 +312,15 @@ module CukeModeler
312
312
  def adapt_child_elements(element_ast)
313
313
  return [] unless element_ast[:children]
314
314
 
315
- adapted_children = []
316
-
317
- element_ast[:children].each do |child_element|
318
- adapted_children << if child_element[:background]
319
- adapt_background(child_element)
320
- elsif child_element[:rule]
321
- adapt_rule(child_element)
322
- else
323
- adapt_test(child_element)
324
- end
315
+ element_ast[:children].map do |child_element|
316
+ if child_element[:background]
317
+ adapt_background(child_element)
318
+ elsif child_element[:rule]
319
+ adapt_rule(child_element)
320
+ else
321
+ adapt_test(child_element)
322
+ end
325
323
  end
326
-
327
- adapted_children
328
324
  end
329
325
 
330
326
  def adapt_test(test_ast)
@@ -28,7 +28,7 @@ module CukeModeler
28
28
  def initialize(source_text = nil)
29
29
  @steps = []
30
30
 
31
- super(source_text)
31
+ super
32
32
  end
33
33
 
34
34
  # TODO: Have (all) models be equivalent if they have the same #to_s output. Would
@@ -91,7 +91,7 @@ module CukeModeler
91
91
  # the object. Defaults to false.
92
92
  # @return [String] A string representation of this model
93
93
  def inspect(verbose: false)
94
- return super(verbose: verbose) if verbose
94
+ return super if verbose
95
95
 
96
96
  "#{super.chop} @name: #{name.inspect}>"
97
97
  end
@@ -23,7 +23,7 @@ module CukeModeler
23
23
  # @raise [ArgumentError] If *source_text* is not a String
24
24
  # @return [Cell] A new Cell instance
25
25
  def initialize(source_text = nil)
26
- super(source_text)
26
+ super
27
27
  end
28
28
 
29
29
  # Returns a string representation of this model. For a Cell model,
@@ -52,7 +52,7 @@ module CukeModeler
52
52
  # the object. Defaults to false.
53
53
  # @return [String] A string representation of this model
54
54
  def inspect(verbose: false)
55
- return super(verbose: verbose) if verbose
55
+ return super if verbose
56
56
 
57
57
  "#{super.chop} @value: #{value.inspect}>"
58
58
  end
@@ -23,7 +23,7 @@ module CukeModeler
23
23
  # @raise [ArgumentError] If *source_text* is not a String
24
24
  # @return [Comment] A new Comment instance
25
25
  def initialize(source_text = nil)
26
- super(source_text)
26
+ super
27
27
  end
28
28
 
29
29
  # Returns a string representation of this model. For a Comment model,
@@ -50,7 +50,7 @@ module CukeModeler
50
50
  # the object. Defaults to false.
51
51
  # @return [String] A string representation of this model
52
52
  def inspect(verbose: false)
53
- return super(verbose: verbose) if verbose
53
+ return super if verbose
54
54
 
55
55
  "#{super.chop} @text: #{text.inspect}>"
56
56
  end
@@ -30,7 +30,7 @@ module CukeModeler
30
30
  @feature_files = []
31
31
  @directories = []
32
32
 
33
- super(directory_path)
33
+ super
34
34
  end
35
35
 
36
36
  # Returns the name of the modeled directory.
@@ -81,7 +81,7 @@ module CukeModeler
81
81
  # the object. Defaults to false.
82
82
  # @return [String] A string representation of this model
83
83
  def inspect(verbose: false)
84
- return super(verbose: verbose) if verbose
84
+ return super if verbose
85
85
 
86
86
  "#{super.chop} @path: #{@path.inspect}>"
87
87
  end
@@ -26,7 +26,7 @@ module CukeModeler
26
26
  # @raise [ArgumentError] If *source_text* is not a String
27
27
  # @return [DocString] A new DocString instance
28
28
  def initialize(source_text = nil)
29
- super(source_text)
29
+ super
30
30
  end
31
31
 
32
32
  # Returns a string representation of this model. For a DocString model,
@@ -56,7 +56,7 @@ module CukeModeler
56
56
  # the object. Defaults to false.
57
57
  # @return [String] A string representation of this model
58
58
  def inspect(verbose: false)
59
- return super(verbose: verbose) if verbose
59
+ return super if verbose
60
60
 
61
61
  "#{super.chop} @content: #{content.inspect}>"
62
62
  end
@@ -35,7 +35,7 @@ module CukeModeler
35
35
  @tags = []
36
36
  @rows = []
37
37
 
38
- super(source_text)
38
+ super
39
39
  end
40
40
 
41
41
  # TODO: Deprecate using symbol keys in a Hash
@@ -183,7 +183,7 @@ module CukeModeler
183
183
  # the object. Defaults to false.
184
184
  # @return [String] A string representation of this model
185
185
  def inspect(verbose: false)
186
- return super(verbose: verbose) if verbose
186
+ return super if verbose
187
187
 
188
188
  "#{super.chop} @name: #{name.inspect}>"
189
189
  end
@@ -41,7 +41,7 @@ module CukeModeler
41
41
  @rules = []
42
42
  @tests = []
43
43
 
44
- super(source_text)
44
+ super
45
45
  end
46
46
 
47
47
  # Returns *true* if the feature contains a background, *false* otherwise.
@@ -150,7 +150,7 @@ module CukeModeler
150
150
  # the object. Defaults to false.
151
151
  # @return [String] A string representation of this model
152
152
  def inspect(verbose: false)
153
- return super(verbose: verbose) if verbose
153
+ return super if verbose
154
154
 
155
155
  "#{super.chop} @name: #{name.inspect}>"
156
156
  end
@@ -31,7 +31,7 @@ module CukeModeler
31
31
  @path = file_path
32
32
  @comments = []
33
33
 
34
- super(file_path)
34
+ super
35
35
  end
36
36
 
37
37
  # Returns the name of the modeled feature file.
@@ -81,7 +81,7 @@ module CukeModeler
81
81
  # the object. Defaults to false.
82
82
  # @return [String] A string representation of this model
83
83
  def inspect(verbose: false)
84
- return super(verbose: verbose) if verbose
84
+ return super if verbose
85
85
 
86
86
  "#{super.chop} @path: #{@path.inspect}>"
87
87
  end
@@ -34,7 +34,7 @@ module CukeModeler
34
34
  @tags = []
35
35
  @examples = []
36
36
 
37
- super(source_text)
37
+ super
38
38
  end
39
39
 
40
40
  # Compares this model with another object. Returns *true* if the two objects
@@ -102,7 +102,7 @@ module CukeModeler
102
102
  # the object. Defaults to false.
103
103
  # @return [String] A string representation of this model
104
104
  def inspect(verbose: false)
105
- return super(verbose: verbose) if verbose
105
+ return super if verbose
106
106
 
107
107
  "#{super.chop} @name: #{name.inspect}>"
108
108
  end
@@ -24,7 +24,7 @@ module CukeModeler
24
24
  def initialize(source_text = nil)
25
25
  @cells = []
26
26
 
27
- super(source_text)
27
+ super
28
28
  end
29
29
 
30
30
  # Returns the model objects that are children of this model. For a
@@ -65,7 +65,7 @@ module CukeModeler
65
65
  # the object. Defaults to false.
66
66
  # @return [String] A string representation of this model
67
67
  def inspect(verbose: false)
68
- return super(verbose: verbose) if verbose
68
+ return super if verbose
69
69
 
70
70
  cell_output = @cells&.collect(&:value)
71
71
 
@@ -35,7 +35,7 @@ module CukeModeler
35
35
  @tags = []
36
36
  @tests = []
37
37
 
38
- super(source_text)
38
+ super
39
39
  end
40
40
 
41
41
  # Returns *true* if the rule contains a background, *false* otherwise.
@@ -118,7 +118,7 @@ module CukeModeler
118
118
  # the object. Defaults to false.
119
119
  # @return [String] A string representation of this model
120
120
  def inspect(verbose: false)
121
- return super(verbose: verbose) if verbose
121
+ return super if verbose
122
122
 
123
123
  "#{super.chop} @name: #{@name.inspect}>"
124
124
  end
@@ -30,7 +30,7 @@ module CukeModeler
30
30
  @steps = []
31
31
  @tags = []
32
32
 
33
- super(source_text)
33
+ super
34
34
  end
35
35
 
36
36
  # Compares this model with another object. Returns *true* if the two objects
@@ -96,7 +96,7 @@ module CukeModeler
96
96
  # the object. Defaults to false.
97
97
  # @return [String] A string representation of this model
98
98
  def inspect(verbose: false)
99
- return super(verbose: verbose) if verbose
99
+ return super if verbose
100
100
 
101
101
  "#{super.chop} @name: #{name.inspect}>"
102
102
  end
@@ -29,7 +29,7 @@ module CukeModeler
29
29
  # @raise [ArgumentError] If *source_text* is not a String
30
30
  # @return [Step] A new Step instance
31
31
  def initialize(source_text = nil)
32
- super(source_text)
32
+ super
33
33
  end
34
34
 
35
35
  # Compares this model with another object. Returns *true* if the two objects
@@ -87,7 +87,7 @@ module CukeModeler
87
87
  # the object. Defaults to false.
88
88
  # @return [String] A string representation of this model
89
89
  def inspect(verbose: false)
90
- return super(verbose: verbose) if verbose
90
+ return super if verbose
91
91
 
92
92
  "#{super.chop} @text: #{@text.inspect}>"
93
93
  end
@@ -25,7 +25,7 @@ module CukeModeler
25
25
  def initialize(source_text = nil)
26
26
  @rows = []
27
27
 
28
- super(source_text)
28
+ super
29
29
  end
30
30
 
31
31
  # Returns the model objects that are children of this model. For a
@@ -64,7 +64,7 @@ module CukeModeler
64
64
  # the object. Defaults to false.
65
65
  # @return [String] A string representation of this model
66
66
  def inspect(verbose: false)
67
- return super(verbose: verbose) if verbose
67
+ return super if verbose
68
68
 
69
69
  row_output = @rows&.collect { |row| row.cells.collect(&:value) }
70
70
 
@@ -20,7 +20,7 @@ module CukeModeler
20
20
  # @raise [ArgumentError] If *source_text* is not a String
21
21
  # @return [Tag] A new Tag instance
22
22
  def initialize(source_text = nil)
23
- super(source_text)
23
+ super
24
24
  end
25
25
 
26
26
  # Returns a string representation of this model. For a Tag model,
@@ -47,7 +47,7 @@ module CukeModeler
47
47
  # the object. Defaults to false.
48
48
  # @return [String] A string representation of this model
49
49
  def inspect(verbose: false)
50
- return super(verbose: verbose) if verbose
50
+ return super if verbose
51
51
 
52
52
  "#{super.chop} @name: #{@name.inspect}>"
53
53
  end
@@ -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..27)
12
+ supported_gherkin_versions = (9..29)
13
13
 
14
14
  raise("Unknown Gherkin version: '#{gherkin_version}'") unless supported_gherkin_versions.include?(gherkin_major_version)
15
15
 
@@ -86,7 +86,7 @@ module CukeModeler
86
86
  # inside of it, so I'm leaving this here in case it changes again
87
87
  # rubocop:disable Lint/DuplicateMethods
88
88
  case gherkin_major_version
89
- when 20, 21, 22, 23, 24, 25, 26, 27
89
+ when 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
90
90
  # The method to use for parsing Gherkin text
91
91
  def parsing_method(source_text, filename)
92
92
  messages = Gherkin.from_source(filename,
@@ -1,4 +1,4 @@
1
1
  module CukeModeler
2
2
  # The gem version
3
- VERSION = '3.20.1'.freeze
3
+ VERSION = '3.22.0'.freeze
4
4
  end
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.20.1
4
+ version: 3.22.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: 2023-10-16 00:00:00.000000000 Z
11
+ date: 2024-10-01 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: '28.0'
19
+ version: '30.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: '28.0'
26
+ version: '30.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -234,6 +234,8 @@ files:
234
234
  - lib/cuke_modeler/adapters/gherkin_25_adapter.rb
235
235
  - lib/cuke_modeler/adapters/gherkin_26_adapter.rb
236
236
  - lib/cuke_modeler/adapters/gherkin_27_adapter.rb
237
+ - lib/cuke_modeler/adapters/gherkin_28_adapter.rb
238
+ - lib/cuke_modeler/adapters/gherkin_29_adapter.rb
237
239
  - lib/cuke_modeler/adapters/gherkin_9_adapter.rb
238
240
  - lib/cuke_modeler/adapters/gherkin_base_adapter.rb
239
241
  - lib/cuke_modeler/containing.rb
@@ -266,7 +268,6 @@ files:
266
268
  - testing/cucumber/features/analysis/test_comparison.feature
267
269
  - testing/cucumber/features/modeling/background_modeling.feature
268
270
  - testing/cucumber/features/modeling/background_output.feature
269
- - testing/cucumber/features/modeling/base_model.feature
270
271
  - testing/cucumber/features/modeling/cell_modeling.feature
271
272
  - testing/cucumber/features/modeling/cell_output.feature
272
273
  - testing/cucumber/features/modeling/comment_modeling.feature
@@ -325,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
326
  - !ruby/object:Gem::Version
326
327
  version: '0'
327
328
  requirements: []
328
- rubygems_version: 3.3.7
329
+ rubygems_version: 3.2.32
329
330
  signing_key:
330
331
  specification_version: 4
331
332
  summary: A gem providing functionality to model Gherkin based test suites.
@@ -1,3 +0,0 @@
1
- # TODO: demo the base model class and generic model usage (it's not abstract, just situationally useful)
2
- @wip
3
- Feature: