cuke_modeler 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -1
- data/README.md +11 -14
- data/cuke_modeler.gemspec +12 -9
- data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +313 -5
- data/lib/cuke_modeler/models/background.rb +1 -1
- data/lib/cuke_modeler/models/cell.rb +1 -1
- data/lib/cuke_modeler/models/comment.rb +1 -1
- data/lib/cuke_modeler/models/directory.rb +2 -2
- data/lib/cuke_modeler/models/doc_string.rb +1 -1
- data/lib/cuke_modeler/models/example.rb +1 -1
- data/lib/cuke_modeler/models/feature.rb +1 -1
- data/lib/cuke_modeler/models/feature_file.rb +2 -2
- data/lib/cuke_modeler/models/outline.rb +1 -1
- data/lib/cuke_modeler/models/row.rb +1 -1
- data/lib/cuke_modeler/models/scenario.rb +1 -1
- data/lib/cuke_modeler/models/step.rb +1 -1
- data/lib/cuke_modeler/models/table.rb +1 -1
- data/lib/cuke_modeler/models/tag.rb +1 -1
- data/lib/cuke_modeler/parsing.rb +29 -58
- data/lib/cuke_modeler/version.rb +1 -1
- metadata +33 -151
- data/.gitignore +0 -18
- data/.simplecov +0 -7
- data/.travis.yml +0 -81
- data/Gemfile +0 -44
- data/Rakefile +0 -73
- data/appveyor.yml +0 -88
- data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -274
- data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -297
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -309
- data/lib/cuke_modeler/adapters/gherkin_5_adapter.rb +0 -12
- data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +0 -310
- data/lib/cuke_modeler/adapters/gherkin_7_adapter.rb +0 -307
- data/lib/cuke_modeler/adapters/gherkin_8_adapter.rb +0 -12
- data/testing/cucumber/step_definitions/action_steps.rb +0 -13
- data/testing/cucumber/step_definitions/background_steps.rb +0 -1
- data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
- data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
- data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
- data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
- data/testing/cucumber/step_definitions/modeling_steps.rb +0 -49
- data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
- data/testing/cucumber/step_definitions/step_steps.rb +0 -3
- data/testing/cucumber/step_definitions/table_steps.rb +0 -1
- data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
- data/testing/cucumber/step_definitions/verification_steps.rb +0 -181
- data/testing/cucumber/support/env.rb +0 -30
- data/testing/dialect_helper.rb +0 -48
- data/testing/file_helper.rb +0 -47
- data/testing/gemfiles/gherkin2.gemfile +0 -33
- data/testing/gemfiles/gherkin3.gemfile +0 -26
- data/testing/gemfiles/gherkin4.gemfile +0 -27
- data/testing/gemfiles/gherkin5.gemfile +0 -27
- data/testing/gemfiles/gherkin6.gemfile +0 -10
- data/testing/gemfiles/gherkin7.gemfile +0 -9
- data/testing/gemfiles/gherkin8.gemfile +0 -9
- data/testing/gemfiles/gherkin9.gemfile +0 -9
- data/testing/helper_methods.rb +0 -23
- data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +0 -165
- data/testing/rspec/spec/integration/adapters/gherkin_5_adapter_spec.rb +0 -165
- data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +0 -159
- data/testing/rspec/spec/integration/adapters/gherkin_7_adapter_spec.rb +0 -162
- data/testing/rspec/spec/integration/adapters/gherkin_8_adapter_spec.rb +0 -162
- data/testing/rspec/spec/integration/adapters/gherkin_9_adapter_spec.rb +0 -162
- data/testing/rspec/spec/integration/models/background_integration_spec.rb +0 -438
- data/testing/rspec/spec/integration/models/cell_integration_spec.rb +0 -338
- data/testing/rspec/spec/integration/models/comment_integration_spec.rb +0 -180
- data/testing/rspec/spec/integration/models/directory_integration_spec.rb +0 -218
- data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +0 -398
- data/testing/rspec/spec/integration/models/example_integration_spec.rb +0 -753
- data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +0 -276
- data/testing/rspec/spec/integration/models/feature_integration_spec.rb +0 -655
- data/testing/rspec/spec/integration/models/model_integration_spec.rb +0 -15
- data/testing/rspec/spec/integration/models/outline_integration_spec.rb +0 -619
- data/testing/rspec/spec/integration/models/row_integration_spec.rb +0 -303
- data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +0 -475
- data/testing/rspec/spec/integration/models/step_integration_spec.rb +0 -573
- data/testing/rspec/spec/integration/models/table_integration_spec.rb +0 -333
- data/testing/rspec/spec/integration/models/tag_integration_spec.rb +0 -271
- data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -143
- data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
- data/testing/rspec/spec/spec_helper.rb +0 -129
- data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +0 -25
- data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/models/background_unit_spec.rb +0 -83
- data/testing/rspec/spec/unit/models/cell_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/models/comment_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/models/directory_unit_spec.rb +0 -127
- data/testing/rspec/spec/unit/models/doc_string_unit_spec.rb +0 -100
- data/testing/rspec/spec/unit/models/example_unit_spec.rb +0 -133
- data/testing/rspec/spec/unit/models/feature_file_unit_spec.rb +0 -125
- data/testing/rspec/spec/unit/models/feature_unit_spec.rb +0 -157
- data/testing/rspec/spec/unit/models/model_unit_spec.rb +0 -15
- data/testing/rspec/spec/unit/models/outline_unit_spec.rb +0 -117
- data/testing/rspec/spec/unit/models/row_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/models/scenario_unit_spec.rb +0 -86
- data/testing/rspec/spec/unit/models/step_unit_spec.rb +0 -109
- data/testing/rspec/spec/unit/models/table_unit_spec.rb +0 -77
- data/testing/rspec/spec/unit/models/tag_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
- data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
- data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
- data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
- data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -127
- data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
- data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
- data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
- data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
- data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
- data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
- data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
- data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
- data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
- data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
- data/testing/test_languages.json +0 -45
- data/todo.txt +0 -25
@@ -1,619 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../../spec_helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe 'Outline, Integration' do
|
5
|
-
|
6
|
-
let(:clazz) { CukeModeler::Outline }
|
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', :unless => gherkin?(3) do
|
18
|
-
source = "#{OUTLINE_KEYWORD}:"
|
19
|
-
|
20
|
-
expect { clazz.new(source) }.to_not raise_error
|
21
|
-
end
|
22
|
-
|
23
|
-
# gherkin 3.x does not accept incomplete outlines
|
24
|
-
it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(3) do
|
25
|
-
source = "#{OUTLINE_KEYWORD}:
|
26
|
-
#{EXAMPLE_KEYWORD}:
|
27
|
-
| param |
|
28
|
-
| value |"
|
29
|
-
|
30
|
-
expect { clazz.new(source) }.to_not raise_error
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'can parse text that uses a non-default dialect' do
|
34
|
-
original_dialect = CukeModeler::Parsing.dialect
|
35
|
-
CukeModeler::Parsing.dialect = 'en-au'
|
36
|
-
|
37
|
-
begin
|
38
|
-
source_text = "Reckon it's like: Outline name
|
39
|
-
Yeah nah zen
|
40
|
-
You'll wanna:
|
41
|
-
| param |
|
42
|
-
| value |"
|
43
|
-
|
44
|
-
expect { @model = clazz.new(source_text) }.to_not raise_error
|
45
|
-
|
46
|
-
# Sanity check in case modeling failed in a non-explosive manner
|
47
|
-
expect(@model.name).to eq('Outline name')
|
48
|
-
ensure
|
49
|
-
# Making sure that our changes don't escape a test and ruin the rest of the suite
|
50
|
-
CukeModeler::Parsing.dialect = original_dialect
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe 'parsing data' do
|
55
|
-
|
56
|
-
it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
|
57
|
-
outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
|
58
|
-
data = outline.parsing_data
|
59
|
-
|
60
|
-
expect(data.keys).to match_array([:background, :rule, :scenario])
|
61
|
-
expect(data[:scenario][:name]).to eq('test outline')
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
|
65
|
-
outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
|
66
|
-
data = outline.parsing_data
|
67
|
-
|
68
|
-
expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples, :description])
|
69
|
-
expect(data[:type]).to eq(:ScenarioOutline)
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
73
|
-
outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
|
74
|
-
data = outline.parsing_data
|
75
|
-
|
76
|
-
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'examples', 'steps', 'tags'])
|
77
|
-
expect(data['keyword']).to eq('Scenario Outline')
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'provides a descriptive filename when being parsed from stand alone text' do
|
83
|
-
source = "bad outline text \n #{OUTLINE_KEYWORD}:\n #{STEP_KEYWORD} a step\n @foo "
|
84
|
-
|
85
|
-
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_outline\.feature'/)
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'properly sets its child models' do
|
89
|
-
source = "@a_tag
|
90
|
-
#{OUTLINE_KEYWORD}:
|
91
|
-
#{STEP_KEYWORD} a step
|
92
|
-
#{EXAMPLE_KEYWORD}:
|
93
|
-
| param |
|
94
|
-
| value |"
|
95
|
-
|
96
|
-
outline = clazz.new(source)
|
97
|
-
example = outline.examples.first
|
98
|
-
step = outline.steps.first
|
99
|
-
tag = outline.tags.first
|
100
|
-
|
101
|
-
expect(example.parent_model).to equal(outline)
|
102
|
-
expect(step.parent_model).to equal(outline)
|
103
|
-
expect(tag.parent_model).to equal(outline)
|
104
|
-
end
|
105
|
-
|
106
|
-
describe 'getting ancestors' do
|
107
|
-
|
108
|
-
before(:each) do
|
109
|
-
CukeModeler::FileHelper.create_feature_file(:text => source_gherkin, :name => 'outline_test_file', :directory => test_directory)
|
110
|
-
end
|
111
|
-
|
112
|
-
|
113
|
-
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
114
|
-
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
115
|
-
|
116
|
-
#{OUTLINE_KEYWORD}: Test test
|
117
|
-
#{STEP_KEYWORD} a step
|
118
|
-
#{EXAMPLE_KEYWORD}: Test example
|
119
|
-
| a param |
|
120
|
-
| a value |"
|
121
|
-
}
|
122
|
-
|
123
|
-
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
124
|
-
let(:outline_model) { directory_model.feature_files.first.feature.tests.first }
|
125
|
-
|
126
|
-
|
127
|
-
it 'can get its directory' do
|
128
|
-
ancestor = outline_model.get_ancestor(:directory)
|
129
|
-
|
130
|
-
expect(ancestor).to equal(directory_model)
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'can get its feature file' do
|
134
|
-
ancestor = outline_model.get_ancestor(:feature_file)
|
135
|
-
|
136
|
-
expect(ancestor).to equal(directory_model.feature_files.first)
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'can get its feature' do
|
140
|
-
ancestor = outline_model.get_ancestor(:feature)
|
141
|
-
|
142
|
-
expect(ancestor).to equal(directory_model.feature_files.first.feature)
|
143
|
-
end
|
144
|
-
|
145
|
-
it 'returns nil if it does not have the requested type of ancestor' do
|
146
|
-
ancestor = outline_model.get_ancestor(:test)
|
147
|
-
|
148
|
-
expect(ancestor).to be_nil
|
149
|
-
end
|
150
|
-
|
151
|
-
end
|
152
|
-
|
153
|
-
|
154
|
-
describe 'model population' do
|
155
|
-
|
156
|
-
context 'from source text' do
|
157
|
-
|
158
|
-
let(:source_text) { "#{OUTLINE_KEYWORD}:" }
|
159
|
-
let(:outline) { clazz.new(source_text) }
|
160
|
-
|
161
|
-
|
162
|
-
# gherkin 3.x does not accept incomplete outlines
|
163
|
-
it "models the outline's keyword", :unless => gherkin?(3) do
|
164
|
-
expect(outline.keyword).to eq("#{OUTLINE_KEYWORD}")
|
165
|
-
end
|
166
|
-
|
167
|
-
context 'using gherkin 3.x', :if => gherkin?(3) do
|
168
|
-
|
169
|
-
let(:source_text) { "#{OUTLINE_KEYWORD}:\n#{STEP_KEYWORD} step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|" }
|
170
|
-
let(:outline) { clazz.new(source_text) }
|
171
|
-
|
172
|
-
it "models the outline's keyword" do
|
173
|
-
expect(outline.keyword).to eq(OUTLINE_KEYWORD)
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
it "models the outline's source line" do
|
179
|
-
source_text = "#{FEATURE_KEYWORD}:
|
180
|
-
|
181
|
-
#{OUTLINE_KEYWORD}: foo
|
182
|
-
#{STEP_KEYWORD} step
|
183
|
-
#{EXAMPLE_KEYWORD}:
|
184
|
-
| param |
|
185
|
-
| value |"
|
186
|
-
outline = CukeModeler::Feature.new(source_text).tests.first
|
187
|
-
|
188
|
-
expect(outline.source_line).to eq(3)
|
189
|
-
end
|
190
|
-
|
191
|
-
|
192
|
-
context 'a filled outline' do
|
193
|
-
|
194
|
-
let(:source_text) { "@tag1 @tag2 @tag3
|
195
|
-
#{OUTLINE_KEYWORD}: Foo
|
196
|
-
Scenario description.
|
197
|
-
|
198
|
-
Some more.
|
199
|
-
Even more.
|
200
|
-
|
201
|
-
#{STEP_KEYWORD} a <setup> step
|
202
|
-
#{STEP_KEYWORD} an action step
|
203
|
-
#{STEP_KEYWORD} a <verification> step
|
204
|
-
|
205
|
-
#{EXAMPLE_KEYWORD}: example 1
|
206
|
-
| setup | verification |
|
207
|
-
| x | y |
|
208
|
-
#{EXAMPLE_KEYWORD}: example 2
|
209
|
-
| setup | verification |
|
210
|
-
| a | b |" }
|
211
|
-
let(:outline) { clazz.new(source_text) }
|
212
|
-
|
213
|
-
|
214
|
-
it "models the outline's name" do
|
215
|
-
expect(outline.name).to eq('Foo')
|
216
|
-
end
|
217
|
-
|
218
|
-
it "models the outline's description" do
|
219
|
-
description = outline.description.split("\n", -1)
|
220
|
-
|
221
|
-
expect(description).to eq([' Scenario description.',
|
222
|
-
'',
|
223
|
-
'Some more.',
|
224
|
-
' Even more.'])
|
225
|
-
end
|
226
|
-
|
227
|
-
it "models the outline's steps" do
|
228
|
-
step_names = outline.steps.collect { |step| step.text }
|
229
|
-
|
230
|
-
expect(step_names).to eq(['a <setup> step', 'an action step', 'a <verification> step'])
|
231
|
-
end
|
232
|
-
|
233
|
-
it "models the outline's tags" do
|
234
|
-
tag_names = outline.tags.collect { |tag| tag.name }
|
235
|
-
|
236
|
-
expect(tag_names).to eq(['@tag1', '@tag2', '@tag3'])
|
237
|
-
end
|
238
|
-
|
239
|
-
it "models the outline's examples" do
|
240
|
-
example_names = outline.examples.collect { |example| example.name }
|
241
|
-
|
242
|
-
expect(example_names).to eq(['example 1', 'example 2'])
|
243
|
-
end
|
244
|
-
|
245
|
-
end
|
246
|
-
|
247
|
-
|
248
|
-
# gherkin 3.x does not accept incomplete outlines
|
249
|
-
context 'an empty outline', :unless => gherkin?(3) do
|
250
|
-
|
251
|
-
let(:source_text) { "#{OUTLINE_KEYWORD}:" }
|
252
|
-
let(:outline) { clazz.new(source_text) }
|
253
|
-
|
254
|
-
|
255
|
-
it "models the outline's name" do
|
256
|
-
expect(outline.name).to eq('')
|
257
|
-
end
|
258
|
-
|
259
|
-
it "models the outline's description" do
|
260
|
-
expect(outline.description).to eq('')
|
261
|
-
end
|
262
|
-
|
263
|
-
it "models the outline's steps" do
|
264
|
-
expect(outline.steps).to eq([])
|
265
|
-
end
|
266
|
-
|
267
|
-
it "models the outline's tags" do
|
268
|
-
expect(outline.tags).to eq([])
|
269
|
-
end
|
270
|
-
|
271
|
-
it "models the outline's examples" do
|
272
|
-
expect(outline.examples).to eq([])
|
273
|
-
end
|
274
|
-
|
275
|
-
end
|
276
|
-
|
277
|
-
end
|
278
|
-
|
279
|
-
end
|
280
|
-
|
281
|
-
it 'trims whitespace from its source description' do
|
282
|
-
source = ["#{OUTLINE_KEYWORD}:",
|
283
|
-
' ',
|
284
|
-
' description line 1',
|
285
|
-
'',
|
286
|
-
' description line 2',
|
287
|
-
' description line 3 ',
|
288
|
-
'',
|
289
|
-
'',
|
290
|
-
'',
|
291
|
-
" #{STEP_KEYWORD} a step",
|
292
|
-
'',
|
293
|
-
"#{EXAMPLE_KEYWORD}:",
|
294
|
-
'|param|',
|
295
|
-
'|value|']
|
296
|
-
source = source.join("\n")
|
297
|
-
|
298
|
-
outline = clazz.new(source)
|
299
|
-
description = outline.description.split("\n", -1)
|
300
|
-
|
301
|
-
expect(description).to eq([' description line 1',
|
302
|
-
'',
|
303
|
-
'description line 2',
|
304
|
-
' description line 3'])
|
305
|
-
end
|
306
|
-
|
307
|
-
|
308
|
-
describe 'comparison' do
|
309
|
-
|
310
|
-
it 'is equal to a background with the same steps' do
|
311
|
-
source = "#{OUTLINE_KEYWORD}:
|
312
|
-
#{STEP_KEYWORD} step 1
|
313
|
-
#{STEP_KEYWORD} step 2
|
314
|
-
#{EXAMPLE_KEYWORD}:
|
315
|
-
| param |
|
316
|
-
| value |"
|
317
|
-
outline = clazz.new(source)
|
318
|
-
|
319
|
-
source = "#{BACKGROUND_KEYWORD}:
|
320
|
-
#{STEP_KEYWORD} step 1
|
321
|
-
#{STEP_KEYWORD} step 2"
|
322
|
-
background_1 = CukeModeler::Background.new(source)
|
323
|
-
|
324
|
-
source = "#{BACKGROUND_KEYWORD}:
|
325
|
-
#{STEP_KEYWORD} step 2
|
326
|
-
#{STEP_KEYWORD} step 1"
|
327
|
-
background_2 = CukeModeler::Background.new(source)
|
328
|
-
|
329
|
-
|
330
|
-
expect(outline).to eq(background_1)
|
331
|
-
expect(outline).to_not eq(background_2)
|
332
|
-
end
|
333
|
-
|
334
|
-
it 'is equal to a scenario with the same steps' do
|
335
|
-
source = "#{OUTLINE_KEYWORD}:
|
336
|
-
#{STEP_KEYWORD} step 1
|
337
|
-
#{STEP_KEYWORD} step 2
|
338
|
-
#{EXAMPLE_KEYWORD}:
|
339
|
-
| param |
|
340
|
-
| value |"
|
341
|
-
outline = clazz.new(source)
|
342
|
-
|
343
|
-
source = "#{SCENARIO_KEYWORD}:
|
344
|
-
#{STEP_KEYWORD} step 1
|
345
|
-
#{STEP_KEYWORD} step 2"
|
346
|
-
scenario_1 = CukeModeler::Scenario.new(source)
|
347
|
-
|
348
|
-
source = "#{SCENARIO_KEYWORD}:
|
349
|
-
#{STEP_KEYWORD} step 2
|
350
|
-
#{STEP_KEYWORD} step 1"
|
351
|
-
scenario_2 = CukeModeler::Scenario.new(source)
|
352
|
-
|
353
|
-
|
354
|
-
expect(outline).to eq(scenario_1)
|
355
|
-
expect(outline).to_not eq(scenario_2)
|
356
|
-
end
|
357
|
-
|
358
|
-
it 'is equal to an outline with the same steps' do
|
359
|
-
source = "#{OUTLINE_KEYWORD}:
|
360
|
-
#{STEP_KEYWORD} step 1
|
361
|
-
#{STEP_KEYWORD} step 2
|
362
|
-
#{EXAMPLE_KEYWORD}:
|
363
|
-
| param |
|
364
|
-
| value |"
|
365
|
-
outline_1 = clazz.new(source)
|
366
|
-
|
367
|
-
source = "#{OUTLINE_KEYWORD}:
|
368
|
-
#{STEP_KEYWORD} step 1
|
369
|
-
#{STEP_KEYWORD} step 2
|
370
|
-
#{EXAMPLE_KEYWORD}:
|
371
|
-
| param |
|
372
|
-
| value |"
|
373
|
-
outline_2 = clazz.new(source)
|
374
|
-
|
375
|
-
source = "#{OUTLINE_KEYWORD}:
|
376
|
-
#{STEP_KEYWORD} step 2
|
377
|
-
#{STEP_KEYWORD} step 1
|
378
|
-
#{EXAMPLE_KEYWORD}:
|
379
|
-
| param |
|
380
|
-
| value |"
|
381
|
-
outline_3 = clazz.new(source)
|
382
|
-
|
383
|
-
|
384
|
-
expect(outline_1).to eq(outline_2)
|
385
|
-
expect(outline_1).to_not eq(outline_3)
|
386
|
-
end
|
387
|
-
|
388
|
-
end
|
389
|
-
|
390
|
-
|
391
|
-
describe 'outline output' do
|
392
|
-
|
393
|
-
it 'can be remade from its own output' do
|
394
|
-
source = "@tag1 @tag2 @tag3
|
395
|
-
#{OUTLINE_KEYWORD}: An outline with everything it could have
|
396
|
-
|
397
|
-
Some description.
|
398
|
-
Some more description.
|
399
|
-
|
400
|
-
#{STEP_KEYWORD} a step
|
401
|
-
| value |
|
402
|
-
#{STEP_KEYWORD} a <value> step
|
403
|
-
\"\"\"
|
404
|
-
some string
|
405
|
-
\"\"\"
|
406
|
-
|
407
|
-
#{EXAMPLE_KEYWORD}:
|
408
|
-
|
409
|
-
Some description.
|
410
|
-
Some more description.
|
411
|
-
|
412
|
-
| value |
|
413
|
-
| x |
|
414
|
-
|
415
|
-
@example_tag
|
416
|
-
#{EXAMPLE_KEYWORD}:
|
417
|
-
| value |
|
418
|
-
| y |"
|
419
|
-
outline = clazz.new(source)
|
420
|
-
|
421
|
-
outline_output = outline.to_s
|
422
|
-
remade_outline_output = clazz.new(outline_output).to_s
|
423
|
-
|
424
|
-
expect(remade_outline_output).to eq(outline_output)
|
425
|
-
end
|
426
|
-
|
427
|
-
|
428
|
-
context 'from source text' do
|
429
|
-
|
430
|
-
# gherkin 3.x does not accept incomplete outlines
|
431
|
-
it 'can output an empty outline', :unless => gherkin?(3) do
|
432
|
-
source = ["#{OUTLINE_KEYWORD}:"]
|
433
|
-
source = source.join("\n")
|
434
|
-
outline = clazz.new(source)
|
435
|
-
|
436
|
-
outline_output = outline.to_s.split("\n", -1)
|
437
|
-
|
438
|
-
expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:"])
|
439
|
-
end
|
440
|
-
|
441
|
-
# gherkin 3.x does not accept incomplete outlines
|
442
|
-
it 'can output a outline that has a name', :unless => gherkin?(3) do
|
443
|
-
source = ["#{OUTLINE_KEYWORD}: test outline"]
|
444
|
-
source = source.join("\n")
|
445
|
-
outline = clazz.new(source)
|
446
|
-
|
447
|
-
outline_output = outline.to_s.split("\n", -1)
|
448
|
-
|
449
|
-
expect(outline_output).to eq(["#{OUTLINE_KEYWORD}: test outline"])
|
450
|
-
end
|
451
|
-
|
452
|
-
# gherkin 3.x does not accept incomplete outlines
|
453
|
-
it 'can output a outline that has a description', :unless => gherkin?(3) do
|
454
|
-
source = ["#{OUTLINE_KEYWORD}:",
|
455
|
-
'Some description.',
|
456
|
-
'Some more description.']
|
457
|
-
source = source.join("\n")
|
458
|
-
outline = clazz.new(source)
|
459
|
-
|
460
|
-
outline_output = outline.to_s.split("\n", -1)
|
461
|
-
|
462
|
-
expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:",
|
463
|
-
'',
|
464
|
-
'Some description.',
|
465
|
-
'Some more description.'])
|
466
|
-
end
|
467
|
-
|
468
|
-
# gherkin 3.x does not accept incomplete outlines
|
469
|
-
it 'can output a outline that has steps', :unless => gherkin?(3) do
|
470
|
-
source = ["#{OUTLINE_KEYWORD}:",
|
471
|
-
" #{STEP_KEYWORD} a step",
|
472
|
-
' | value |',
|
473
|
-
" #{STEP_KEYWORD} another step",
|
474
|
-
' """',
|
475
|
-
' some string',
|
476
|
-
' """']
|
477
|
-
source = source.join("\n")
|
478
|
-
outline = clazz.new(source)
|
479
|
-
|
480
|
-
outline_output = outline.to_s.split("\n", -1)
|
481
|
-
|
482
|
-
expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:",
|
483
|
-
" #{STEP_KEYWORD} a step",
|
484
|
-
' | value |',
|
485
|
-
" #{STEP_KEYWORD} another step",
|
486
|
-
' """',
|
487
|
-
' some string',
|
488
|
-
' """'])
|
489
|
-
end
|
490
|
-
|
491
|
-
# gherkin 3.x does not accept incomplete outlines
|
492
|
-
it 'can output a outline that has tags', :unless => gherkin?(3) do
|
493
|
-
source = ['@tag1 @tag2',
|
494
|
-
'@tag3',
|
495
|
-
"#{OUTLINE_KEYWORD}:"]
|
496
|
-
source = source.join("\n")
|
497
|
-
outline = clazz.new(source)
|
498
|
-
|
499
|
-
outline_output = outline.to_s.split("\n", -1)
|
500
|
-
|
501
|
-
expect(outline_output).to eq(['@tag1 @tag2 @tag3',
|
502
|
-
"#{OUTLINE_KEYWORD}:"])
|
503
|
-
end
|
504
|
-
|
505
|
-
it 'can output a outline that has examples' do
|
506
|
-
source = ["#{OUTLINE_KEYWORD}:",
|
507
|
-
"#{STEP_KEYWORD} a step",
|
508
|
-
"#{EXAMPLE_KEYWORD}:",
|
509
|
-
'| value |',
|
510
|
-
'| x |',
|
511
|
-
"#{EXAMPLE_KEYWORD}:",
|
512
|
-
'| value |',
|
513
|
-
'| y |']
|
514
|
-
source = source.join("\n")
|
515
|
-
outline = clazz.new(source)
|
516
|
-
|
517
|
-
outline_output = outline.to_s.split("\n", -1)
|
518
|
-
|
519
|
-
expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:",
|
520
|
-
" #{STEP_KEYWORD} a step",
|
521
|
-
'',
|
522
|
-
"#{EXAMPLE_KEYWORD}:",
|
523
|
-
' | value |',
|
524
|
-
' | x |',
|
525
|
-
'',
|
526
|
-
"#{EXAMPLE_KEYWORD}:",
|
527
|
-
' | value |',
|
528
|
-
' | y |'])
|
529
|
-
end
|
530
|
-
|
531
|
-
it 'can output a outline that has everything' do
|
532
|
-
source = ['@tag1 @tag2 @tag3',
|
533
|
-
"#{OUTLINE_KEYWORD}: A outline with everything it could have",
|
534
|
-
'Including a description',
|
535
|
-
'and then some.',
|
536
|
-
"#{STEP_KEYWORD} a step",
|
537
|
-
'|value|',
|
538
|
-
"#{STEP_KEYWORD} another step",
|
539
|
-
'"""',
|
540
|
-
'some string',
|
541
|
-
'"""',
|
542
|
-
'',
|
543
|
-
"#{EXAMPLE_KEYWORD}:",
|
544
|
-
'',
|
545
|
-
'Some description.',
|
546
|
-
'Some more description.',
|
547
|
-
'',
|
548
|
-
'| value |',
|
549
|
-
'| x |',
|
550
|
-
'',
|
551
|
-
'@example_tag',
|
552
|
-
"#{EXAMPLE_KEYWORD}:",
|
553
|
-
'| value |',
|
554
|
-
'| y |']
|
555
|
-
source = source.join("\n")
|
556
|
-
outline = clazz.new(source)
|
557
|
-
|
558
|
-
outline_output = outline.to_s.split("\n", -1)
|
559
|
-
|
560
|
-
expect(outline_output).to eq(['@tag1 @tag2 @tag3',
|
561
|
-
"#{OUTLINE_KEYWORD}: A outline with everything it could have",
|
562
|
-
'',
|
563
|
-
'Including a description',
|
564
|
-
'and then some.',
|
565
|
-
'',
|
566
|
-
" #{STEP_KEYWORD} a step",
|
567
|
-
' | value |',
|
568
|
-
" #{STEP_KEYWORD} another step",
|
569
|
-
' """',
|
570
|
-
' some string',
|
571
|
-
' """',
|
572
|
-
'',
|
573
|
-
"#{EXAMPLE_KEYWORD}:",
|
574
|
-
'',
|
575
|
-
'Some description.',
|
576
|
-
'Some more description.',
|
577
|
-
'',
|
578
|
-
' | value |',
|
579
|
-
' | x |',
|
580
|
-
'',
|
581
|
-
'@example_tag',
|
582
|
-
"#{EXAMPLE_KEYWORD}:",
|
583
|
-
' | value |',
|
584
|
-
' | y |'])
|
585
|
-
end
|
586
|
-
|
587
|
-
end
|
588
|
-
|
589
|
-
|
590
|
-
context 'from abstract instantiation' do
|
591
|
-
|
592
|
-
let(:outline) { clazz.new }
|
593
|
-
|
594
|
-
|
595
|
-
it 'can output an outline that has only tags' do
|
596
|
-
outline.tags = [CukeModeler::Tag.new]
|
597
|
-
|
598
|
-
expect { outline.to_s }.to_not raise_error
|
599
|
-
end
|
600
|
-
|
601
|
-
it 'can output an outline that has only steps' do
|
602
|
-
outline.steps = [CukeModeler::Step.new]
|
603
|
-
|
604
|
-
expect { outline.to_s }.to_not raise_error
|
605
|
-
end
|
606
|
-
|
607
|
-
it 'can output an outline that has only examples' do
|
608
|
-
outline.examples = [CukeModeler::Example.new]
|
609
|
-
|
610
|
-
expect { outline.to_s }.to_not raise_error
|
611
|
-
end
|
612
|
-
|
613
|
-
end
|
614
|
-
|
615
|
-
end
|
616
|
-
|
617
|
-
end
|
618
|
-
|
619
|
-
end
|