cuke_modeler 1.5.0 → 3.1.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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +341 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +22 -15
  5. data/cuke_modeler.gemspec +15 -9
  6. data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +12 -0
  7. data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +12 -0
  8. data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +12 -0
  9. data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +12 -0
  10. data/lib/cuke_modeler/adapters/gherkin_14_adapter.rb +12 -0
  11. data/lib/cuke_modeler/adapters/{gherkin_6_adapter.rb → gherkin_9_adapter.rb} +75 -64
  12. data/lib/cuke_modeler/containing.rb +3 -0
  13. data/lib/cuke_modeler/described.rb +1 -0
  14. data/lib/cuke_modeler/models/background.rb +1 -1
  15. data/lib/cuke_modeler/models/cell.rb +1 -1
  16. data/lib/cuke_modeler/models/comment.rb +1 -1
  17. data/lib/cuke_modeler/models/directory.rb +2 -2
  18. data/lib/cuke_modeler/models/doc_string.rb +1 -1
  19. data/lib/cuke_modeler/models/example.rb +1 -1
  20. data/lib/cuke_modeler/models/feature.rb +1 -1
  21. data/lib/cuke_modeler/models/feature_file.rb +2 -2
  22. data/lib/cuke_modeler/models/outline.rb +1 -1
  23. data/lib/cuke_modeler/models/row.rb +1 -1
  24. data/lib/cuke_modeler/models/scenario.rb +1 -1
  25. data/lib/cuke_modeler/models/step.rb +32 -3
  26. data/lib/cuke_modeler/models/table.rb +1 -1
  27. data/lib/cuke_modeler/models/tag.rb +1 -1
  28. data/lib/cuke_modeler/named.rb +1 -0
  29. data/lib/cuke_modeler/nested.rb +1 -0
  30. data/lib/cuke_modeler/parsed.rb +1 -0
  31. data/lib/cuke_modeler/parsing.rb +89 -94
  32. data/lib/cuke_modeler/sourceable.rb +1 -0
  33. data/lib/cuke_modeler/stepped.rb +1 -0
  34. data/lib/cuke_modeler/taggable.rb +1 -0
  35. data/lib/cuke_modeler/version.rb +1 -1
  36. data/testing/cucumber/features/analysis/step_comparison.feature +25 -0
  37. data/testing/cucumber/features/analysis/test_comparison.feature +1 -1
  38. metadata +56 -142
  39. data/.gitignore +0 -18
  40. data/.simplecov +0 -7
  41. data/.travis.yml +0 -60
  42. data/Gemfile +0 -36
  43. data/History.md +0 -196
  44. data/Rakefile +0 -63
  45. data/appveyor.yml +0 -61
  46. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -273
  47. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -296
  48. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -308
  49. data/testing/cucumber/step_definitions/action_steps.rb +0 -13
  50. data/testing/cucumber/step_definitions/background_steps.rb +0 -1
  51. data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
  52. data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
  53. data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
  54. data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
  55. data/testing/cucumber/step_definitions/modeling_steps.rb +0 -44
  56. data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
  57. data/testing/cucumber/step_definitions/step_steps.rb +0 -3
  58. data/testing/cucumber/step_definitions/table_steps.rb +0 -1
  59. data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
  60. data/testing/cucumber/step_definitions/verification_steps.rb +0 -173
  61. data/testing/cucumber/support/env.rb +0 -30
  62. data/testing/dialect_helper.rb +0 -48
  63. data/testing/file_helper.rb +0 -47
  64. data/testing/gemfiles/gherkin2.gemfile +0 -32
  65. data/testing/gemfiles/gherkin3.gemfile +0 -26
  66. data/testing/gemfiles/gherkin4.gemfile +0 -27
  67. data/testing/gemfiles/gherkin5.gemfile +0 -27
  68. data/testing/gemfiles/gherkin6.gemfile +0 -10
  69. data/testing/rspec/spec/integration/background_integration_spec.rb +0 -442
  70. data/testing/rspec/spec/integration/cell_integration_spec.rb +0 -335
  71. data/testing/rspec/spec/integration/comment_integration_spec.rb +0 -177
  72. data/testing/rspec/spec/integration/directory_integration_spec.rb +0 -218
  73. data/testing/rspec/spec/integration/doc_string_integration_spec.rb +0 -402
  74. data/testing/rspec/spec/integration/example_integration_spec.rb +0 -741
  75. data/testing/rspec/spec/integration/feature_file_integration_spec.rb +0 -272
  76. data/testing/rspec/spec/integration/feature_integration_spec.rb +0 -650
  77. data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +0 -166
  78. data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +0 -166
  79. data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +0 -165
  80. data/testing/rspec/spec/integration/gherkin_6_adapter_spec.rb +0 -166
  81. data/testing/rspec/spec/integration/model_integration_spec.rb +0 -15
  82. data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
  83. data/testing/rspec/spec/integration/outline_integration_spec.rb +0 -624
  84. data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -122
  85. data/testing/rspec/spec/integration/row_integration_spec.rb +0 -291
  86. data/testing/rspec/spec/integration/scenario_integration_spec.rb +0 -479
  87. data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
  88. data/testing/rspec/spec/integration/step_integration_spec.rb +0 -475
  89. data/testing/rspec/spec/integration/table_integration_spec.rb +0 -337
  90. data/testing/rspec/spec/integration/tag_integration_spec.rb +0 -259
  91. data/testing/rspec/spec/spec_helper.rb +0 -122
  92. data/testing/rspec/spec/unit/background_unit_spec.rb +0 -83
  93. data/testing/rspec/spec/unit/cell_unit_spec.rb +0 -68
  94. data/testing/rspec/spec/unit/comment_unit_spec.rb +0 -68
  95. data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
  96. data/testing/rspec/spec/unit/directory_unit_spec.rb +0 -127
  97. data/testing/rspec/spec/unit/doc_string_unit_spec.rb +0 -100
  98. data/testing/rspec/spec/unit/example_unit_spec.rb +0 -133
  99. data/testing/rspec/spec/unit/feature_file_unit_spec.rb +0 -125
  100. data/testing/rspec/spec/unit/feature_unit_spec.rb +0 -157
  101. data/testing/rspec/spec/unit/model_unit_spec.rb +0 -15
  102. data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
  103. data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
  104. data/testing/rspec/spec/unit/outline_unit_spec.rb +0 -117
  105. data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
  106. data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
  107. data/testing/rspec/spec/unit/row_unit_spec.rb +0 -68
  108. data/testing/rspec/spec/unit/scenario_unit_spec.rb +0 -86
  109. data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
  110. data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -127
  111. data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
  112. data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
  113. data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
  114. data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
  115. data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
  116. data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
  117. data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
  118. data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
  119. data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
  120. data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
  121. data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
  122. data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
  123. data/testing/rspec/spec/unit/step_unit_spec.rb +0 -109
  124. data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
  125. data/testing/rspec/spec/unit/table_unit_spec.rb +0 -77
  126. data/testing/rspec/spec/unit/tag_unit_spec.rb +0 -68
  127. data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
  128. data/testing/test_languages.json +0 -45
  129. data/todo.txt +0 -24
@@ -0,0 +1,12 @@
1
+ require_relative 'gherkin_9_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 10.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
8
+
9
+ class Gherkin10Adapter < Gherkin9Adapter
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative 'gherkin_9_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 11.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
8
+
9
+ class Gherkin11Adapter < Gherkin9Adapter
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative 'gherkin_9_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 12.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
8
+
9
+ class Gherkin12Adapter < Gherkin9Adapter
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative 'gherkin_9_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 13.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
8
+
9
+ class Gherkin13Adapter < Gherkin9Adapter
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require_relative 'gherkin_9_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 14.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
8
+
9
+ class Gherkin14Adapter < Gherkin9Adapter
10
+
11
+ end
12
+ end
@@ -1,8 +1,9 @@
1
1
  module CukeModeler
2
2
 
3
- # An adapter that can convert the output of version 6.x of the *gherkin* gem into input that is consumable by this gem.
3
+ # NOT A PART OF THE PUBLIC API
4
+ # An adapter that can convert the output of version 9.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
4
5
 
5
- class Gherkin6Adapter
6
+ class Gherkin9Adapter
6
7
 
7
8
  # Adapts the given AST into the shape that this gem expects
8
9
  def adapt(parsed_ast)
@@ -10,20 +11,21 @@ module CukeModeler
10
11
  parsed_ast['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_ast))
11
12
 
12
13
  # Removing parsed data for child elements in order to avoid duplicating data
13
- parsed_ast['cuke_modeler_parsing_data'][:feature] = nil
14
- parsed_ast['cuke_modeler_parsing_data'][:comments] = nil
14
+ parsed_ast['cuke_modeler_parsing_data'][:feature] = nil if parsed_ast['cuke_modeler_parsing_data'][:feature]
15
+ parsed_ast['cuke_modeler_parsing_data'][:comments] = nil if parsed_ast['cuke_modeler_parsing_data'][:comments]
15
16
 
16
- # Comments are stored on the feature file in gherkin 4.x
17
17
  parsed_ast['comments'] = []
18
- parsed_ast[:comments].each do |comment|
19
- adapt_comment!(comment)
18
+ if parsed_ast[:comments]
19
+ parsed_ast[:comments].each do |comment|
20
+ adapt_comment!(comment)
21
+ end
22
+ parsed_ast['comments'].concat(parsed_ast.delete(:comments))
20
23
  end
21
- parsed_ast['comments'].concat(parsed_ast.delete(:comments))
22
24
 
23
25
  adapt_feature!(parsed_ast[:feature]) if parsed_ast[:feature]
24
26
  parsed_ast['feature'] = parsed_ast.delete(:feature)
25
27
 
26
- [parsed_ast]
28
+ parsed_ast
27
29
  end
28
30
 
29
31
  # Adapts the AST sub-tree that is rooted at the given feature node.
@@ -32,23 +34,27 @@ module CukeModeler
32
34
  parsed_feature['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_feature))
33
35
 
34
36
  # Removing parsed data for child elements in order to avoid duplicating data
35
- parsed_feature['cuke_modeler_parsing_data'][:tags] = nil
36
- parsed_feature['cuke_modeler_parsing_data'][:children] = nil
37
+ parsed_feature['cuke_modeler_parsing_data'][:tags] = nil if parsed_feature['cuke_modeler_parsing_data'][:tags]
38
+ parsed_feature['cuke_modeler_parsing_data'][:children] = nil if parsed_feature['cuke_modeler_parsing_data'][:children]
37
39
 
38
40
  parsed_feature['keyword'] = parsed_feature.delete(:keyword)
39
41
  parsed_feature['name'] = parsed_feature.delete(:name)
40
- parsed_feature['description'] = parsed_feature.delete(:description)
42
+ parsed_feature['description'] = parsed_feature.delete(:description) || ''
41
43
  parsed_feature['line'] = parsed_feature.delete(:location)[:line]
42
44
 
43
45
  parsed_feature['elements'] = []
44
- adapt_child_elements!(parsed_feature[:children])
45
- parsed_feature['elements'].concat(parsed_feature.delete(:children))
46
+ if parsed_feature[:children]
47
+ adapt_child_elements!(parsed_feature[:children])
48
+ parsed_feature['elements'].concat(parsed_feature.delete(:children))
49
+ end
46
50
 
47
51
  parsed_feature['tags'] = []
48
- parsed_feature[:tags].each do |tag|
49
- adapt_tag!(tag)
52
+ if parsed_feature[:tags]
53
+ parsed_feature[:tags].each do |tag|
54
+ adapt_tag!(tag)
55
+ end
56
+ parsed_feature['tags'].concat(parsed_feature.delete(:tags))
50
57
  end
51
- parsed_feature['tags'].concat(parsed_feature.delete(:tags))
52
58
  end
53
59
 
54
60
  # Adapts the AST sub-tree that is rooted at the given background node.
@@ -57,76 +63,88 @@ module CukeModeler
57
63
  parsed_background['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_background))
58
64
 
59
65
  # Removing parsed data for child elements in order to avoid duplicating data
60
- parsed_background['cuke_modeler_parsing_data'][:background][:steps] = nil
66
+ parsed_background['cuke_modeler_parsing_data'][:background][:steps] = nil if parsed_background['cuke_modeler_parsing_data'][:background][:steps]
61
67
 
62
68
  parsed_background['type'] = 'Background'
63
69
  parsed_background['keyword'] = parsed_background[:background].delete(:keyword)
64
70
  parsed_background['name'] = parsed_background[:background].delete(:name)
65
- parsed_background['description'] = parsed_background[:background].delete(:description)
71
+ parsed_background['description'] = parsed_background[:background].delete(:description) || ''
66
72
  parsed_background['line'] = parsed_background[:background].delete(:location)[:line]
67
73
 
68
74
  parsed_background['steps'] = []
69
- parsed_background[:background][:steps].each do |step|
70
- adapt_step!(step)
75
+ if parsed_background[:background][:steps]
76
+ parsed_background[:background][:steps].each do |step|
77
+ adapt_step!(step)
78
+ end
79
+ parsed_background['steps'].concat(parsed_background[:background].delete(:steps))
71
80
  end
72
- parsed_background['steps'].concat(parsed_background[:background].delete(:steps))
73
81
  end
74
82
 
75
83
  # Adapts the AST sub-tree that is rooted at the given scenario node.
76
84
  def adapt_scenario!(parsed_test)
77
85
  # Removing parsed data for child elements in order to avoid duplicating data
78
- parsed_test['cuke_modeler_parsing_data'][:scenario][:tags] = nil
79
- parsed_test['cuke_modeler_parsing_data'][:scenario][:steps] = nil
86
+ parsed_test['cuke_modeler_parsing_data'][:scenario][:tags] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:tags]
87
+ parsed_test['cuke_modeler_parsing_data'][:scenario][:steps] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:steps]
80
88
 
81
89
  parsed_test['type'] = 'Scenario'
82
90
  parsed_test['keyword'] = parsed_test[:scenario].delete(:keyword)
83
91
  parsed_test['name'] = parsed_test[:scenario].delete(:name)
84
- parsed_test['description'] = parsed_test[:scenario].delete(:description)
92
+ parsed_test['description'] = parsed_test[:scenario].delete(:description) || ''
85
93
  parsed_test['line'] = parsed_test[:scenario].delete(:location)[:line]
86
94
 
87
95
  parsed_test['tags'] = []
88
- parsed_test[:scenario][:tags].each do |tag|
89
- adapt_tag!(tag)
96
+ if parsed_test[:scenario][:tags]
97
+ parsed_test[:scenario][:tags].each do |tag|
98
+ adapt_tag!(tag)
99
+ end
100
+ parsed_test['tags'].concat(parsed_test[:scenario].delete(:tags))
90
101
  end
91
- parsed_test['tags'].concat(parsed_test[:scenario].delete(:tags))
92
102
 
93
103
  parsed_test['steps'] = []
94
- parsed_test[:scenario][:steps].each do |step|
95
- adapt_step!(step)
104
+ if parsed_test[:scenario][:steps]
105
+ parsed_test[:scenario][:steps].each do |step|
106
+ adapt_step!(step)
107
+ end
108
+ parsed_test['steps'].concat(parsed_test[:scenario].delete(:steps))
96
109
  end
97
- parsed_test['steps'].concat(parsed_test[:scenario].delete(:steps))
98
110
  end
99
111
 
100
112
  # Adapts the AST sub-tree that is rooted at the given outline node.
101
113
  def adapt_outline!(parsed_test)
102
114
  # Removing parsed data for child elements in order to avoid duplicating data
103
- parsed_test['cuke_modeler_parsing_data'][:scenario][:tags] = nil
104
- parsed_test['cuke_modeler_parsing_data'][:scenario][:steps] = nil
105
- parsed_test['cuke_modeler_parsing_data'][:scenario][:examples] = nil
115
+ parsed_test['cuke_modeler_parsing_data'][:scenario][:tags] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:tags]
116
+ parsed_test['cuke_modeler_parsing_data'][:scenario][:steps] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:steps]
117
+ parsed_test['cuke_modeler_parsing_data'][:scenario][:examples] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:examples]
106
118
 
107
119
  parsed_test['type'] = 'ScenarioOutline'
108
120
  parsed_test['keyword'] = parsed_test[:scenario].delete(:keyword)
109
121
  parsed_test['name'] = parsed_test[:scenario].delete(:name)
110
- parsed_test['description'] = parsed_test[:scenario].delete(:description)
122
+ parsed_test['description'] = parsed_test[:scenario].delete(:description) || ''
111
123
  parsed_test['line'] = parsed_test[:scenario].delete(:location)[:line]
112
124
 
113
125
  parsed_test['tags'] = []
114
- parsed_test[:scenario][:tags].each do |tag|
115
- adapt_tag!(tag)
126
+ if parsed_test[:scenario][:tags]
127
+ parsed_test[:scenario][:tags].each do |tag|
128
+ adapt_tag!(tag)
129
+ end
130
+ parsed_test['tags'].concat(parsed_test[:scenario].delete(:tags))
116
131
  end
117
- parsed_test['tags'].concat(parsed_test[:scenario].delete(:tags))
118
132
 
119
133
  parsed_test['steps'] = []
120
- parsed_test[:scenario][:steps].each do |step|
121
- adapt_step!(step)
134
+ if parsed_test[:scenario][:steps]
135
+ parsed_test[:scenario][:steps].each do |step|
136
+ adapt_step!(step)
137
+ end
138
+ parsed_test['steps'].concat(parsed_test[:scenario].delete(:steps))
122
139
  end
123
- parsed_test['steps'].concat(parsed_test[:scenario].delete(:steps))
124
140
 
125
141
  parsed_test['examples'] = []
126
- parsed_test[:scenario][:examples].each do |step|
127
- adapt_example!(step)
142
+ if parsed_test[:scenario][:examples]
143
+ parsed_test[:scenario][:examples].each do |step|
144
+ adapt_example!(step)
145
+ end
146
+ parsed_test['examples'].concat(parsed_test[:scenario].delete(:examples))
128
147
  end
129
- parsed_test['examples'].concat(parsed_test[:scenario].delete(:examples))
130
148
  end
131
149
 
132
150
  # Adapts the AST sub-tree that is rooted at the given example node.
@@ -135,14 +153,14 @@ module CukeModeler
135
153
  parsed_example['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_example))
136
154
 
137
155
  # Removing parsed data for child elements in order to avoid duplicating data
138
- parsed_example['cuke_modeler_parsing_data'][:tags] = nil
139
- parsed_example['cuke_modeler_parsing_data'][:table_header] = nil
140
- parsed_example['cuke_modeler_parsing_data'][:table_body] = nil
156
+ parsed_example['cuke_modeler_parsing_data'][:tags] = nil if parsed_example['cuke_modeler_parsing_data'][:tags]
157
+ parsed_example['cuke_modeler_parsing_data'][:table_header] = nil if parsed_example['cuke_modeler_parsing_data'][:table_header]
158
+ parsed_example['cuke_modeler_parsing_data'][:table_body] = nil if parsed_example['cuke_modeler_parsing_data'][:table_body]
141
159
 
142
160
  parsed_example['keyword'] = parsed_example.delete(:keyword)
143
161
  parsed_example['name'] = parsed_example.delete(:name)
144
162
  parsed_example['line'] = parsed_example.delete(:location)[:line]
145
- parsed_example['description'] = parsed_example.delete(:description)
163
+ parsed_example['description'] = parsed_example.delete(:description) || ''
146
164
 
147
165
  parsed_example['rows'] = []
148
166
 
@@ -152,19 +170,19 @@ module CukeModeler
152
170
  end
153
171
 
154
172
  if parsed_example[:table_body]
155
-
156
173
  parsed_example[:table_body].each do |row|
157
174
  adapt_table_row!(row)
158
175
  end
159
176
  parsed_example['rows'].concat(parsed_example.delete(:table_body))
160
177
  end
161
178
 
162
-
163
179
  parsed_example['tags'] = []
164
- parsed_example[:tags].each do |tag|
165
- adapt_tag!(tag)
180
+ if parsed_example[:tags]
181
+ parsed_example[:tags].each do |tag|
182
+ adapt_tag!(tag)
183
+ end
184
+ parsed_example['tags'].concat(parsed_example.delete(:tags))
166
185
  end
167
- parsed_example['tags'].concat(parsed_example.delete(:tags))
168
186
  end
169
187
 
170
188
  # Adapts the AST sub-tree that is rooted at the given tag node.
@@ -191,14 +209,13 @@ module CukeModeler
191
209
  parsed_step['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_step))
192
210
 
193
211
  # Removing parsed data for child elements in order to avoid duplicating data
194
- parsed_step['cuke_modeler_parsing_data'][:data_table] = nil
195
- parsed_step['cuke_modeler_parsing_data'][:doc_string] = nil
212
+ parsed_step['cuke_modeler_parsing_data'][:data_table] = nil if parsed_step['cuke_modeler_parsing_data'][:data_table]
213
+ parsed_step['cuke_modeler_parsing_data'][:doc_string] = nil if parsed_step['cuke_modeler_parsing_data'][:doc_string]
196
214
 
197
215
  parsed_step['keyword'] = parsed_step.delete(:keyword)
198
216
  parsed_step['name'] = parsed_step.delete(:text)
199
217
  parsed_step['line'] = parsed_step.delete(:location)[:line]
200
218
 
201
-
202
219
  case
203
220
  when parsed_step[:doc_string]
204
221
  adapt_doc_string!(parsed_step[:doc_string])
@@ -217,7 +234,7 @@ module CukeModeler
217
234
  parsed_doc_string['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_doc_string))
218
235
 
219
236
  parsed_doc_string['value'] = parsed_doc_string.delete(:content)
220
- parsed_doc_string['content_type'] = parsed_doc_string.delete(:content_type).strip # TODO: fix bug in Gherkin so that this whitespace is already trimmed off
237
+ parsed_doc_string['content_type'] = parsed_doc_string.delete(:media_type)
221
238
  parsed_doc_string['line'] = parsed_doc_string.delete(:location)[:line]
222
239
  end
223
240
 
@@ -245,7 +262,6 @@ module CukeModeler
245
262
  # Removing parsed data for child elements in order to avoid duplicating data which the child elements will themselves include
246
263
  parsed_table_row['cuke_modeler_parsing_data'][:cells] = nil
247
264
 
248
-
249
265
  parsed_table_row['line'] = parsed_table_row.delete(:location)[:line]
250
266
 
251
267
  parsed_table_row['cells'] = []
@@ -269,8 +285,6 @@ module CukeModeler
269
285
 
270
286
 
271
287
  def adapt_child_elements!(parsed_children)
272
- return if parsed_children.empty?
273
-
274
288
  background_child = parsed_children.find { |child| child[:background] }
275
289
 
276
290
  if background_child
@@ -283,8 +297,6 @@ module CukeModeler
283
297
  end
284
298
 
285
299
  def adapt_tests!(parsed_tests)
286
- return unless parsed_tests
287
-
288
300
  parsed_tests.each do |test|
289
301
  adapt_test!(test)
290
302
  end
@@ -294,9 +306,8 @@ module CukeModeler
294
306
  # Saving off the original data
295
307
  parsed_test['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_test))
296
308
 
297
-
298
309
  case
299
- when parsed_test[:scenario] && parsed_test[:scenario][:examples].any?
310
+ when (parsed_test[:scenario] && parsed_test[:scenario][:examples]) || (parsed_test[:scenario] && Parsing.dialects[Parsing.dialect]['scenarioOutline'].include?(parsed_test[:scenario][:keyword]))
300
311
  adapt_outline!(parsed_test)
301
312
  when parsed_test[:scenario]
302
313
  adapt_scenario!(parsed_test)
@@ -1,9 +1,11 @@
1
1
  module CukeModeler
2
2
 
3
+ # NOT A PART OF THE PUBLIC API
3
4
  # A mix-in module containing methods used by models that contain other models.
4
5
 
5
6
  module Containing
6
7
 
8
+ # Executes the given code block with every model that is a child of this model.
7
9
  def each_descendant(&block)
8
10
  children.each do |child_model|
9
11
  block.call(child_model)
@@ -11,6 +13,7 @@ module CukeModeler
11
13
  end
12
14
  end
13
15
 
16
+ # Executes the given code block with this model and every model that is a child of this model.
14
17
  def each_model(&block)
15
18
  block.call(self)
16
19
 
@@ -1,5 +1,6 @@
1
1
  module CukeModeler
2
2
 
3
+ # NOT A PART OF THE PUBLIC API
3
4
  # A mix-in module containing methods used by models that represent an element that has a description.
4
5
 
5
6
  module Described
@@ -64,7 +64,7 @@ module CukeModeler
64
64
 
65
65
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_background.feature')
66
66
 
67
- parsed_file.first['feature']['elements'].first
67
+ parsed_file['feature']['elements'].first
68
68
  end
69
69
 
70
70
  end
@@ -41,7 +41,7 @@ module CukeModeler
41
41
 
42
42
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_cell.feature')
43
43
 
44
- parsed_file.first['feature']['elements'].first['steps'].first['table']['rows'].first['cells'].first
44
+ parsed_file['feature']['elements'].first['steps'].first['table']['rows'].first['cells'].first
45
45
  end
46
46
 
47
47
  end
@@ -40,7 +40,7 @@ module CukeModeler
40
40
 
41
41
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_comment.feature')
42
42
 
43
- parsed_file.first['comments'].last
43
+ parsed_file['comments'].last
44
44
  end
45
45
 
46
46
  end
@@ -82,8 +82,8 @@ module CukeModeler
82
82
  def process_feature_file(file_path)
83
83
  source_text = IO.read(file_path)
84
84
 
85
- feature_file_data = Parsing::parse_text(source_text, file_path).first
86
- feature_file_data = feature_file_data.merge({'path' => file_path})
85
+ feature_file_data = Parsing::parse_text(source_text, file_path)
86
+ feature_file_data = feature_file_data.merge({ 'path' => file_path })
87
87
 
88
88
  feature_file_data
89
89
  end
@@ -45,7 +45,7 @@ module CukeModeler
45
45
 
46
46
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_doc_string.feature')
47
47
 
48
- parsed_file.first['feature']['elements'].first['steps'].first['doc_string']
48
+ parsed_file['feature']['elements'].first['steps'].first['doc_string']
49
49
  end
50
50
 
51
51
  def content_type_output_string
@@ -124,7 +124,7 @@ module CukeModeler
124
124
 
125
125
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_example.feature')
126
126
 
127
- parsed_file.first['feature']['elements'].first['examples'].first
127
+ parsed_file['feature']['elements'].first['examples'].first
128
128
  end
129
129
 
130
130
  def determine_buffer_size(index)