cuke_modeler 1.5.1 → 3.2.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 (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -1
  3. data/LICENSE.txt +1 -1
  4. data/README.md +13 -15
  5. data/cuke_modeler.gemspec +12 -9
  6. data/lib/cuke_modeler.rb +1 -0
  7. data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +12 -0
  8. data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +12 -0
  9. data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +12 -0
  10. data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +12 -0
  11. data/lib/cuke_modeler/adapters/gherkin_14_adapter.rb +12 -0
  12. data/lib/cuke_modeler/adapters/{gherkin_6_adapter.rb → gherkin_9_adapter.rb} +105 -69
  13. data/lib/cuke_modeler/containing.rb +16 -5
  14. data/lib/cuke_modeler/described.rb +1 -0
  15. data/lib/cuke_modeler/models/background.rb +1 -1
  16. data/lib/cuke_modeler/models/cell.rb +1 -1
  17. data/lib/cuke_modeler/models/comment.rb +1 -1
  18. data/lib/cuke_modeler/models/directory.rb +2 -2
  19. data/lib/cuke_modeler/models/doc_string.rb +1 -1
  20. data/lib/cuke_modeler/models/example.rb +1 -1
  21. data/lib/cuke_modeler/models/feature.rb +16 -5
  22. data/lib/cuke_modeler/models/feature_file.rb +2 -2
  23. data/lib/cuke_modeler/models/outline.rb +1 -1
  24. data/lib/cuke_modeler/models/row.rb +1 -1
  25. data/lib/cuke_modeler/models/rule.rb +99 -0
  26. data/lib/cuke_modeler/models/scenario.rb +1 -1
  27. data/lib/cuke_modeler/models/step.rb +32 -3
  28. data/lib/cuke_modeler/models/table.rb +1 -1
  29. data/lib/cuke_modeler/models/tag.rb +1 -1
  30. data/lib/cuke_modeler/named.rb +1 -0
  31. data/lib/cuke_modeler/nested.rb +1 -0
  32. data/lib/cuke_modeler/parsed.rb +1 -0
  33. data/lib/cuke_modeler/parsing.rb +89 -102
  34. data/lib/cuke_modeler/sourceable.rb +1 -0
  35. data/lib/cuke_modeler/stepped.rb +1 -0
  36. data/lib/cuke_modeler/taggable.rb +1 -0
  37. data/lib/cuke_modeler/version.rb +1 -1
  38. data/testing/cucumber/features/analysis/step_comparison.feature +25 -0
  39. data/testing/cucumber/features/analysis/test_comparison.feature +1 -1
  40. data/testing/cucumber/features/modeling/feature_modeling.feature +28 -7
  41. data/testing/cucumber/features/modeling/feature_output.feature +45 -23
  42. data/testing/cucumber/features/modeling/rule_modeling.feature +108 -0
  43. data/testing/cucumber/features/modeling/rule_output.feature +111 -0
  44. metadata +39 -140
  45. data/.gitignore +0 -18
  46. data/.simplecov +0 -7
  47. data/.travis.yml +0 -60
  48. data/Gemfile +0 -37
  49. data/Rakefile +0 -73
  50. data/appveyor.yml +0 -61
  51. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -273
  52. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -296
  53. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -308
  54. data/testing/cucumber/step_definitions/action_steps.rb +0 -13
  55. data/testing/cucumber/step_definitions/background_steps.rb +0 -1
  56. data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
  57. data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
  58. data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
  59. data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
  60. data/testing/cucumber/step_definitions/modeling_steps.rb +0 -44
  61. data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
  62. data/testing/cucumber/step_definitions/step_steps.rb +0 -3
  63. data/testing/cucumber/step_definitions/table_steps.rb +0 -1
  64. data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
  65. data/testing/cucumber/step_definitions/verification_steps.rb +0 -173
  66. data/testing/cucumber/support/env.rb +0 -30
  67. data/testing/dialect_helper.rb +0 -48
  68. data/testing/file_helper.rb +0 -47
  69. data/testing/gemfiles/gherkin2.gemfile +0 -33
  70. data/testing/gemfiles/gherkin3.gemfile +0 -26
  71. data/testing/gemfiles/gherkin4.gemfile +0 -27
  72. data/testing/gemfiles/gherkin5.gemfile +0 -27
  73. data/testing/gemfiles/gherkin6.gemfile +0 -10
  74. data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +0 -166
  75. data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +0 -166
  76. data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +0 -165
  77. data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +0 -166
  78. data/testing/rspec/spec/integration/models/background_integration_spec.rb +0 -442
  79. data/testing/rspec/spec/integration/models/cell_integration_spec.rb +0 -335
  80. data/testing/rspec/spec/integration/models/comment_integration_spec.rb +0 -177
  81. data/testing/rspec/spec/integration/models/directory_integration_spec.rb +0 -218
  82. data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +0 -402
  83. data/testing/rspec/spec/integration/models/example_integration_spec.rb +0 -741
  84. data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +0 -272
  85. data/testing/rspec/spec/integration/models/feature_integration_spec.rb +0 -650
  86. data/testing/rspec/spec/integration/models/model_integration_spec.rb +0 -15
  87. data/testing/rspec/spec/integration/models/outline_integration_spec.rb +0 -624
  88. data/testing/rspec/spec/integration/models/row_integration_spec.rb +0 -291
  89. data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +0 -479
  90. data/testing/rspec/spec/integration/models/step_integration_spec.rb +0 -475
  91. data/testing/rspec/spec/integration/models/table_integration_spec.rb +0 -337
  92. data/testing/rspec/spec/integration/models/tag_integration_spec.rb +0 -259
  93. data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
  94. data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -122
  95. data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
  96. data/testing/rspec/spec/spec_helper.rb +0 -125
  97. data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +0 -25
  98. data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
  99. data/testing/rspec/spec/unit/models/background_unit_spec.rb +0 -83
  100. data/testing/rspec/spec/unit/models/cell_unit_spec.rb +0 -68
  101. data/testing/rspec/spec/unit/models/comment_unit_spec.rb +0 -68
  102. data/testing/rspec/spec/unit/models/directory_unit_spec.rb +0 -127
  103. data/testing/rspec/spec/unit/models/doc_string_unit_spec.rb +0 -100
  104. data/testing/rspec/spec/unit/models/example_unit_spec.rb +0 -133
  105. data/testing/rspec/spec/unit/models/feature_file_unit_spec.rb +0 -125
  106. data/testing/rspec/spec/unit/models/feature_unit_spec.rb +0 -157
  107. data/testing/rspec/spec/unit/models/model_unit_spec.rb +0 -15
  108. data/testing/rspec/spec/unit/models/outline_unit_spec.rb +0 -117
  109. data/testing/rspec/spec/unit/models/row_unit_spec.rb +0 -68
  110. data/testing/rspec/spec/unit/models/scenario_unit_spec.rb +0 -86
  111. data/testing/rspec/spec/unit/models/step_unit_spec.rb +0 -109
  112. data/testing/rspec/spec/unit/models/table_unit_spec.rb +0 -77
  113. data/testing/rspec/spec/unit/models/tag_unit_spec.rb +0 -68
  114. data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
  115. data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
  116. data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
  117. data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
  118. data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
  119. data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -127
  120. data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
  121. data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
  122. data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
  123. data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
  124. data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
  125. data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
  126. data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
  127. data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
  128. data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
  129. data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
  130. data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
  131. data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
  132. data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
  133. data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
  134. data/testing/test_languages.json +0 -45
  135. data/todo.txt +0 -24
@@ -1,308 +0,0 @@
1
- module CukeModeler
2
-
3
- # An adapter that can convert the output of version 4.x and 5.x of the *gherkin* gem into input that is consumable by this gem.
4
-
5
- class Gherkin4Adapter
6
-
7
- # Adapts the given AST into the shape that this gem expects
8
- def adapt(parsed_ast)
9
- # Saving off the original data
10
- parsed_ast['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_ast))
11
-
12
- # 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
15
-
16
- # Comments are stored on the feature file in gherkin 4.x
17
- parsed_ast['comments'] = []
18
- parsed_ast[:comments].each do |comment|
19
- adapt_comment!(comment)
20
- end
21
- parsed_ast['comments'].concat(parsed_ast.delete(:comments))
22
-
23
- adapt_feature!(parsed_ast[:feature]) if parsed_ast[:feature]
24
- parsed_ast['feature'] = parsed_ast.delete(:feature)
25
-
26
- [parsed_ast]
27
- end
28
-
29
- # Adapts the AST sub-tree that is rooted at the given feature node.
30
- def adapt_feature!(parsed_feature)
31
- # Saving off the original data
32
- parsed_feature['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_feature))
33
-
34
- # 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
-
38
- parsed_feature['keyword'] = parsed_feature.delete(:keyword)
39
- parsed_feature['name'] = parsed_feature.delete(:name)
40
- parsed_feature['description'] = parsed_feature.delete(:description) || ''
41
- parsed_feature['line'] = parsed_feature.delete(:location)[:line]
42
-
43
- parsed_feature['elements'] = []
44
- adapt_child_elements!(parsed_feature[:children])
45
- parsed_feature['elements'].concat(parsed_feature.delete(:children))
46
-
47
- parsed_feature['tags'] = []
48
- parsed_feature[:tags].each do |tag|
49
- adapt_tag!(tag)
50
- end
51
- parsed_feature['tags'].concat(parsed_feature.delete(:tags))
52
- end
53
-
54
- # Adapts the AST sub-tree that is rooted at the given background node.
55
- def adapt_background!(parsed_background)
56
- # Saving off the original data
57
- parsed_background['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_background))
58
-
59
- # Removing parsed data for child elements in order to avoid duplicating data
60
- parsed_background['cuke_modeler_parsing_data'][:steps] = nil
61
-
62
- parsed_background['type'] = parsed_background.delete(:type).to_s
63
- parsed_background['keyword'] = parsed_background.delete(:keyword).to_s
64
- parsed_background['name'] = parsed_background.delete(:name)
65
- parsed_background['description'] = parsed_background.delete(:description) || ''
66
- parsed_background['line'] = parsed_background.delete(:location)[:line]
67
-
68
- parsed_background['steps'] = []
69
- parsed_background[:steps].each do |step|
70
- adapt_step!(step)
71
- end
72
- parsed_background['steps'].concat(parsed_background.delete(:steps))
73
- end
74
-
75
- # Adapts the AST sub-tree that is rooted at the given scenario node.
76
- def adapt_scenario!(parsed_test)
77
- # Removing parsed data for child elements in order to avoid duplicating data
78
- parsed_test['cuke_modeler_parsing_data'][:tags] = nil
79
- parsed_test['cuke_modeler_parsing_data'][:steps] = nil
80
-
81
- parsed_test['name'] = parsed_test.delete(:name)
82
- parsed_test['description'] = parsed_test.delete(:description) || ''
83
- parsed_test['line'] = parsed_test.delete(:location)[:line]
84
-
85
- parsed_test['tags'] = []
86
- parsed_test[:tags].each do |tag|
87
- adapt_tag!(tag)
88
- end
89
- parsed_test['tags'].concat(parsed_test.delete(:tags))
90
-
91
- parsed_test['steps'] = []
92
- parsed_test[:steps].each do |step|
93
- adapt_step!(step)
94
- end
95
- parsed_test['steps'].concat(parsed_test.delete(:steps))
96
- end
97
-
98
- # Adapts the AST sub-tree that is rooted at the given outline node.
99
- def adapt_outline!(parsed_test)
100
- # Removing parsed data for child elements in order to avoid duplicating data
101
- parsed_test['cuke_modeler_parsing_data'][:tags] = nil
102
- parsed_test['cuke_modeler_parsing_data'][:steps] = nil
103
- parsed_test['cuke_modeler_parsing_data'][:examples] = nil
104
-
105
- parsed_test['name'] = parsed_test.delete(:name)
106
- parsed_test['description'] = parsed_test.delete(:description) || ''
107
- parsed_test['line'] = parsed_test.delete(:location)[:line]
108
-
109
- parsed_test['tags'] = []
110
- parsed_test[:tags].each do |tag|
111
- adapt_tag!(tag)
112
- end
113
- parsed_test['tags'].concat(parsed_test.delete(:tags))
114
-
115
- parsed_test['steps'] = []
116
- parsed_test[:steps].each do |step|
117
- adapt_step!(step)
118
- end
119
- parsed_test['steps'].concat(parsed_test.delete(:steps))
120
-
121
- parsed_test['examples'] = []
122
- parsed_test[:examples].each do |step|
123
- adapt_example!(step)
124
- end
125
- parsed_test['examples'].concat(parsed_test.delete(:examples))
126
- end
127
-
128
- # Adapts the AST sub-tree that is rooted at the given example node.
129
- def adapt_example!(parsed_example)
130
- # Saving off the original data
131
- parsed_example['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_example))
132
-
133
- # Removing parsed data for child elements in order to avoid duplicating data
134
- parsed_example['cuke_modeler_parsing_data'][:tags] = nil
135
- parsed_example['cuke_modeler_parsing_data'][:tableHeader] = nil
136
- parsed_example['cuke_modeler_parsing_data'][:tableBody] = nil
137
-
138
- parsed_example['keyword'] = parsed_example.delete(:keyword)
139
- parsed_example['name'] = parsed_example.delete(:name)
140
- parsed_example['line'] = parsed_example.delete(:location)[:line]
141
- parsed_example['description'] = parsed_example.delete(:description) || ''
142
-
143
- parsed_example['rows'] = []
144
-
145
- if parsed_example[:tableHeader]
146
- adapt_table_row!(parsed_example[:tableHeader])
147
- parsed_example['rows'] << parsed_example.delete(:tableHeader)
148
- end
149
-
150
- if parsed_example[:tableBody]
151
-
152
- parsed_example[:tableBody].each do |row|
153
- adapt_table_row!(row)
154
- end
155
- parsed_example['rows'].concat(parsed_example.delete(:tableBody))
156
- end
157
-
158
-
159
- parsed_example['tags'] = []
160
- parsed_example[:tags].each do |tag|
161
- adapt_tag!(tag)
162
- end
163
- parsed_example['tags'].concat(parsed_example.delete(:tags))
164
- end
165
-
166
- # Adapts the AST sub-tree that is rooted at the given tag node.
167
- def adapt_tag!(parsed_tag)
168
- # Saving off the original data
169
- parsed_tag['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_tag))
170
-
171
- parsed_tag['name'] = parsed_tag.delete(:name)
172
- parsed_tag['line'] = parsed_tag.delete(:location)[:line]
173
- end
174
-
175
- # Adapts the AST sub-tree that is rooted at the given comment node.
176
- def adapt_comment!(parsed_comment)
177
- # Saving off the original data
178
- parsed_comment['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_comment))
179
-
180
- parsed_comment['text'] = parsed_comment.delete(:text)
181
- parsed_comment['line'] = parsed_comment.delete(:location)[:line]
182
- end
183
-
184
- # Adapts the AST sub-tree that is rooted at the given step node.
185
- def adapt_step!(parsed_step)
186
- # Saving off the original data
187
- parsed_step['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_step))
188
-
189
- # Removing parsed data for child elements in order to avoid duplicating data
190
- parsed_step['cuke_modeler_parsing_data'][:argument] = nil
191
-
192
- parsed_step['keyword'] = parsed_step.delete(:keyword)
193
- parsed_step['name'] = parsed_step.delete(:text)
194
- parsed_step['line'] = parsed_step.delete(:location)[:line]
195
-
196
-
197
- step_argument = parsed_step[:argument]
198
-
199
- if step_argument
200
- case step_argument[:type]
201
- when :DocString
202
- adapt_doc_string!(step_argument)
203
- parsed_step['doc_string'] = parsed_step.delete(:argument)
204
- when :DataTable
205
- adapt_step_table!(step_argument)
206
- parsed_step['table'] = parsed_step.delete(:argument)
207
- else
208
- raise(ArgumentError, "Unknown step argument type: #{step_argument[:type]}")
209
- end
210
- end
211
- end
212
-
213
- # Adapts the AST sub-tree that is rooted at the given doc string node.
214
- def adapt_doc_string!(parsed_doc_string)
215
- # Saving off the original data
216
- parsed_doc_string['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_doc_string))
217
-
218
- parsed_doc_string['value'] = parsed_doc_string.delete(:content)
219
- parsed_doc_string['content_type'] = parsed_doc_string.delete(:contentType)
220
- parsed_doc_string['line'] = parsed_doc_string.delete(:location)[:line]
221
- end
222
-
223
- # Adapts the AST sub-tree that is rooted at the given table node.
224
- def adapt_step_table!(parsed_step_table)
225
- # Saving off the original data
226
- parsed_step_table['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_step_table))
227
-
228
- # Removing parsed data for child elements in order to avoid duplicating data
229
- parsed_step_table['cuke_modeler_parsing_data'][:rows] = nil
230
-
231
- parsed_step_table['rows'] = []
232
- parsed_step_table[:rows].each do |row|
233
- adapt_table_row!(row)
234
- end
235
- parsed_step_table['rows'].concat(parsed_step_table.delete(:rows))
236
- parsed_step_table['line'] = parsed_step_table.delete(:location)[:line]
237
- end
238
-
239
- # Adapts the AST sub-tree that is rooted at the given row node.
240
- def adapt_table_row!(parsed_table_row)
241
- # Saving off the original data
242
- parsed_table_row['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_table_row))
243
-
244
- # Removing parsed data for child elements in order to avoid duplicating data which the child elements will themselves include
245
- parsed_table_row['cuke_modeler_parsing_data'][:cells] = nil
246
-
247
-
248
- parsed_table_row['line'] = parsed_table_row.delete(:location)[:line]
249
-
250
- parsed_table_row['cells'] = []
251
- parsed_table_row[:cells].each do |row|
252
- adapt_table_cell!(row)
253
- end
254
- parsed_table_row['cells'].concat(parsed_table_row.delete(:cells))
255
- end
256
-
257
- # Adapts the AST sub-tree that is rooted at the given cell node.
258
- def adapt_table_cell!(parsed_cell)
259
- # Saving off the original data
260
- parsed_cell['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_cell))
261
-
262
- parsed_cell['value'] = parsed_cell.delete(:value)
263
- parsed_cell['line'] = parsed_cell.delete(:location)[:line]
264
- end
265
-
266
-
267
- private
268
-
269
-
270
- def adapt_child_elements!(parsed_children)
271
- return if parsed_children.empty?
272
-
273
- if parsed_children.first[:type] == :Background
274
- adapt_background!(parsed_children.first)
275
-
276
- remaining_children = parsed_children[1..-1]
277
- end
278
-
279
- adapt_tests!(remaining_children || parsed_children)
280
- end
281
-
282
- def adapt_tests!(parsed_tests)
283
- return unless parsed_tests
284
-
285
- parsed_tests.each do |test|
286
- adapt_test!(test)
287
- end
288
- end
289
-
290
- def adapt_test!(parsed_test)
291
- # Saving off the original data
292
- parsed_test['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_test))
293
-
294
- parsed_test['keyword'] = parsed_test.delete(:keyword)
295
- parsed_test['type'] = parsed_test.delete(:type).to_s
296
-
297
- case parsed_test['type']
298
- when 'Scenario'
299
- adapt_scenario!(parsed_test)
300
- when 'ScenarioOutline'
301
- adapt_outline!(parsed_test)
302
- else
303
- raise(ArgumentError, "Unknown test type: #{parsed_test['type']}")
304
- end
305
- end
306
-
307
- end
308
- end
@@ -1,13 +0,0 @@
1
- When(/^it is outputted$/) do
2
- @output = @model.to_s
3
- end
4
-
5
- When(/^the models are compared$/) do
6
- @results = []
7
-
8
- (@models.count - 1).times do |index|
9
- @results << (@models[index] == @models[index + 1])
10
- end
11
-
12
- @results << (@models.first == @models.last)
13
- end
@@ -1 +0,0 @@
1
- # No steps specific to this type of model
@@ -1,6 +0,0 @@
1
- Given(/^a directory model based on "([^"]*)"$/) do |directory_name|
2
- directory_path = "#{@root_test_directory}/#{directory_name}"
3
- FileUtils.mkdir(directory_path) unless File.exists?(directory_path)
4
-
5
- @model = CukeModeler::Directory.new(directory_path)
6
- end
@@ -1 +0,0 @@
1
- # No steps specific to this type of model
@@ -1,16 +0,0 @@
1
- Given(/^a feature file model based on "([^"]*)"$/) do |file_name|
2
- file_path = "#{@root_test_directory}/#{file_name}"
3
- File.open(file_path, 'w') { |file| file.puts "Feature:" } unless File.exists?(file_path)
4
-
5
- @model = CukeModeler::FeatureFile.new(file_path)
6
- end
7
-
8
- And(/^a feature file model based on that file$/) do |code_text|
9
- code_text = code_text.gsub('<file_path>', "'#{@file_path}'")
10
-
11
- eval(code_text)
12
- end
13
-
14
- And(/^the comment model of that feature file model$/) do |code_text|
15
- eval(code_text)
16
- end
@@ -1,7 +0,0 @@
1
- And(/^the \w+ model of that feature model$/) do |code_text|
2
- eval(code_text)
3
- end
4
-
5
- And(/^the \w+(?: \w+)? model inside of that feature model$/) do |code_text|
6
- eval(code_text)
7
- end
@@ -1,44 +0,0 @@
1
- Given(/^the models provided by CukeModeler/) do
2
- @available_model_classes = Array.new.tap do |classes|
3
- CukeModeler.constants.each do |constant|
4
- if CukeModeler.const_get(constant).is_a?(Class)
5
- classes << CukeModeler.const_get(constant) if CukeModeler.const_get(constant).ancestors.include?(CukeModeler::Model)
6
- end
7
- end
8
- end
9
- end
10
-
11
- When(/^the model is output as a string$/) do |code_text|
12
- @output = eval(code_text)
13
- end
14
-
15
- And(/^a(?:n)? \w+(?: \w+)? model based on that gherkin$/) do |code_text|
16
- code_text = code_text.gsub('<source_text>', "'#{@source_text}'")
17
-
18
- eval(code_text)
19
- end
20
-
21
- Given(/^(?:a|the) (?:directory|feature file) is modeled$/) do |code_text|
22
- code_text = code_text.gsub('<path_to>', @root_test_directory)
23
-
24
- eval(code_text)
25
- end
26
-
27
- When(/^the \w+(?: \w+)?'s \w+(?: \w+)? (?:is|are) requested$/) do |code_text|
28
- @result = eval(code_text)
29
- end
30
-
31
- Given(/^a model for the following background:$/) do |gherkin_text|
32
- @models ||= []
33
- @models << CukeModeler::Background.new(gherkin_text)
34
- end
35
-
36
- Given(/^a model for the following scenario:$/) do |gherkin_text|
37
- @models ||= []
38
- @models << CukeModeler::Scenario.new(gherkin_text)
39
- end
40
-
41
- Given(/^a model for the following outline:$/) do |gherkin_text|
42
- @models ||= []
43
- @models << CukeModeler::Outline.new(gherkin_text)
44
- end
@@ -1,32 +0,0 @@
1
- Given /^(?:a|the) directory "([^"]*)"$/ do |directory_name|
2
- @test_directory = "#{@root_test_directory}/#{directory_name}"
3
-
4
- FileUtils.mkdir(@test_directory) unless File.exists?(@test_directory)
5
- end
6
-
7
- And(/^(?:a|the) file "([^"]*)"$/) do |file_name|
8
- file_path = "#{@root_test_directory}/#{file_name}"
9
-
10
- # Some versions of Gherkin require feature content to be present in feature files
11
- if file_name =~ /\.feature/
12
- File.open(file_path, 'w') { |file|
13
- file.write('Feature:')
14
- }
15
- else
16
- FileUtils.touch(file_path)
17
- end
18
- end
19
-
20
- And(/^the file "([^"]*)":$/) do |file_name, file_text|
21
- file_path = "#{@root_test_directory}/#{file_name}"
22
-
23
- File.open(file_path, 'w') { |file| file.write(file_text) }
24
- end
25
-
26
- Given(/^the following gherkin:$/) do |text|
27
- @source_text = text
28
- end
29
-
30
- Given(/^a feature file with the following gherkin:$/) do |file_text|
31
- @file_path = CukeModeler::FileHelper.create_feature_file(:text => file_text)
32
- end
@@ -1,3 +0,0 @@
1
- Given(/^a step model based on the following gherkin:$/) do |source_text|
2
- @model = CukeModeler::Step.new(source_text)
3
- end
@@ -1 +0,0 @@
1
- # No steps specific to this type of model