cuke_modeler 3.27.0 → 3.29.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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +585 -572
  3. data/LICENSE.txt +22 -22
  4. data/README.md +135 -135
  5. data/cuke_modeler.gemspec +59 -59
  6. data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +13 -13
  7. data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +13 -13
  8. data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +13 -13
  9. data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +13 -13
  10. data/lib/cuke_modeler/adapters/gherkin_14_adapter.rb +13 -13
  11. data/lib/cuke_modeler/adapters/gherkin_15_adapter.rb +13 -13
  12. data/lib/cuke_modeler/adapters/gherkin_16_adapter.rb +13 -13
  13. data/lib/cuke_modeler/adapters/gherkin_17_adapter.rb +13 -13
  14. data/lib/cuke_modeler/adapters/gherkin_18_adapter.rb +27 -27
  15. data/lib/cuke_modeler/adapters/gherkin_19_adapter.rb +64 -64
  16. data/lib/cuke_modeler/adapters/gherkin_20_adapter.rb +359 -359
  17. data/lib/cuke_modeler/adapters/gherkin_21_adapter.rb +13 -13
  18. data/lib/cuke_modeler/adapters/gherkin_22_adapter.rb +13 -13
  19. data/lib/cuke_modeler/adapters/gherkin_23_adapter.rb +13 -13
  20. data/lib/cuke_modeler/adapters/gherkin_24_adapter.rb +13 -13
  21. data/lib/cuke_modeler/adapters/gherkin_25_adapter.rb +13 -13
  22. data/lib/cuke_modeler/adapters/gherkin_26_adapter.rb +13 -13
  23. data/lib/cuke_modeler/adapters/gherkin_27_adapter.rb +13 -13
  24. data/lib/cuke_modeler/adapters/gherkin_28_adapter.rb +13 -13
  25. data/lib/cuke_modeler/adapters/gherkin_29_adapter.rb +13 -13
  26. data/lib/cuke_modeler/adapters/gherkin_30_adapter.rb +13 -13
  27. data/lib/cuke_modeler/adapters/gherkin_31_adapter.rb +13 -13
  28. data/lib/cuke_modeler/adapters/gherkin_32_adapter.rb +13 -13
  29. data/lib/cuke_modeler/adapters/gherkin_33_adapter.rb +13 -13
  30. data/lib/cuke_modeler/adapters/gherkin_34_adapter.rb +13 -13
  31. data/lib/cuke_modeler/adapters/gherkin_35_adapter.rb +13 -13
  32. data/lib/cuke_modeler/adapters/gherkin_36_adapter.rb +13 -13
  33. data/lib/cuke_modeler/adapters/gherkin_37_adapter.rb +13 -13
  34. data/lib/cuke_modeler/adapters/gherkin_38_adapter.rb +13 -0
  35. data/lib/cuke_modeler/adapters/gherkin_39_adapter.rb +13 -0
  36. data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +375 -375
  37. data/lib/cuke_modeler/adapters/gherkin_base_adapter.rb +17 -17
  38. data/lib/cuke_modeler/containing.rb +105 -105
  39. data/lib/cuke_modeler/described.rb +71 -71
  40. data/lib/cuke_modeler/models/background.rb +122 -122
  41. data/lib/cuke_modeler/models/cell.rb +88 -88
  42. data/lib/cuke_modeler/models/comment.rb +82 -82
  43. data/lib/cuke_modeler/models/directory.rb +143 -143
  44. data/lib/cuke_modeler/models/doc_string.rb +104 -104
  45. data/lib/cuke_modeler/models/example.rb +274 -274
  46. data/lib/cuke_modeler/models/feature.rb +200 -200
  47. data/lib/cuke_modeler/models/feature_file.rb +116 -116
  48. data/lib/cuke_modeler/models/model.rb +87 -87
  49. data/lib/cuke_modeler/models/outline.rb +145 -145
  50. data/lib/cuke_modeler/models/row.rb +104 -104
  51. data/lib/cuke_modeler/models/rule.rb +162 -162
  52. data/lib/cuke_modeler/models/scenario.rb +128 -128
  53. data/lib/cuke_modeler/models/step.rb +178 -178
  54. data/lib/cuke_modeler/models/table.rb +117 -117
  55. data/lib/cuke_modeler/models/tag.rb +75 -75
  56. data/lib/cuke_modeler/named.rb +26 -26
  57. data/lib/cuke_modeler/nested.rb +61 -61
  58. data/lib/cuke_modeler/parsed.rb +24 -24
  59. data/lib/cuke_modeler/parsing.rb +208 -208
  60. data/lib/cuke_modeler/sourceable.rb +29 -29
  61. data/lib/cuke_modeler/stepped.rb +34 -34
  62. data/lib/cuke_modeler/taggable.rb +57 -57
  63. data/lib/cuke_modeler/version.rb +4 -4
  64. data/lib/cuke_modeler.rb +32 -32
  65. data/testing/cucumber/features/analysis/step_comparison.feature +25 -25
  66. data/testing/cucumber/features/analysis/test_comparison.feature +35 -35
  67. data/testing/cucumber/features/modeling/background_modeling.feature +105 -105
  68. data/testing/cucumber/features/modeling/background_output.feature +60 -60
  69. data/testing/cucumber/features/modeling/cell_modeling.feature +68 -68
  70. data/testing/cucumber/features/modeling/cell_output.feature +36 -36
  71. data/testing/cucumber/features/modeling/comment_modeling.feature +62 -62
  72. data/testing/cucumber/features/modeling/comment_output.feature +40 -40
  73. data/testing/cucumber/features/modeling/directory_modeling.feature +62 -62
  74. data/testing/cucumber/features/modeling/directory_output.feature +33 -33
  75. data/testing/cucumber/features/modeling/doc_string_modeling.feature +85 -85
  76. data/testing/cucumber/features/modeling/doc_string_output.feature +50 -50
  77. data/testing/cucumber/features/modeling/example_modeling.feature +155 -155
  78. data/testing/cucumber/features/modeling/example_output.feature +57 -57
  79. data/testing/cucumber/features/modeling/feature_file_modeling.feature +49 -49
  80. data/testing/cucumber/features/modeling/feature_file_output.feature +33 -33
  81. data/testing/cucumber/features/modeling/feature_modeling.feature +149 -149
  82. data/testing/cucumber/features/modeling/feature_output.feature +144 -144
  83. data/testing/cucumber/features/modeling/model_output.feature +61 -61
  84. data/testing/cucumber/features/modeling/model_structure.feature +42 -42
  85. data/testing/cucumber/features/modeling/outline_modeling.feature +175 -175
  86. data/testing/cucumber/features/modeling/outline_output.feature +87 -87
  87. data/testing/cucumber/features/modeling/row_modeling.feature +70 -70
  88. data/testing/cucumber/features/modeling/row_output.feature +40 -40
  89. data/testing/cucumber/features/modeling/rule_modeling.feature +171 -171
  90. data/testing/cucumber/features/modeling/rule_output.feature +136 -136
  91. data/testing/cucumber/features/modeling/scenario_modeling.feature +146 -146
  92. data/testing/cucumber/features/modeling/scenario_output.feature +63 -63
  93. data/testing/cucumber/features/modeling/step_modeling.feature +105 -105
  94. data/testing/cucumber/features/modeling/step_output.feature +47 -47
  95. data/testing/cucumber/features/modeling/table_modeling.feature +73 -73
  96. data/testing/cucumber/features/modeling/table_output.feature +42 -42
  97. data/testing/cucumber/features/modeling/tag_modeling.feature +62 -62
  98. data/testing/cucumber/features/modeling/tag_output.feature +40 -40
  99. metadata +9 -10
@@ -1,75 +1,75 @@
1
- module CukeModeler
2
-
3
- # A class modeling a tag.
4
- class Tag < Model
5
-
6
- include Parsing
7
- include Parsed
8
- include Sourceable
9
- include Named
10
-
11
-
12
- # Creates a new Tag object and, if *source_text* is provided, populates the
13
- # object.
14
- #
15
- # @example
16
- # Tag.new
17
- # Tag.new('@a_tag')
18
- #
19
- # @param source_text [String] The Gherkin text that will be used to populate the model
20
- # @raise [ArgumentError] If *source_text* is not a String
21
- # @return [Tag] A new Tag instance
22
- def initialize(source_text = nil)
23
- super
24
- end
25
-
26
- # Returns a string representation of this model. For a Tag model,
27
- # this will be Gherkin text that is equivalent to the tag being modeled.
28
- #
29
- # @example
30
- # tag.to_s
31
- #
32
- # @return [String] A string representation of this model
33
- def to_s
34
- name || ''
35
- end
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 Tag model, this will be the name of the tag. If
40
- # *verbose* is true, provides default Ruby inspection behavior instead.
41
- #
42
- # @example
43
- # tag.inspect
44
- # tag.inspect(verbose: true)
45
- #
46
- # @param verbose [Boolean] Whether or not to return the full details of
47
- # the object. Defaults to false.
48
- # @return [String] A string representation of this model
49
- def inspect(verbose: false)
50
- return super if verbose
51
-
52
- "#{super.chop} @name: #{@name.inspect}>"
53
- end
54
-
55
-
56
- private
57
-
58
-
59
- def process_source(source_text)
60
- base_file_string = "\n#{dialect_feature_keyword}: Fake feature to parse"
61
- source_text = "# language: #{Parsing.dialect}\n" + source_text + base_file_string
62
-
63
- parsed_file = Parsing.parse_text(source_text, 'cuke_modeler_stand_alone_tag.feature')
64
-
65
- parsed_file['feature']['tags'].first
66
- end
67
-
68
- def populate_model(processed_tag_data)
69
- populate_name(processed_tag_data)
70
- populate_parsing_data(processed_tag_data)
71
- populate_source_location(processed_tag_data)
72
- end
73
-
74
- end
75
- end
1
+ module CukeModeler
2
+
3
+ # A class modeling a tag.
4
+ class Tag < Model
5
+
6
+ include Parsing
7
+ include Parsed
8
+ include Sourceable
9
+ include Named
10
+
11
+
12
+ # Creates a new Tag object and, if *source_text* is provided, populates the
13
+ # object.
14
+ #
15
+ # @example
16
+ # Tag.new
17
+ # Tag.new('@a_tag')
18
+ #
19
+ # @param source_text [String] The Gherkin text that will be used to populate the model
20
+ # @raise [ArgumentError] If *source_text* is not a String
21
+ # @return [Tag] A new Tag instance
22
+ def initialize(source_text = nil)
23
+ super
24
+ end
25
+
26
+ # Returns a string representation of this model. For a Tag model,
27
+ # this will be Gherkin text that is equivalent to the tag being modeled.
28
+ #
29
+ # @example
30
+ # tag.to_s
31
+ #
32
+ # @return [String] A string representation of this model
33
+ def to_s
34
+ name || ''
35
+ end
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 Tag model, this will be the name of the tag. If
40
+ # *verbose* is true, provides default Ruby inspection behavior instead.
41
+ #
42
+ # @example
43
+ # tag.inspect
44
+ # tag.inspect(verbose: true)
45
+ #
46
+ # @param verbose [Boolean] Whether or not to return the full details of
47
+ # the object. Defaults to false.
48
+ # @return [String] A string representation of this model
49
+ def inspect(verbose: false)
50
+ return super if verbose
51
+
52
+ "#{super.chop} @name: #{@name.inspect}>"
53
+ end
54
+
55
+
56
+ private
57
+
58
+
59
+ def process_source(source_text)
60
+ base_file_string = "\n#{dialect_feature_keyword}: Fake feature to parse"
61
+ source_text = "# language: #{Parsing.dialect}\n" + source_text + base_file_string
62
+
63
+ parsed_file = Parsing.parse_text(source_text, 'cuke_modeler_stand_alone_tag.feature')
64
+
65
+ parsed_file['feature']['tags'].first
66
+ end
67
+
68
+ def populate_model(processed_tag_data)
69
+ populate_name(processed_tag_data)
70
+ populate_parsing_data(processed_tag_data)
71
+ populate_source_location(processed_tag_data)
72
+ end
73
+
74
+ end
75
+ end
@@ -1,26 +1,26 @@
1
- module CukeModeler
2
-
3
- # @api private
4
- #
5
- # A mix-in module containing methods used by models that represent an element that has a name. Internal helper class.
6
- module Named
7
-
8
- # @api
9
- #
10
- # The name of the element
11
- attr_accessor :name
12
-
13
-
14
- private
15
-
16
-
17
- def name_output_string
18
- name.nil? || name.empty? ? '' : " #{name}"
19
- end
20
-
21
- def populate_name(parsed_model_data)
22
- @name = parsed_model_data['name']
23
- end
24
-
25
- end
26
- end
1
+ module CukeModeler
2
+
3
+ # @api private
4
+ #
5
+ # A mix-in module containing methods used by models that represent an element that has a name. Internal helper class.
6
+ module Named
7
+
8
+ # @api
9
+ #
10
+ # The name of the element
11
+ attr_accessor :name
12
+
13
+
14
+ private
15
+
16
+
17
+ def name_output_string
18
+ name.nil? || name.empty? ? '' : " #{name}"
19
+ end
20
+
21
+ def populate_name(parsed_model_data)
22
+ @name = parsed_model_data['name']
23
+ end
24
+
25
+ end
26
+ end
@@ -1,61 +1,61 @@
1
- module CukeModeler
2
-
3
- # @api private
4
- #
5
- # A mix-in module containing methods used by models that are nested inside
6
- # of other models. Internal helper class.
7
- module Nested
8
-
9
- # @api
10
- #
11
- # The parent model that contains this model
12
- attr_accessor :parent_model
13
-
14
- # TODO: Use an Enum type instead of symbols as arguments?
15
-
16
- # @api
17
- #
18
- # Returns the ancestor model of this model that matches the given type. Available
19
- # types are simply snake_case versions of the model Class names. Additionally, a
20
- # special type *:test* will return either a Scenario or an Outline model.
21
- #
22
- # @example
23
- # model.get_ancestor(:directory)
24
- #
25
- # @param ancestor_type [Symbol] The ancestor type to get
26
- # @raise [ArgumentError] If the passed type is not a valid model type
27
- # @return [Model, nil] The ancestor model, if one is found
28
- def get_ancestor(ancestor_type)
29
- target_classes = classes_for_type(ancestor_type)
30
-
31
- raise(ArgumentError, "Unknown ancestor type '#{ancestor_type}'.") if target_classes.nil?
32
-
33
- ancestor = parent_model
34
- ancestor = ancestor.parent_model until target_classes.include?(ancestor.class) || ancestor.nil?
35
-
36
- ancestor
37
- end
38
-
39
-
40
- private
41
-
42
-
43
- def classes_for_type(type)
44
- {
45
- directory: [Directory],
46
- feature_file: [FeatureFile],
47
- feature: [Feature],
48
- rule: [Rule],
49
- test: [Scenario, Outline, Background],
50
- background: [Background],
51
- scenario: [Scenario],
52
- outline: [Outline],
53
- step: [Step],
54
- table: [Table],
55
- example: [Example],
56
- row: [Row]
57
- }[type]
58
- end
59
-
60
- end
61
- end
1
+ module CukeModeler
2
+
3
+ # @api private
4
+ #
5
+ # A mix-in module containing methods used by models that are nested inside
6
+ # of other models. Internal helper class.
7
+ module Nested
8
+
9
+ # @api
10
+ #
11
+ # The parent model that contains this model
12
+ attr_accessor :parent_model
13
+
14
+ # TODO: Use an Enum type instead of symbols as arguments?
15
+
16
+ # @api
17
+ #
18
+ # Returns the ancestor model of this model that matches the given type. Available
19
+ # types are simply snake_case versions of the model Class names. Additionally, a
20
+ # special type *:test* will return either a Scenario or an Outline model.
21
+ #
22
+ # @example
23
+ # model.get_ancestor(:directory)
24
+ #
25
+ # @param ancestor_type [Symbol] The ancestor type to get
26
+ # @raise [ArgumentError] If the passed type is not a valid model type
27
+ # @return [Model, nil] The ancestor model, if one is found
28
+ def get_ancestor(ancestor_type)
29
+ target_classes = classes_for_type(ancestor_type)
30
+
31
+ raise(ArgumentError, "Unknown ancestor type '#{ancestor_type}'.") if target_classes.nil?
32
+
33
+ ancestor = parent_model
34
+ ancestor = ancestor.parent_model until target_classes.include?(ancestor.class) || ancestor.nil?
35
+
36
+ ancestor
37
+ end
38
+
39
+
40
+ private
41
+
42
+
43
+ def classes_for_type(type)
44
+ {
45
+ directory: [Directory],
46
+ feature_file: [FeatureFile],
47
+ feature: [Feature],
48
+ rule: [Rule],
49
+ test: [Scenario, Outline, Background],
50
+ background: [Background],
51
+ scenario: [Scenario],
52
+ outline: [Outline],
53
+ step: [Step],
54
+ table: [Table],
55
+ example: [Example],
56
+ row: [Row]
57
+ }[type]
58
+ end
59
+
60
+ end
61
+ end
@@ -1,24 +1,24 @@
1
- module CukeModeler
2
-
3
- # @api private
4
- #
5
- # A mix-in module containing methods used by models that are parsed from
6
- # source text. Internal helper class.
7
- module Parsed
8
-
9
- # @api
10
- #
11
- # The parsing data for this element that was generated by
12
- # the parsing engine (i.e. the *cucumber-gherkin* gem)
13
- attr_accessor :parsing_data
14
-
15
-
16
- private
17
-
18
-
19
- def populate_parsing_data(parsed_model_data)
20
- @parsing_data = parsed_model_data['cuke_modeler_parsing_data']
21
- end
22
-
23
- end
24
- end
1
+ module CukeModeler
2
+
3
+ # @api private
4
+ #
5
+ # A mix-in module containing methods used by models that are parsed from
6
+ # source text. Internal helper class.
7
+ module Parsed
8
+
9
+ # @api
10
+ #
11
+ # The parsing data for this element that was generated by
12
+ # the parsing engine (i.e. the *cucumber-gherkin* gem)
13
+ attr_accessor :parsing_data
14
+
15
+
16
+ private
17
+
18
+
19
+ def populate_parsing_data(parsed_model_data)
20
+ @parsing_data = parsed_model_data['cuke_modeler_parsing_data']
21
+ end
22
+
23
+ end
24
+ end