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,475 +0,0 @@
1
- require "#{File.dirname(__FILE__)}/../../spec_helper"
2
-
3
-
4
- describe 'Step, Integration' do
5
-
6
- let(:clazz) { CukeModeler::Step }
7
-
8
-
9
- describe 'common behavior' do
10
-
11
- it_should_behave_like 'a model, integration'
12
-
13
- end
14
-
15
- describe 'unique behavior' do
16
-
17
- it 'can be instantiated with the minimum viable Gherkin' do
18
- source = "#{STEP_KEYWORD} a step"
19
-
20
- expect { clazz.new(source) }.to_not raise_error
21
- end
22
-
23
- it 'can parse text that uses a non-default dialect' do
24
- original_dialect = CukeModeler::Parsing.dialect
25
- CukeModeler::Parsing.dialect = 'en-au'
26
-
27
- begin
28
- source_text = "Y'know a step"
29
-
30
- expect { @model = clazz.new(source_text) }.to_not raise_error
31
-
32
- # Sanity check in case modeling failed in a non-explosive manner
33
- expect(@model.keyword).to eq("Y'know")
34
- ensure
35
- # Making sure that our changes don't escape a test and ruin the rest of the suite
36
- CukeModeler::Parsing.dialect = original_dialect
37
- end
38
- end
39
-
40
- it 'provides a descriptive filename when being parsed from stand alone text' do
41
- source = "bad step text\n And a step\n @foo"
42
-
43
- expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_step\.feature'/)
44
- end
45
-
46
- it 'stores the original data generated by the parsing adapter (with a table)', :gherkin6 => true do
47
- step = clazz.new("#{STEP_KEYWORD} test step\n|table|")
48
- data = step.parsing_data
49
-
50
- expect(data.keys).to match_array([:location, :keyword, :text, :data_table, :doc_string])
51
- expect(data[:text]).to eq('test step')
52
- end
53
-
54
- it 'stores the original data generated by the parsing adapter (with a doc string)', :gherkin6 => true do
55
- step = clazz.new("#{STEP_KEYWORD} test step\n\"\"\"\na doc string\n\"\"\"")
56
- data = step.parsing_data
57
-
58
- expect(data.keys).to match_array([:location, :keyword, :text, :data_table, :doc_string])
59
- expect(data[:text]).to eq('test step')
60
- end
61
-
62
- it 'stores the original data generated by the parsing adapter (with a table)', :gherkin4_5 => true do
63
- step = clazz.new("#{STEP_KEYWORD} test step\n|table|")
64
- data = step.parsing_data
65
-
66
- expect(data.keys).to match_array([:type, :location, :keyword, :text, :argument])
67
- expect(data[:type]).to eq(:Step)
68
- end
69
-
70
- it 'stores the original data generated by the parsing adapter (with a doc string)', :gherkin4_5 => true do
71
- step = clazz.new("#{STEP_KEYWORD} test step\n\"\"\"\na doc string\n\"\"\"")
72
- data = step.parsing_data
73
-
74
- expect(data.keys).to match_array([:type, :location, :keyword, :text, :argument])
75
- expect(data[:type]).to eq(:Step)
76
- end
77
-
78
- it 'stores the original data generated by the parsing adapter (with a table)', :gherkin3 => true do
79
- step = clazz.new("#{STEP_KEYWORD} test step\n|table|")
80
- data = step.parsing_data
81
-
82
- expect(data.keys).to match_array([:type, :location, :keyword, :text, :argument])
83
- expect(data[:type]).to eq(:Step)
84
- end
85
-
86
- it 'stores the original data generated by the parsing adapter (with a doc string)', :gherkin3 => true do
87
- step = clazz.new("#{STEP_KEYWORD} test step\n\"\"\"\na doc string\n\"\"\"")
88
- data = step.parsing_data
89
-
90
- expect(data.keys).to match_array([:type, :location, :keyword, :text, :argument])
91
- expect(data[:type]).to eq(:Step)
92
- end
93
-
94
- it 'stores the original data generated by the parsing adapter (with a table)', :gherkin2 => true do
95
- step = clazz.new("#{STEP_KEYWORD} test step\n|table|")
96
- data = step.parsing_data
97
-
98
- expect(data.keys).to match_array(['keyword', 'name', 'line', 'rows'])
99
- expect(data['keyword']).to eq("#{STEP_KEYWORD} ")
100
- end
101
-
102
- it 'stores the original data generated by the parsing adapter (with a doc string)', :gherkin2 => true do
103
- step = clazz.new("#{STEP_KEYWORD} test step\n\"\"\"\na doc string\n\"\"\"")
104
- data = step.parsing_data
105
-
106
- expect(data.keys).to match_array(['keyword', 'name', 'line', 'doc_string'])
107
- expect(data['keyword']).to eq("#{STEP_KEYWORD} ")
108
- end
109
-
110
- describe 'model population' do
111
-
112
- context 'from source text' do
113
-
114
- let(:source_text) { "#{STEP_KEYWORD} a step" }
115
- let(:step) { clazz.new(source_text) }
116
-
117
-
118
- it "models the step's keyword" do
119
- expect(step.keyword).to eq("#{STEP_KEYWORD}")
120
- end
121
-
122
- it "models the step's text" do
123
- expect(step.text).to eq('a step')
124
- end
125
-
126
- it "models the step's source line" do
127
- source_text = "#{FEATURE_KEYWORD}:
128
-
129
- #{SCENARIO_KEYWORD}: foo
130
- #{STEP_KEYWORD} step"
131
- step = CukeModeler::Feature.new(source_text).tests.first.steps.first
132
-
133
- expect(step.source_line).to eq(4)
134
- end
135
-
136
-
137
- context 'with no block' do
138
-
139
- let(:source_text) { "#{STEP_KEYWORD} a step" }
140
- let(:step) { clazz.new(source_text) }
141
-
142
-
143
- it "models the step's block" do
144
- expect(step.block).to be_nil
145
- end
146
-
147
- end
148
-
149
- context 'a step with a table' do
150
-
151
- let(:source_text) { "#{STEP_KEYWORD} a step
152
- | value 1 |
153
- | value 2 |" }
154
- let(:step) { clazz.new(source_text) }
155
-
156
-
157
- it "models the step's table" do
158
- table_cell_values = step.block.rows.collect { |row| row.cells.collect { |cell| cell.value } }
159
-
160
- expect(table_cell_values).to eq([['value 1'], ['value 2']])
161
- end
162
-
163
- end
164
-
165
- context 'a step with a doc string' do
166
-
167
- let(:source_text) { "#{STEP_KEYWORD} a step
168
- \"\"\"
169
- some text
170
- \"\"\"" }
171
- let(:step) { clazz.new(source_text) }
172
-
173
-
174
- it "models the step's doc string" do
175
- doc_string = step.block
176
-
177
- expect(doc_string.content).to eq('some text')
178
- end
179
-
180
- end
181
-
182
- end
183
-
184
- end
185
-
186
-
187
- it 'properly sets its child models' do
188
- source_1 = "#{STEP_KEYWORD} a step
189
- \"\"\"
190
- a doc string
191
- \"\"\""
192
- source_2 = "#{STEP_KEYWORD} a step
193
- | a block|"
194
-
195
- step_1 = clazz.new(source_1)
196
- step_2 = clazz.new(source_2)
197
-
198
-
199
- doc_string = step_1.block
200
- table = step_2.block
201
-
202
- expect(doc_string.parent_model).to equal(step_1)
203
- expect(table.parent_model).to equal(step_2)
204
- end
205
-
206
-
207
- describe 'step comparison' do
208
-
209
- it 'is equal to another Step that has the same text' do
210
- source_1 = "#{STEP_KEYWORD} a step"
211
- source_2 = "#{STEP_KEYWORD} a step"
212
- source_3 = "#{STEP_KEYWORD} a different step"
213
-
214
- step_1 = clazz.new(source_1)
215
- step_2 = clazz.new(source_2)
216
- step_3 = clazz.new(source_3)
217
-
218
-
219
- expect(step_1).to eq(step_2)
220
- expect(step_1).to_not eq(step_3)
221
- end
222
-
223
- it 'ignores steps keywords when comparing steps' do
224
- source_1 = "#{GIVEN_KEYWORD} a step"
225
- source_2 = "#{THEN_KEYWORD} a step"
226
-
227
- step_1 = clazz.new(source_1)
228
- step_2 = clazz.new(source_2)
229
-
230
-
231
- expect(step_1).to eq(step_2)
232
- end
233
-
234
- it 'ignores step tables when comparing steps' do
235
- source_1 = "#{STEP_KEYWORD} a step"
236
- source_2 = "#{STEP_KEYWORD} a step\n|with a table|"
237
-
238
- step_1 = clazz.new(source_1)
239
- step_2 = clazz.new(source_2)
240
-
241
-
242
- expect(step_1).to eq(step_2)
243
- end
244
-
245
- it 'ignores step doc strings when comparing steps' do
246
- source_1 = "#{STEP_KEYWORD} a step"
247
- source_2 = "#{STEP_KEYWORD} a step\n\"\"\"\nwith a doc string\n\"\"\""
248
-
249
-
250
- step_1 = clazz.new(source_1)
251
- step_2 = clazz.new(source_2)
252
-
253
-
254
- expect(step_1).to eq(step_2)
255
- end
256
-
257
- end
258
-
259
-
260
- describe 'getting ancestors' do
261
-
262
- before(:each) do
263
- CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'step_test_file', :directory => test_directory)
264
- end
265
-
266
-
267
- let(:test_directory) { CukeModeler::FileHelper.create_directory }
268
- let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
269
-
270
- #{SCENARIO_KEYWORD}: Test test
271
- #{STEP_KEYWORD} a step:"
272
- }
273
-
274
- let(:directory_model) { CukeModeler::Directory.new(test_directory) }
275
- let(:step_model) { directory_model.feature_files.first.feature.tests.first.steps.first }
276
-
277
-
278
- it 'can get its directory' do
279
- ancestor = step_model.get_ancestor(:directory)
280
-
281
- expect(ancestor).to equal(directory_model)
282
- end
283
-
284
- it 'can get its feature file' do
285
- ancestor = step_model.get_ancestor(:feature_file)
286
-
287
- expect(ancestor).to equal(directory_model.feature_files.first)
288
- end
289
-
290
- it 'can get its feature' do
291
- ancestor = step_model.get_ancestor(:feature)
292
-
293
- expect(ancestor).to equal(directory_model.feature_files.first.feature)
294
- end
295
-
296
-
297
- context 'a step that is part of a scenario' do
298
-
299
- let(:test_directory) { CukeModeler::FileHelper.create_directory }
300
- let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
301
-
302
- #{SCENARIO_KEYWORD}: Test scenario
303
- #{STEP_KEYWORD} a step"
304
- }
305
-
306
- let(:directory_model) { CukeModeler::Directory.new(test_directory) }
307
- let(:step_model) { directory_model.feature_files.first.feature.tests.first.steps.first }
308
-
309
-
310
- it 'can get its scenario' do
311
- ancestor = step_model.get_ancestor(:scenario)
312
-
313
- expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
314
- end
315
-
316
- end
317
-
318
- context 'a step that is part of an outline' do
319
-
320
- let(:test_directory) { CukeModeler::FileHelper.create_directory }
321
- let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
322
-
323
- #{OUTLINE_KEYWORD}: Test outline
324
- #{STEP_KEYWORD} a step
325
- #{EXAMPLE_KEYWORD}:
326
- | param |
327
- | value |"
328
- }
329
-
330
- let(:directory_model) { CukeModeler::Directory.new(test_directory) }
331
- let(:step_model) { directory_model.feature_files.first.feature.tests.first.steps.first }
332
-
333
-
334
- it 'can get its outline' do
335
- ancestor = step_model.get_ancestor(:outline)
336
-
337
- expect(ancestor).to equal(directory_model.feature_files.first.feature.tests.first)
338
- end
339
-
340
- end
341
-
342
- context 'a step that is part of a background' do
343
-
344
- let(:test_directory) { CukeModeler::FileHelper.create_directory }
345
- let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
346
-
347
- #{BACKGROUND_KEYWORD}: Test background
348
- #{STEP_KEYWORD} a step"
349
- }
350
-
351
- let(:directory_model) { CukeModeler::Directory.new(test_directory) }
352
- let(:step_model) { directory_model.feature_files.first.feature.background.steps.first }
353
-
354
-
355
- it 'can get its background' do
356
- ancestor = step_model.get_ancestor(:background)
357
-
358
- expect(ancestor).to equal(directory_model.feature_files.first.feature.background)
359
- end
360
-
361
- end
362
-
363
- it 'returns nil if it does not have the requested type of ancestor' do
364
- ancestor = step_model.get_ancestor(:example)
365
-
366
- expect(ancestor).to be_nil
367
- end
368
-
369
- end
370
-
371
-
372
- describe 'step output' do
373
-
374
- context 'from source text' do
375
-
376
- context 'with no block' do
377
-
378
- let(:source_text) { ["#{STEP_KEYWORD} a step"].join("\n") }
379
- let(:step) { clazz.new(source_text) }
380
-
381
- it 'can output a step' do
382
- step_output = step.to_s.split("\n", -1)
383
-
384
- expect(step_output).to eq(["#{STEP_KEYWORD} a step"])
385
- end
386
-
387
- it 'can be remade from its own output' do
388
- step_output = step.to_s
389
- remade_step_output = clazz.new(step_output).to_s
390
-
391
- expect(remade_step_output).to eq(step_output)
392
- end
393
-
394
- end
395
-
396
- context 'a step with a table' do
397
-
398
- let(:source_text) { ["#{STEP_KEYWORD} a step",
399
- ' | value1 | value2 |',
400
- ' | value3 | value4 |'].join("\n") }
401
- let(:step) { clazz.new(source_text) }
402
-
403
-
404
- it 'can output a step that has a table' do
405
- step_output = step.to_s.split("\n", -1)
406
-
407
- expect(step_output).to eq(["#{STEP_KEYWORD} a step",
408
- ' | value1 | value2 |',
409
- ' | value3 | value4 |'])
410
-
411
- end
412
-
413
- it 'can be remade from its own output' do
414
- step_output = step.to_s
415
- remade_step_output = clazz.new(step_output).to_s
416
-
417
- expect(remade_step_output).to eq(step_output)
418
- end
419
-
420
- end
421
-
422
- context 'a step with a doc string' do
423
-
424
- let(:source_text) { ["#{STEP_KEYWORD} a step",
425
- ' """',
426
- ' some text',
427
- ' """'].join("\n") }
428
- let(:step) { clazz.new(source_text) }
429
-
430
-
431
- it 'can output a step that has a doc string' do
432
- step_output = step.to_s.split("\n", -1)
433
-
434
- expect(step_output).to eq(["#{STEP_KEYWORD} a step",
435
- ' """',
436
- ' some text',
437
- ' """'])
438
- end
439
-
440
- it 'can be remade from its own output' do
441
- step_output = step.to_s
442
- remade_step_output = clazz.new(step_output).to_s
443
-
444
- expect(remade_step_output).to eq(step_output)
445
- end
446
-
447
- end
448
-
449
- end
450
-
451
-
452
- context 'from abstract instantiation' do
453
-
454
- let(:step) { clazz.new }
455
-
456
-
457
- it 'can output a step that has only a table' do
458
- step.block = CukeModeler::Table.new
459
-
460
- expect { step.to_s }.to_not raise_error
461
- end
462
-
463
- it 'can output a step that has only a doc string' do
464
- step.block = CukeModeler::DocString.new
465
-
466
- expect { step.to_s }.to_not raise_error
467
- end
468
-
469
- end
470
-
471
- end
472
-
473
- end
474
-
475
- end