cuke_modeler 3.19.0 → 3.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -1
  3. data/cuke_modeler.gemspec +5 -3
  4. data/lib/cuke_modeler/adapters/gherkin_27_adapter.rb +13 -0
  5. data/lib/cuke_modeler/models/background.rb +10 -0
  6. data/lib/cuke_modeler/models/cell.rb +9 -0
  7. data/lib/cuke_modeler/models/comment.rb +9 -0
  8. data/lib/cuke_modeler/models/directory.rb +10 -0
  9. data/lib/cuke_modeler/models/doc_string.rb +10 -0
  10. data/lib/cuke_modeler/models/example.rb +11 -2
  11. data/lib/cuke_modeler/models/feature.rb +9 -0
  12. data/lib/cuke_modeler/models/feature_file.rb +10 -0
  13. data/lib/cuke_modeler/models/model.rb +8 -0
  14. data/lib/cuke_modeler/models/outline.rb +9 -0
  15. data/lib/cuke_modeler/models/row.rb +11 -0
  16. data/lib/cuke_modeler/models/rule.rb +9 -0
  17. data/lib/cuke_modeler/models/scenario.rb +9 -0
  18. data/lib/cuke_modeler/models/step.rb +9 -0
  19. data/lib/cuke_modeler/models/table.rb +11 -0
  20. data/lib/cuke_modeler/models/tag.rb +9 -0
  21. data/lib/cuke_modeler/parsing.rb +3 -3
  22. data/lib/cuke_modeler/version.rb +1 -1
  23. data/testing/cucumber/features/modeling/background_output.feature +19 -5
  24. data/testing/cucumber/features/modeling/cell_output.feature +18 -4
  25. data/testing/cucumber/features/modeling/comment_output.feature +19 -5
  26. data/testing/cucumber/features/modeling/directory_output.feature +21 -4
  27. data/testing/cucumber/features/modeling/doc_string_output.feature +19 -5
  28. data/testing/cucumber/features/modeling/example_output.feature +21 -7
  29. data/testing/cucumber/features/modeling/feature_file_output.feature +21 -4
  30. data/testing/cucumber/features/modeling/feature_output.feature +20 -6
  31. data/testing/cucumber/features/modeling/model_output.feature +53 -5
  32. data/testing/cucumber/features/modeling/outline_output.feature +19 -5
  33. data/testing/cucumber/features/modeling/row_output.feature +19 -5
  34. data/testing/cucumber/features/modeling/rule_output.feature +27 -6
  35. data/testing/cucumber/features/modeling/scenario_output.feature +19 -5
  36. data/testing/cucumber/features/modeling/step_output.feature +19 -5
  37. data/testing/cucumber/features/modeling/table_output.feature +18 -4
  38. data/testing/cucumber/features/modeling/tag_output.feature +19 -5
  39. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 215d7b396a27b9dec6e5ce4bad0692446e754fd88021f85b570605f33854a324
4
- data.tar.gz: 748e499b4bfe721cc8953d5e733652222b7fb019fd0ac232fb85621eb05c9f1a
3
+ metadata.gz: db68bd0813ac0151f45f174d89c95c5accb2c11a77df2321f859d18f62ecf06f
4
+ data.tar.gz: 5d9b7ee4ea5c98a8e90d4d8d6d657223150064be4e867a8ef444eb93b357a195
5
5
  SHA512:
6
- metadata.gz: aa017464c7b23bfffc33a1e37c92c8823e0a5fd42c2505e251c36f9d092e444ff04d61457957d56a2a197f56030d5de0e73a4071226fc38e2e801ffd646bd2fd
7
- data.tar.gz: 2c5a264af86979e6250d4763e5572e93a2136855f1c3c3572019d18374e7dfd7bf37669f814667c4c308e98553e2bb2287bf6aadddd9a04d98e59fe155b716e8
6
+ metadata.gz: a166c272417d15db4e3a04dcfb2057c0536a8412e7bce5810b9885998823d354667b42dbf9a49796d73498f469c1978779ea8a518ccd1ed92d2c9f6985c69f5e
7
+ data.tar.gz: c24f43b46820b37f16a0bf476e48d86c2a159ebc6b6a2b87da3194d7c6e0496b0ed25c7698a83c8a5f4bb1bc5fd77503c188492a19c3b8403298e994b03a5dab
data/CHANGELOG.md CHANGED
@@ -8,6 +8,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
 
9
9
  Nothing yet...
10
10
 
11
+
12
+ ## [3.20.0] - 2023-9-21
13
+
14
+ ### Added
15
+ - Support added for more versions of the `cucumber-gherkin` gem
16
+ - 27.x
17
+
18
+ ### Changed
19
+ - `#inspect` for models now returns a reasonably small set of details for the model instead of the potentially
20
+ huge screen dump of information. Not considered a breaking change because the API never specified the behavior
21
+ of `#inspect` (it was just using the default Ruby implementation). Default Ruby inspection can still be triggered,
22
+ if desired (see documentation).
23
+
11
24
  ## [3.19.0] - 2023-1-22
12
25
 
13
26
  ### Added
@@ -442,7 +455,8 @@ Nothing yet...
442
455
  - Initial release
443
456
 
444
457
 
445
- [Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.19.0...HEAD
458
+ [Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.20.0...HEAD
459
+ [3.20.0]: https://github.com/enkessler/cuke_modeler/compare/v3.19.0...v3.20.0
446
460
  [3.19.0]: https://github.com/enkessler/cuke_modeler/compare/v3.18.0...v3.19.0
447
461
  [3.18.0]: https://github.com/enkessler/cuke_modeler/compare/v3.17.0...v3.18.0
448
462
  [3.17.0]: https://github.com/enkessler/cuke_modeler/compare/v3.16.0...v3.17.0
data/cuke_modeler.gemspec CHANGED
@@ -37,17 +37,19 @@ 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', '< 27.0'
40
+ spec.add_runtime_dependency 'cucumber-gherkin', '< 28.0'
41
41
 
42
42
  spec.add_development_dependency 'bundler', '< 3.0'
43
43
  spec.add_development_dependency 'childprocess', '< 5.0'
44
44
  spec.add_development_dependency 'ffi', '< 2.0' # This is an invisible dependency for the `childprocess` gem on Windows
45
45
  # Cucumber 4.x is the earliest version to use cucumber-gherkin
46
- spec.add_development_dependency 'cucumber', '>= 4.0.0', '< 8.0.0'
46
+ spec.add_development_dependency 'cucumber', '>= 4.0.0', '< 10.0.0'
47
47
  spec.add_development_dependency 'rainbow', '< 4.0.0'
48
48
  spec.add_development_dependency 'rake', '< 14.0.0'
49
49
  spec.add_development_dependency 'rspec', '~> 3.0'
50
- # Running recent RuboCop versions requires a recent version of Ruby but it can still lint against Ruby 2.3 styles
50
+ # Running recent RuboCop versions requires a recent version of Ruby but it can still lint against Ruby 2.3 styles.
51
+ # Can't set a lower bound because RuboCop will still get installed in the testing environments for earlier Rubies,
52
+ # even if it never actually gets run. Current "minimum" version is 1.44.0.
51
53
  spec.add_development_dependency 'rubocop', '< 2.0'
52
54
  spec.add_development_dependency 'simplecov', '< 1.0'
53
55
  spec.add_development_dependency 'simplecov-lcov', '< 1.0'
@@ -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 27.x of the *cucumber-gherkin* gem into input that is consumable
8
+ # by this gem.
9
+
10
+ class Gherkin27Adapter < Gherkin20Adapter
11
+
12
+ end
13
+ end
@@ -53,6 +53,16 @@ module CukeModeler
53
53
  text
54
54
  end
55
55
 
56
+ # See `Object#inspect`. Returns some basic information about the
57
+ # object, including its class, object ID, and its most meaningful
58
+ # attribute. For a background model, this will be the name of the
59
+ # background.
60
+ def inspect(verbose: false)
61
+ return super(verbose: verbose) if verbose
62
+
63
+ "#{super.chop} @name: #{name.inspect}>"
64
+ end
65
+
56
66
 
57
67
  private
58
68
 
@@ -30,6 +30,15 @@ module CukeModeler
30
30
  @value ? @value.gsub('\\', '\\\\\\').gsub('|', '\|') : ''
31
31
  end
32
32
 
33
+ # See `Object#inspect`. Returns some basic information about the
34
+ # object, including its class, object ID, and its most meaningful
35
+ # attribute. For a cell model, this will be the value of the cell.
36
+ def inspect(verbose: false)
37
+ return super(verbose: verbose) if verbose
38
+
39
+ "#{super.chop} @value: #{value.inspect}>"
40
+ end
41
+
33
42
 
34
43
  private
35
44
 
@@ -29,6 +29,15 @@ module CukeModeler
29
29
  text || ''
30
30
  end
31
31
 
32
+ # See `Object#inspect`. Returns some basic information about the
33
+ # object, including its class, object ID, and its most meaningful
34
+ # attribute. For a comment model, this will be the text of the comment.
35
+ def inspect(verbose: false)
36
+ return super(verbose: verbose) if verbose
37
+
38
+ "#{super.chop} @text: #{text.inspect}>"
39
+ end
40
+
32
41
 
33
42
  private
34
43
 
@@ -46,6 +46,16 @@ module CukeModeler
46
46
  path.to_s
47
47
  end
48
48
 
49
+ # See `Object#inspect`. Returns some basic information about the
50
+ # object, including its class, object ID, and its most meaningful
51
+ # attribute. For a directory model, this will be the path of the
52
+ # directory.
53
+ def inspect(verbose: false)
54
+ return super(verbose: verbose) if verbose
55
+
56
+ "#{super.chop} @path: #{@path.inspect}>"
57
+ end
58
+
49
59
 
50
60
  private
51
61
 
@@ -34,6 +34,16 @@ module CukeModeler
34
34
  text << '"""'
35
35
  end
36
36
 
37
+ # See `Object#inspect`. Returns some basic information about the
38
+ # object, including its class, object ID, and its most meaningful
39
+ # attribute. For a doc string model, this will be the content of
40
+ # the doc string.
41
+ def inspect(verbose: false)
42
+ return super(verbose: verbose) if verbose
43
+
44
+ "#{super.chop} @content: #{content.inspect}>"
45
+ end
46
+
37
47
 
38
48
  private
39
49
 
@@ -44,7 +44,7 @@ module CukeModeler
44
44
  # A quick 'deep clone' so that the input isn't modified
45
45
  row = Marshal.load(Marshal.dump(row))
46
46
 
47
- values = if row.is_a?(Array) # rubocop:disable Style/CaseLikeIf # False positive
47
+ values = if row.is_a?(Array)
48
48
  row
49
49
  elsif row.is_a?(Hash)
50
50
  # There is no guarantee that the user built up their hash with the keys in the same order as
@@ -64,7 +64,7 @@ module CukeModeler
64
64
  def remove_row(row_removed)
65
65
  return if argument_rows.empty?
66
66
 
67
- values = if row_removed.is_a?(Array) # rubocop:disable Style/CaseLikeIf # False positive
67
+ values = if row_removed.is_a?(Array)
68
68
  row_removed
69
69
  elsif row_removed.is_a?(Hash)
70
70
  # There is no guarantee that the user built up their hash with the keys in the same order as
@@ -118,6 +118,15 @@ module CukeModeler
118
118
 
119
119
  # rubocop:enable Metrics/AbcSize
120
120
 
121
+ # See `Object#inspect`. Returns some basic information about the
122
+ # object, including its class, object ID, and its most meaningful
123
+ # attribute. For an example model, this will be the name of the example.
124
+ def inspect(verbose: false)
125
+ return super(verbose: verbose) if verbose
126
+
127
+ "#{super.chop} @name: #{name.inspect}>"
128
+ end
129
+
121
130
 
122
131
  private
123
132
 
@@ -99,6 +99,15 @@ module CukeModeler
99
99
 
100
100
  # rubocop:enable Metrics/AbcSize
101
101
 
102
+ # See `Object#inspect`. Returns some basic information about the
103
+ # object, including its class, object ID, and its most meaningful
104
+ # attribute. For a feature model, this will be the name of the feature.
105
+ def inspect(verbose: false)
106
+ return super(verbose: verbose) if verbose
107
+
108
+ "#{super.chop} @name: #{name.inspect}>"
109
+ end
110
+
102
111
 
103
112
  private
104
113
 
@@ -47,6 +47,16 @@ module CukeModeler
47
47
  path.to_s
48
48
  end
49
49
 
50
+ # See `Object#inspect`. Returns some basic information about the
51
+ # object, including its class, object ID, and its most meaningful
52
+ # attribute. For a feature file model, this will be the path of
53
+ # the feature file.
54
+ def inspect(verbose: false)
55
+ return super(verbose: verbose) if verbose
56
+
57
+ "#{super.chop} @path: #{@path.inspect}>"
58
+ end
59
+
50
60
 
51
61
  private
52
62
 
@@ -32,5 +32,13 @@ module CukeModeler
32
32
  []
33
33
  end
34
34
 
35
+ # See `Object#inspect`. Returns some basic information about the
36
+ # object, including its class and object ID.
37
+ def inspect(verbose: false)
38
+ return super() if verbose
39
+
40
+ "#<#{self.class.name}:#{object_id}>"
41
+ end
42
+
35
43
  end
36
44
  end
@@ -66,6 +66,15 @@ module CukeModeler
66
66
 
67
67
  # rubocop:enable Metrics/AbcSize
68
68
 
69
+ # See `Object#inspect`. Returns some basic information about the
70
+ # object, including its class, object ID, and its most meaningful
71
+ # attribute. For an outline model, this will be the name of the outline.
72
+ def inspect(verbose: false)
73
+ return super(verbose: verbose) if verbose
74
+
75
+ "#{super.chop} @name: #{name.inspect}>"
76
+ end
77
+
69
78
 
70
79
  private
71
80
 
@@ -37,6 +37,17 @@ module CukeModeler
37
37
  "| #{text_cells.join(' | ')} |"
38
38
  end
39
39
 
40
+ # See `Object#inspect`. Returns some basic information about the
41
+ # object, including its class, object ID, and its most meaningful
42
+ # attribute. For a row model, this will be the cells of the row.
43
+ def inspect(verbose: false)
44
+ return super(verbose: verbose) if verbose
45
+
46
+ cell_output = @cells&.collect(&:value)
47
+
48
+ "#{super.chop} @cells: #{cell_output.inspect}>"
49
+ end
50
+
40
51
 
41
52
  private
42
53
 
@@ -74,6 +74,15 @@ module CukeModeler
74
74
  text
75
75
  end
76
76
 
77
+ # See `Object#inspect`. Returns some basic information about the
78
+ # object, including its class, object ID, and its most meaningful
79
+ # attribute. For a rule model, this will be the name of the rule.
80
+ def inspect(verbose: false)
81
+ return super(verbose: verbose) if verbose
82
+
83
+ "#{super.chop} @name: #{@name.inspect}>"
84
+ end
85
+
77
86
 
78
87
  private
79
88
 
@@ -61,6 +61,15 @@ module CukeModeler
61
61
 
62
62
  # rubocop:enable Metrics/AbcSize
63
63
 
64
+ # See `Object#inspect`. Returns some basic information about the
65
+ # object, including its class, object ID, and its most meaningful
66
+ # attribute. For a scenario model, this will be the name of the scenario.
67
+ def inspect(verbose: false)
68
+ return super(verbose: verbose) if verbose
69
+
70
+ "#{super.chop} @name: #{name.inspect}>"
71
+ end
72
+
64
73
 
65
74
  private
66
75
 
@@ -53,6 +53,15 @@ module CukeModeler
53
53
  text
54
54
  end
55
55
 
56
+ # See `Object#inspect`. Returns some basic information about the
57
+ # object, including its class, object ID, and its most meaningful
58
+ # attribute. For a step model, this will be the text of the step.
59
+ def inspect(verbose: false)
60
+ return super(verbose: verbose) if verbose
61
+
62
+ "#{super.chop} @text: #{@text.inspect}>"
63
+ end
64
+
56
65
 
57
66
  private
58
67
 
@@ -36,6 +36,17 @@ module CukeModeler
36
36
  rows.empty? ? '' : rows.collect { |row| row_output_string(row) }.join("\n")
37
37
  end
38
38
 
39
+ # See `Object#inspect`. Returns some basic information about the
40
+ # object, including its class, object ID, and its most meaningful
41
+ # attribute. For a table model, this will be the rows of the table.
42
+ def inspect(verbose: false)
43
+ return super(verbose: verbose) if verbose
44
+
45
+ row_output = @rows&.collect { |row| row.cells.collect(&:value) }
46
+
47
+ "#{super.chop} @rows: #{row_output.inspect}>"
48
+ end
49
+
39
50
 
40
51
  private
41
52
 
@@ -29,6 +29,15 @@ module CukeModeler
29
29
  name || ''
30
30
  end
31
31
 
32
+ # See `Object#inspect`. Returns some basic information about the
33
+ # object, including its class, object ID, and its most meaningful
34
+ # attribute. For a tag model, this will be the name of the tag.
35
+ def inspect(verbose: false)
36
+ return super(verbose: verbose) if verbose
37
+
38
+ "#{super.chop} @name: #{@name.inspect}>"
39
+ end
40
+
32
41
 
33
42
  private
34
43
 
@@ -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..26)
12
+ supported_gherkin_versions = (9..27)
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, 23, 24, 25, 26
66
+ when 20, 21, 22, 23, 24, 25, 26, 27
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
@@ -185,7 +185,7 @@ module CukeModeler
185
185
  end
186
186
 
187
187
  def get_word(word_set)
188
- word_set = word_set.is_a?(Array) ? word_set : word_set.split('|')
188
+ word_set = word_set.split('|') unless word_set.is_a?(Array)
189
189
 
190
190
  word_set.first
191
191
  end
@@ -1,4 +1,4 @@
1
1
  module CukeModeler
2
2
  # The gem version
3
- VERSION = '3.19.0'.freeze
3
+ VERSION = '3.20.0'.freeze
4
4
  end
@@ -1,9 +1,10 @@
1
1
  Feature: Background output
2
2
 
3
- A background model's string output is a Gherkin representation of itself. As such, output from a background model can be used as input for the same kind of model.
3
+ A background model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the name of the background that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a background model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  Background: A background with everything that it could have
@@ -20,11 +21,14 @@ Feature: Background output
20
21
  """
21
22
  And a background model based on that gherkin
22
23
  """
23
- @model = CukeModeler::Background.new(<source_text>)
24
+ @model = CukeModeler::Background.new(<source_text>)
24
25
  """
26
+
27
+
28
+ Scenario: Stringify a background model
25
29
  When the model is output as a string
26
30
  """
27
- @model.to_s
31
+ @model.to_s
28
32
  """
29
33
  Then the following text is provided:
30
34
  """
@@ -42,5 +46,15 @@ Feature: Background output
42
46
  """
43
47
  And the output can be used to make an equivalent model
44
48
  """
45
- CukeModeler::Background.new(@model.to_s)
49
+ CukeModeler::Background.new(@model.to_s)
50
+ """
51
+
52
+ Scenario: Inspect a background model
53
+ When the model is inspected
54
+ """
55
+ @model.inspect
56
+ """
57
+ Then the following text is provided:
58
+ """
59
+ #<CukeModeler::Background:<object_id> @name: "A background with everything that it could have">
46
60
  """
@@ -1,22 +1,36 @@
1
1
  Feature: Cell output
2
2
 
3
- A cell model's string output is a Gherkin representation of itself.
3
+ A cell model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the value of the cell that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a cell model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  foo
10
11
  """
11
12
  And a cell model based on that gherkin
12
13
  """
13
- @model = CukeModeler::Cell.new(<source_text>)
14
+ @model = CukeModeler::Cell.new(<source_text>)
14
15
  """
16
+
17
+
18
+ Scenario: Stringify a cell model
15
19
  When the model is output as a string
16
20
  """
17
- @model.to_s
21
+ @model.to_s
18
22
  """
19
23
  Then the following text is provided:
20
24
  """
21
25
  foo
22
26
  """
27
+
28
+ Scenario: Inspect a cell model
29
+ When the model is inspected
30
+ """
31
+ @model.inspect
32
+ """
33
+ Then the following text is provided:
34
+ """
35
+ #<CukeModeler::Cell:<object_id> @value: "foo">
36
+ """
@@ -1,20 +1,24 @@
1
1
  Feature: Comment output
2
2
 
3
- A comment model's string output is a Gherkin representation of itself. As such, output from a comment model can be used as input for the same kind of model.
3
+ A comment model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the text of the comment that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a comment model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  # a comment
10
11
  """
11
12
  And a comment model based on that gherkin
12
13
  """
13
- @model = CukeModeler::Comment.new(<source_text>)
14
+ @model = CukeModeler::Comment.new(<source_text>)
14
15
  """
16
+
17
+
18
+ Scenario: Stringify a comment model
15
19
  When the model is output as a string
16
20
  """
17
- @model.to_s
21
+ @model.to_s
18
22
  """
19
23
  Then the following text is provided:
20
24
  """
@@ -22,5 +26,15 @@ Feature: Comment output
22
26
  """
23
27
  And the output can be used to make an equivalent model
24
28
  """
25
- CukeModeler::Comment.new(@model.to_s)
29
+ CukeModeler::Comment.new(@model.to_s)
30
+ """
31
+
32
+ Scenario: Inspect a comment model
33
+ When the model is inspected
34
+ """
35
+ @model.inspect
36
+ """
37
+ Then the following text is provided:
38
+ """
39
+ #<CukeModeler::Comment:<object_id> @text: "# a comment">
26
40
  """
@@ -1,16 +1,33 @@
1
1
  Feature: Directory output
2
2
 
3
- A directory model's string output is simply the file path of the directory that it models. As such, output from a directory model can be used as input for the same kind of model.
3
+ A directory model's string output is simply the file path of the directory that it models and its
4
+ most relevant attribute for inspection is the path of the directory that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a directory model
7
+ Background:
7
8
  Given a directory model based on "some_directory"
8
- When it is outputted
9
+
10
+
11
+ Scenario: Stringify a directory model
12
+ When the model is output as a string
13
+ """
14
+ @model.to_s
15
+ """
9
16
  Then the following text is provided:
10
17
  """
11
18
  <path_to>/some_directory
12
19
  """
13
20
  And the output can be used to make an equivalent model
14
21
  """
15
- CukeModeler::Directory.new(@model.to_s)
22
+ CukeModeler::Directory.new(@model.to_s)
23
+ """
24
+
25
+ Scenario: Inspect a directory model
26
+ When the model is inspected
27
+ """
28
+ @model.inspect
29
+ """
30
+ Then the following text is provided:
31
+ """
32
+ #<CukeModeler::Directory:<object_id> @path: "<path_to>/some_directory">
16
33
  """
@@ -1,9 +1,10 @@
1
1
  Feature: Doc string output
2
2
 
3
- A doc string model's string output is a Gherkin representation of itself. As such, output from a doc string model can be used as input for the same kind of model.
3
+ A doc string model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the content of the doc string that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a doc string model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  \"\"\" type foo
@@ -15,11 +16,14 @@ Feature: Doc string output
15
16
  """
16
17
  And a doc string model based on that gherkin
17
18
  """
18
- @model = CukeModeler::DocString.new(<source_text>)
19
+ @model = CukeModeler::DocString.new(<source_text>)
19
20
  """
21
+
22
+
23
+ Scenario: Stringify a doc string model
20
24
  When the model is output as a string
21
25
  """
22
- @model.to_s
26
+ @model.to_s
23
27
  """
24
28
  Then the following text is provided:
25
29
  """
@@ -32,5 +36,15 @@ Feature: Doc string output
32
36
  """
33
37
  And the output can be used to make an equivalent model
34
38
  """
35
- CukeModeler::DocString.new(@model.to_s)
39
+ CukeModeler::DocString.new(@model.to_s)
40
+ """
41
+
42
+ Scenario: Inspect a doc string model
43
+ When the model is inspected
44
+ """
45
+ @model.inspect
46
+ """
47
+ Then the following text is provided:
48
+ """
49
+ #<CukeModeler::DocString:<object_id> @content: "Some text\n\n some more text\n">
36
50
  """
@@ -1,14 +1,15 @@
1
1
  Feature: Example output
2
2
 
3
- An example model's string output is a Gherkin representation of itself. As such, output from an example model can be used as input for the same kind of model.
3
+ An example model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the name of the example that it models.
4
5
 
5
6
 
6
- Scenario: Outputting an example model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  @tag1
10
11
  @tag2 @tag3
11
- Examples: an example with everything that it could have
12
+ Examples: An example with everything that it could have
12
13
 
13
14
  Some description.
14
15
  Some more description.
@@ -19,16 +20,19 @@ Feature: Example output
19
20
  """
20
21
  And an example model based on that gherkin
21
22
  """
22
- @model = CukeModeler::Example.new(<source_text>)
23
+ @model = CukeModeler::Example.new(<source_text>)
23
24
  """
25
+
26
+
27
+ Scenario: Stringify an example model
24
28
  When the model is output as a string
25
29
  """
26
- @model.to_s
30
+ @model.to_s
27
31
  """
28
32
  Then the following text is provided:
29
33
  """
30
34
  @tag1 @tag2 @tag3
31
- Examples: an example with everything that it could have
35
+ Examples: An example with everything that it could have
32
36
 
33
37
  Some description.
34
38
  Some more description.
@@ -39,5 +43,15 @@ Feature: Example output
39
43
  """
40
44
  And the output can be used to make an equivalent model
41
45
  """
42
- CukeModeler::Example.new(@model.to_s)
46
+ CukeModeler::Example.new(@model.to_s)
47
+ """
48
+
49
+ Scenario: Inspect an example model
50
+ When the model is inspected
51
+ """
52
+ @model.inspect
53
+ """
54
+ Then the following text is provided:
55
+ """
56
+ #<CukeModeler::Example:<object_id> @name: "An example with everything that it could have">
43
57
  """
@@ -1,16 +1,33 @@
1
1
  Feature: Feature file output
2
2
 
3
- A feature file model's string output is simply the file path of the feature file that it models. As such, output from a feature file model can be used as input for the same kind of model.
3
+ A feature file model's string output is simply the file path of the feature file that it models and its
4
+ most relevant attribute for inspection is the path of the feature file that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a feature file model
7
+ Background:
7
8
  Given a feature file model based on "some_feature_file.feature"
8
- When it is outputted
9
+
10
+
11
+ Scenario: Stringify a feature file model
12
+ When the model is output as a string
13
+ """
14
+ @model.to_s
15
+ """
9
16
  Then the following text is provided:
10
17
  """
11
18
  <path_to>/some_feature_file.feature
12
19
  """
13
20
  And the output can be used to make an equivalent model
14
21
  """
15
- CukeModeler::FeatureFile.new(@model.to_s)
22
+ CukeModeler::FeatureFile.new(@model.to_s)
23
+ """
24
+
25
+ Scenario: Inspect a feature file model
26
+ When the model is inspected
27
+ """
28
+ @model.inspect
29
+ """
30
+ Then the following text is provided:
31
+ """
32
+ #<CukeModeler::FeatureFile:<object_id> @path: "<path_to>/some_feature_file.feature">
16
33
  """
@@ -1,9 +1,10 @@
1
1
  Feature: Feature output
2
2
 
3
- A feature model's string output is a Gherkin representation of itself. As such, output from a feature model can be used as input for the same kind of model.
3
+ A feature model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the name of the feature that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a feature model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  @tag1@tag2
@@ -28,7 +29,7 @@ Feature: Feature output
28
29
  some text
29
30
  \"\"\"
30
31
  Rule: a rule
31
- Rule description
32
+ Rule description
32
33
  Background: nested background
33
34
  * a step
34
35
  @outline_tag
@@ -53,11 +54,14 @@ Feature: Feature output
53
54
  """
54
55
  And a feature model based on that gherkin
55
56
  """
56
- @model = CukeModeler::Feature.new(<source_text>)
57
+ @model = CukeModeler::Feature.new(<source_text>)
57
58
  """
59
+
60
+
61
+ Scenario: Stringify a feature model
58
62
  When the model is output as a string
59
63
  """
60
- @model.to_s
64
+ @model.to_s
61
65
  """
62
66
  Then the following text is provided:
63
67
  """
@@ -126,5 +130,15 @@ Feature: Feature output
126
130
  """
127
131
  And the output can be used to make an equivalent model
128
132
  """
129
- CukeModeler::Feature.new(@model.to_s)
133
+ CukeModeler::Feature.new(@model.to_s)
134
+ """
135
+
136
+ Scenario: Inspect a feature model
137
+ When the model is inspected
138
+ """
139
+ @model.inspect
140
+ """
141
+ Then the following text is provided:
142
+ """
143
+ #<CukeModeler::Feature:<object_id> @name: "A feature with everything it could have">
130
144
  """
@@ -1,13 +1,61 @@
1
1
  Feature: Model output
2
2
 
3
- All models can be output in text form. For models that represent parts of the file structure, this text will be a path and for models that represent parts of a feature file, this text will be Gherkin (see the model output documentation for specific models for details).
3
+ All models can be output in text form via `#to_s`. For models that represent parts of the file structure, this text
4
+ usually is a path. For models that represent parts of a feature file, this text usually is Gherkin. In any case, the
5
+ output is in a format that can be used to create the same kind of model.
4
6
 
7
+ Due to the nested nature of model relationships, the default output of `#inspect` can get...lengthy. For this reason,
8
+ all models override `#inspect` to make it provide a minimal but useful amount of information on the model object.
9
+ Switching between the minimal and the verbose (i.e. default Ruby behavior) version is controlled by a flag.
5
10
 
6
- Scenario: Outputting a model
11
+ See the model output documentation for specific models for details.
12
+
13
+
14
+ Scenario: Stringify a model
7
15
  Given the models provided by CukeModeler
8
- Then all of them can be output as text appropriate to the model type
16
+ Then all of them can be output as text appropriate to the model type
9
17
  """
10
- model = <model_class>.new
18
+ model = <model_class>.new
11
19
 
12
- model.to_s
20
+ model.to_s
21
+ """
22
+
23
+ Scenario: Inspect a model
24
+
25
+ Note: The base model class, `CukeModeler::Model` lacks any "meaningful attributes"
26
+
27
+ Given the models provided by CukeModeler
28
+ Then all of them can provide a custom inspection output
29
+ """
30
+ model = <model_class>.new
31
+
32
+ model.inspect
33
+ """
34
+ And the inspection values are of the form:
13
35
  """
36
+ #<CukeModeler::<model_class>:<object_id> <some_meaningful_attribute>: <attribute_value>>
37
+ """
38
+ But the base model class inspection value is of the form:
39
+ """
40
+ #<CukeModeler::<model_class>:<object_id>>
41
+ """
42
+
43
+ Scenario: Controlling inspection output
44
+
45
+ Note: Non-verbose inspection is the default behavior for models
46
+
47
+ Given the models provided by CukeModeler
48
+ When using non-verbose inspection
49
+ """
50
+ model = <model_class>.new
51
+
52
+ model.inspect(verbose: false)
53
+ """
54
+ Then the custom model inspection is used
55
+ When using verbose inspection
56
+ """
57
+ model = <model_class>.new
58
+
59
+ model.inspect(verbose: true)
60
+ """
61
+ Then the default Ruby inspection is used
@@ -1,9 +1,10 @@
1
1
  Feature: Outline output
2
2
 
3
- An outline model's string output is a Gherkin representation of itself. As such, output from an outline model can be used as input for the same kind of model.
3
+ An outline model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the name of the outline that it models.
4
5
 
5
6
 
6
- Scenario: Outputting an outline model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  @tag1@tag2
@@ -33,11 +34,14 @@ Feature: Outline output
33
34
  """
34
35
  And an outline model based on that gherkin
35
36
  """
36
- @model = CukeModeler::Outline.new(<source_text>)
37
+ @model = CukeModeler::Outline.new(<source_text>)
37
38
  """
39
+
40
+
41
+ Scenario: Stringify an outline model
38
42
  When the model is output as a string
39
43
  """
40
- @model.to_s
44
+ @model.to_s
41
45
  """
42
46
  Then the following text is provided:
43
47
  """
@@ -69,5 +73,15 @@ Feature: Outline output
69
73
  """
70
74
  And the output can be used to make an equivalent model
71
75
  """
72
- CukeModeler::Outline.new(@model.to_s)
76
+ CukeModeler::Outline.new(@model.to_s)
77
+ """
78
+
79
+ Scenario: Inspect an outline model
80
+ When the model is inspected
81
+ """
82
+ @model.inspect
83
+ """
84
+ Then the following text is provided:
85
+ """
86
+ #<CukeModeler::Outline:<object_id> @name: "An outline with everything that it could have">
73
87
  """
@@ -1,20 +1,24 @@
1
1
  Feature: Row output
2
2
 
3
- A row model's string output is a Gherkin representation of itself. As such, output from a row model can be used as input for the same kind of model.
3
+ A row model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the collection of cells of the row that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a row model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  |foo|bar|
10
11
  """
11
12
  And a row model based on that gherkin
12
13
  """
13
- @model = CukeModeler::Row.new(<source_text>)
14
+ @model = CukeModeler::Row.new(<source_text>)
14
15
  """
16
+
17
+
18
+ Scenario: Stringify a row model
15
19
  When the model is output as a string
16
20
  """
17
- @model.to_s
21
+ @model.to_s
18
22
  """
19
23
  Then the following text is provided:
20
24
  """
@@ -22,5 +26,15 @@ Feature: Row output
22
26
  """
23
27
  And the output can be used to make an equivalent model
24
28
  """
25
- CukeModeler::Row.new(@model.to_s)
29
+ CukeModeler::Row.new(@model.to_s)
30
+ """
31
+
32
+ Scenario: Inspect a row model
33
+ When the model is inspected
34
+ """
35
+ @model.inspect
36
+ """
37
+ Then the following text is provided:
38
+ """
39
+ #<CukeModeler::Row:<object_id> @cells: ["foo", "bar"]>
26
40
  """
@@ -1,11 +1,11 @@
1
1
  Feature: Rule output
2
2
 
3
- A rule model's string output is a Gherkin representation of itself. As such, output from a rule model can be used as
4
- input for the same kind of model.
3
+ A rule model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the name of the rule that it models.
5
5
 
6
6
 
7
7
  @gherkin_min_version_18
8
- Scenario: Outputting a rule model
8
+ Scenario: Stringify a rule model
9
9
  Given the following gherkin:
10
10
  """
11
11
  @tag1@tag2
@@ -49,11 +49,11 @@ Feature: Rule output
49
49
  """
50
50
  And a rule model based on that gherkin
51
51
  """
52
- @model = CukeModeler::Rule.new(<source_text>)
52
+ @model = CukeModeler::Rule.new(<source_text>)
53
53
  """
54
54
  When the model is output as a string
55
55
  """
56
- @model.to_s
56
+ @model.to_s
57
57
  """
58
58
  Then the following text is provided:
59
59
  """
@@ -111,5 +111,26 @@ Feature: Rule output
111
111
  """
112
112
  And the output can be used to make an equivalent model
113
113
  """
114
- CukeModeler::Rule.new(@model.to_s)
114
+ CukeModeler::Rule.new(@model.to_s)
115
+ """
116
+
117
+ Scenario: Inspect a rule model
118
+ Given the following gherkin:
119
+ """
120
+ Rule: some rule
121
+
122
+ Scenario: a scenario
123
+ * a step
124
+ """
125
+ And a rule model based on that gherkin
126
+ """
127
+ @model = CukeModeler::Rule.new(<source_text>)
128
+ """
129
+ When the model is inspected
130
+ """
131
+ @model.inspect
132
+ """
133
+ Then the following text is provided:
134
+ """
135
+ #<CukeModeler::Rule:<object_id> @name: "some rule">
115
136
  """
@@ -1,9 +1,10 @@
1
1
  Feature: Scenario output
2
2
 
3
- A scenario model's string output is a Gherkin representation of itself. As such, output from a scenario model can be used as input for the same kind of model.
3
+ A scenario model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the name of the scenario that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a scenario model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  @tag1@tag2
@@ -22,11 +23,14 @@ Feature: Scenario output
22
23
  """
23
24
  And a scenario model based on that gherkin
24
25
  """
25
- @model = CukeModeler::Scenario.new(<source_text>)
26
+ @model = CukeModeler::Scenario.new(<source_text>)
26
27
  """
28
+
29
+
30
+ Scenario: Stringify a scenario model
27
31
  When the model is output as a string
28
32
  """
29
- @model.to_s
33
+ @model.to_s
30
34
  """
31
35
  Then the following text is provided:
32
36
  """
@@ -45,5 +49,15 @@ Feature: Scenario output
45
49
  """
46
50
  And the output can be used to make an equivalent model
47
51
  """
48
- CukeModeler::Scenario.new(@model.to_s)
52
+ CukeModeler::Scenario.new(@model.to_s)
53
+ """
54
+
55
+ Scenario: Inspect a scenario model
56
+ When the model is inspected
57
+ """
58
+ @model.inspect
59
+ """
60
+ Then the following text is provided:
61
+ """
62
+ #<CukeModeler::Scenario:<object_id> @name: "A scenario with everything that it could have">
49
63
  """
@@ -1,9 +1,10 @@
1
1
  Feature: Step output
2
2
 
3
- A step model's string output is a Gherkin representation of itself. As such, output from a step model can be used as input for the same kind of model.
3
+ A step model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the text of the step that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a step model
7
+ Background:
7
8
 
8
9
  Note: Outputting a step that has a doc string is accomplished in the same manner
9
10
 
@@ -15,11 +16,14 @@ Feature: Step output
15
16
  """
16
17
  And a step model based on that gherkin
17
18
  """
18
- @model = CukeModeler::Step.new(<source_text>)
19
+ @model = CukeModeler::Step.new(<source_text>)
19
20
  """
21
+
22
+
23
+ Scenario: Stringify a step model
20
24
  When the model is output as a string
21
25
  """
22
- @model.to_s
26
+ @model.to_s
23
27
  """
24
28
  Then the following text is provided:
25
29
  """
@@ -29,5 +33,15 @@ Feature: Step output
29
33
  """
30
34
  And the output can be used to make an equivalent model
31
35
  """
32
- CukeModeler::Step.new(@model.to_s)
36
+ CukeModeler::Step.new(@model.to_s)
37
+ """
38
+
39
+ Scenario: Inspect a step model
40
+ When the model is inspected
41
+ """
42
+ @model.inspect
43
+ """
44
+ Then the following text is provided:
45
+ """
46
+ #<CukeModeler::Step:<object_id> @text: "a step">
33
47
  """
@@ -1,9 +1,10 @@
1
1
  Feature: Table output
2
2
 
3
- A table model's string output is a Gherkin representation of itself. As such, output from a table model can be used as input for the same kind of model.
3
+ A table model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the collection of rows of the table that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a table model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  |value1|value2|
@@ -11,8 +12,11 @@ Feature: Table output
11
12
  """
12
13
  And a table model based on that gherkin
13
14
  """
14
- @model = CukeModeler::Table.new(<source_text>)
15
+ @model = CukeModeler::Table.new(<source_text>)
15
16
  """
17
+
18
+
19
+ Scenario: Stringify a table model
16
20
  When the model is output as a string
17
21
  """
18
22
  @model.to_s
@@ -24,5 +28,15 @@ Feature: Table output
24
28
  """
25
29
  And the output can be used to make an equivalent model
26
30
  """
27
- CukeModeler::Table.new(@model.to_s)
31
+ CukeModeler::Table.new(@model.to_s)
32
+ """
33
+
34
+ Scenario: Inspect a table model
35
+ When the model is inspected
36
+ """
37
+ @model.inspect
38
+ """
39
+ Then the following text is provided:
40
+ """
41
+ #<CukeModeler::Table:<object_id> @rows: [["value1", "value2"], ["value3", "value4"]]>
28
42
  """
@@ -1,20 +1,24 @@
1
1
  Feature: Tag output
2
2
 
3
- A tag model's string output is a Gherkin representation of itself. As such, output from a tag model can be used as input for the same kind of model.
3
+ A tag model's string output is a Gherkin representation of itself and its most relevant attribute for
4
+ inspection is the name of the tag that it models.
4
5
 
5
6
 
6
- Scenario: Outputting a tag model
7
+ Background:
7
8
  Given the following gherkin:
8
9
  """
9
10
  @a_tag
10
11
  """
11
12
  And a tag model based on that gherkin
12
13
  """
13
- @model = CukeModeler::Tag.new(<source_text>)
14
+ @model = CukeModeler::Tag.new(<source_text>)
14
15
  """
16
+
17
+
18
+ Scenario: Stringify a tag model
15
19
  When the model is output as a string
16
20
  """
17
- @model.to_s
21
+ @model.to_s
18
22
  """
19
23
  Then the following text is provided:
20
24
  """
@@ -22,5 +26,15 @@ Feature: Tag output
22
26
  """
23
27
  And the output can be used to make an equivalent model
24
28
  """
25
- CukeModeler::Tag.new(@model.to_s)
29
+ CukeModeler::Tag.new(@model.to_s)
30
+ """
31
+
32
+ Scenario: Inspect a tag model
33
+ When the model is inspected
34
+ """
35
+ @model.inspect
36
+ """
37
+ Then the following text is provided:
38
+ """
39
+ #<CukeModeler::Tag:<object_id> @name: "@a_tag">
26
40
  """
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.19.0
4
+ version: 3.20.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-01-22 00:00:00.000000000 Z
11
+ date: 2023-09-22 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: '27.0'
19
+ version: '28.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: '27.0'
26
+ version: '28.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -75,7 +75,7 @@ dependencies:
75
75
  version: 4.0.0
76
76
  - - "<"
77
77
  - !ruby/object:Gem::Version
78
- version: 8.0.0
78
+ version: 10.0.0
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
@@ -85,7 +85,7 @@ dependencies:
85
85
  version: 4.0.0
86
86
  - - "<"
87
87
  - !ruby/object:Gem::Version
88
- version: 8.0.0
88
+ version: 10.0.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rainbow
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -233,6 +233,7 @@ files:
233
233
  - lib/cuke_modeler/adapters/gherkin_24_adapter.rb
234
234
  - lib/cuke_modeler/adapters/gherkin_25_adapter.rb
235
235
  - lib/cuke_modeler/adapters/gherkin_26_adapter.rb
236
+ - lib/cuke_modeler/adapters/gherkin_27_adapter.rb
236
237
  - lib/cuke_modeler/adapters/gherkin_9_adapter.rb
237
238
  - lib/cuke_modeler/adapters/gherkin_base_adapter.rb
238
239
  - lib/cuke_modeler/containing.rb