cuke_modeler 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +12 -0
- data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +5 -5
- data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +8 -5
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +8 -5
- data/lib/cuke_modeler/containing.rb +12 -7
- data/lib/cuke_modeler/models/background.rb +7 -2
- data/lib/cuke_modeler/models/cell.rb +2 -1
- data/lib/cuke_modeler/models/doc_string.rb +2 -1
- data/lib/cuke_modeler/models/example.rb +8 -4
- data/lib/cuke_modeler/models/feature.rb +4 -1
- data/lib/cuke_modeler/models/outline.rb +6 -2
- data/lib/cuke_modeler/models/row.rb +2 -1
- data/lib/cuke_modeler/models/scenario.rb +7 -2
- data/lib/cuke_modeler/models/step.rb +2 -1
- data/lib/cuke_modeler/models/table.rb +2 -1
- data/lib/cuke_modeler/models/tag.rb +2 -1
- data/lib/cuke_modeler/parsing.rb +45 -0
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/features/modeling/background_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/background_output.feature +6 -1
- data/testing/cucumber/features/modeling/directory_output.feature +6 -1
- data/testing/cucumber/features/modeling/doc_string_output.feature +6 -1
- data/testing/cucumber/features/modeling/example_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/example_output.feature +6 -1
- data/testing/cucumber/features/modeling/feature_file_output.feature +6 -1
- data/testing/cucumber/features/modeling/feature_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/feature_output.feature +6 -1
- data/testing/cucumber/features/modeling/model_output.feature +1 -8
- data/testing/cucumber/features/modeling/outline_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/outline_output.feature +6 -1
- data/testing/cucumber/features/modeling/row_output.feature +6 -1
- data/testing/cucumber/features/modeling/scenario_modeling.feature +7 -0
- data/testing/cucumber/features/modeling/scenario_output.feature +6 -1
- data/testing/cucumber/features/modeling/step_output.feature +6 -1
- data/testing/cucumber/features/modeling/table_output.feature +6 -1
- data/testing/cucumber/features/modeling/tag_output.feature +6 -1
- data/testing/cucumber/step_definitions/verification_steps.rb +21 -12
- data/testing/dialect_helper.rb +48 -0
- data/testing/rspec/spec/integration/background_integration_spec.rb +93 -88
- data/testing/rspec/spec/integration/cell_integration_spec.rb +26 -27
- data/testing/rspec/spec/integration/directory_integration_spec.rb +4 -4
- data/testing/rspec/spec/integration/doc_string_integration_spec.rb +38 -39
- data/testing/rspec/spec/integration/example_integration_spec.rb +97 -95
- data/testing/rspec/spec/integration/feature_file_integration_spec.rb +5 -5
- data/testing/rspec/spec/integration/feature_integration_spec.rb +157 -155
- data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +17 -17
- data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +17 -17
- data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +17 -17
- data/testing/rspec/spec/integration/outline_integration_spec.rb +359 -354
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +30 -2
- data/testing/rspec/spec/integration/row_integration_spec.rb +23 -25
- data/testing/rspec/spec/integration/scenario_integration_spec.rb +238 -235
- data/testing/rspec/spec/integration/step_integration_spec.rb +69 -64
- data/testing/rspec/spec/integration/table_integration_spec.rb +32 -36
- data/testing/rspec/spec/integration/tag_integration_spec.rb +26 -27
- data/testing/rspec/spec/spec_helper.rb +43 -0
- data/testing/rspec/spec/unit/background_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/example_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/feature_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/outline_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/parsing_unit_spec.rb +33 -0
- data/testing/rspec/spec/unit/scenario_unit_spec.rb +7 -0
- data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +58 -0
- data/testing/rspec/spec/unit/step_unit_spec.rb +1 -23
- data/testing/test_languages.json +45 -0
- data/todo.txt +1 -1
- metadata +6 -3
@@ -3,54 +3,54 @@ require "#{File.dirname(__FILE__)}/../spec_helper"
|
|
3
3
|
|
4
4
|
describe 'Gherkin2Adapter, Integration', :gherkin2 => true do
|
5
5
|
|
6
|
-
let(:source_text) {
|
7
|
-
|
6
|
+
let(:source_text) { "@tag1 @tag2 @tag3
|
7
|
+
#{@feature_keyword}: A feature with everything it could have
|
8
8
|
|
9
9
|
Including a description
|
10
10
|
and then some.
|
11
11
|
|
12
|
-
|
12
|
+
#{@background_keyword}:
|
13
13
|
|
14
14
|
Background
|
15
15
|
description
|
16
16
|
|
17
|
-
|
17
|
+
#{@step_keyword} a step
|
18
18
|
| value1 |
|
19
|
-
|
19
|
+
#{@step_keyword} another step
|
20
20
|
|
21
21
|
@scenario_tag
|
22
|
-
|
22
|
+
#{@scenario_keyword}:
|
23
23
|
|
24
24
|
Scenario
|
25
25
|
description
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
"""
|
27
|
+
#{@step_keyword} a step
|
28
|
+
#{@step_keyword} another step
|
29
|
+
\"\"\"
|
30
30
|
some text
|
31
|
-
"""
|
31
|
+
\"\"\"
|
32
32
|
|
33
33
|
@outline_tag
|
34
|
-
|
34
|
+
#{@outline_keyword}:
|
35
35
|
|
36
36
|
Outline
|
37
37
|
description
|
38
38
|
|
39
|
-
|
39
|
+
#{@step_keyword} a step
|
40
40
|
| value2 |
|
41
|
-
|
42
|
-
"""
|
41
|
+
#{@step_keyword} another step
|
42
|
+
\"\"\"
|
43
43
|
some text
|
44
|
-
"""
|
44
|
+
\"\"\"
|
45
45
|
|
46
46
|
@example_tag
|
47
|
-
|
47
|
+
#{@example_keyword}:
|
48
48
|
|
49
49
|
Example
|
50
50
|
description
|
51
51
|
|
52
52
|
| param |
|
53
|
-
| value |
|
53
|
+
| value |" }
|
54
54
|
let(:feature) { CukeModeler::Feature.new(source_text) }
|
55
55
|
|
56
56
|
|
@@ -3,54 +3,54 @@ require "#{File.dirname(__FILE__)}/../spec_helper"
|
|
3
3
|
|
4
4
|
describe 'Gherkin3Adapter, Integration', :gherkin3 => true do
|
5
5
|
|
6
|
-
let(:source_text) {
|
7
|
-
|
6
|
+
let(:source_text) { "@tag1 @tag2 @tag3
|
7
|
+
#{@feature_keyword}: A feature with everything it could have
|
8
8
|
|
9
9
|
Including a description
|
10
10
|
and then some.
|
11
11
|
|
12
|
-
|
12
|
+
#{@background_keyword}:
|
13
13
|
|
14
14
|
Background
|
15
15
|
description
|
16
16
|
|
17
|
-
|
17
|
+
#{@step_keyword} a step
|
18
18
|
| value1 |
|
19
|
-
|
19
|
+
#{@step_keyword} another step
|
20
20
|
|
21
21
|
@scenario_tag
|
22
|
-
|
22
|
+
#{@scenario_keyword}:
|
23
23
|
|
24
24
|
Scenario
|
25
25
|
description
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
"""
|
27
|
+
#{@step_keyword} a step
|
28
|
+
#{@step_keyword} another step
|
29
|
+
\"\"\"
|
30
30
|
some text
|
31
|
-
"""
|
31
|
+
\"\"\"
|
32
32
|
|
33
33
|
@outline_tag
|
34
|
-
|
34
|
+
#{@outline_keyword}:
|
35
35
|
|
36
36
|
Outline
|
37
37
|
description
|
38
38
|
|
39
|
-
|
39
|
+
#{@step_keyword} a step
|
40
40
|
| value2 |
|
41
|
-
|
42
|
-
"""
|
41
|
+
#{@step_keyword} another step
|
42
|
+
\"\"\"
|
43
43
|
some text
|
44
|
-
"""
|
44
|
+
\"\"\"
|
45
45
|
|
46
46
|
@example_tag
|
47
|
-
|
47
|
+
#{@example_keyword}:
|
48
48
|
|
49
49
|
Example
|
50
50
|
description
|
51
51
|
|
52
52
|
| param |
|
53
|
-
| value |
|
53
|
+
| value |" }
|
54
54
|
let(:feature) { CukeModeler::Feature.new(source_text) }
|
55
55
|
|
56
56
|
|
@@ -3,54 +3,54 @@ require "#{File.dirname(__FILE__)}/../spec_helper"
|
|
3
3
|
|
4
4
|
describe 'Gherkin4Adapter, Integration', :gherkin4 => true do
|
5
5
|
|
6
|
-
let(:source_text) {
|
7
|
-
|
6
|
+
let(:source_text) { "@tag1 @tag2 @tag3
|
7
|
+
#{@feature_keyword}: A feature with everything it could have
|
8
8
|
|
9
9
|
Including a description
|
10
10
|
and then some.
|
11
11
|
|
12
|
-
|
12
|
+
#{@background_keyword}:
|
13
13
|
|
14
14
|
Background
|
15
15
|
description
|
16
16
|
|
17
|
-
|
17
|
+
#{@step_keyword} a step
|
18
18
|
| value1 |
|
19
|
-
|
19
|
+
#{@step_keyword} another step
|
20
20
|
|
21
21
|
@scenario_tag
|
22
|
-
|
22
|
+
#{@scenario_keyword}:
|
23
23
|
|
24
24
|
Scenario
|
25
25
|
description
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
"""
|
27
|
+
#{@step_keyword} a step
|
28
|
+
#{@step_keyword} another step
|
29
|
+
\"\"\"
|
30
30
|
some text
|
31
|
-
"""
|
31
|
+
\"\"\"
|
32
32
|
|
33
33
|
@outline_tag
|
34
|
-
|
34
|
+
#{@outline_keyword}:
|
35
35
|
|
36
36
|
Outline
|
37
37
|
description
|
38
38
|
|
39
|
-
|
39
|
+
#{@step_keyword} a step
|
40
40
|
| value2 |
|
41
|
-
|
42
|
-
"""
|
41
|
+
#{@step_keyword} another step
|
42
|
+
\"\"\"
|
43
43
|
some text
|
44
|
-
"""
|
44
|
+
\"\"\"
|
45
45
|
|
46
46
|
@example_tag
|
47
|
-
|
47
|
+
#{@example_keyword}:
|
48
48
|
|
49
49
|
Example
|
50
50
|
description
|
51
51
|
|
52
52
|
| param |
|
53
|
-
| value |
|
53
|
+
| value |" }
|
54
54
|
let(:feature) { CukeModeler::Feature.new(source_text) }
|
55
55
|
|
56
56
|
|
@@ -15,21 +15,21 @@ describe 'Outline, Integration' do
|
|
15
15
|
describe 'unique behavior' do
|
16
16
|
|
17
17
|
it 'can be instantiated with the minimum viable Gherkin', :gherkin4 => true do
|
18
|
-
source = "
|
18
|
+
source = "#{@outline_keyword}:"
|
19
19
|
|
20
20
|
expect { clazz.new(source) }.to_not raise_error
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'can be instantiated with the minimum viable Gherkin', :gherkin2 => true do
|
24
|
-
source = "
|
24
|
+
source = "#{@outline_keyword}:"
|
25
25
|
|
26
26
|
expect { clazz.new(source) }.to_not raise_error
|
27
27
|
end
|
28
28
|
|
29
29
|
# gherkin 3.x does not accept incomplete outlines
|
30
30
|
it 'can be instantiated with the minimum viable Gherkin', :gherkin3 => true do
|
31
|
-
source = "
|
32
|
-
|
31
|
+
source = "#{@outline_keyword}:
|
32
|
+
#{@example_keyword}:
|
33
33
|
| param |
|
34
34
|
| value |"
|
35
35
|
|
@@ -37,7 +37,7 @@ describe 'Outline, Integration' do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
|
40
|
-
outline = clazz.new("@tag\
|
40
|
+
outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
|
41
41
|
data = outline.parsing_data
|
42
42
|
|
43
43
|
expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples, :description])
|
@@ -45,7 +45,7 @@ describe 'Outline, Integration' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
48
|
-
outline = clazz.new("@tag\
|
48
|
+
outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
|
49
49
|
data = outline.parsing_data
|
50
50
|
|
51
51
|
expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples, :description])
|
@@ -53,7 +53,7 @@ describe 'Outline, Integration' do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
56
|
-
outline = clazz.new("@tag\
|
56
|
+
outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
|
57
57
|
data = outline.parsing_data
|
58
58
|
|
59
59
|
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'examples', 'steps', 'tags'])
|
@@ -61,19 +61,18 @@ describe 'Outline, Integration' do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'provides a descriptive filename when being parsed from stand alone text' do
|
64
|
-
source = "bad outline text \n
|
64
|
+
source = "bad outline text \n #{@outline_keyword}:\n #{@step_keyword} a step\n @foo "
|
65
65
|
|
66
66
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_outline\.feature'/)
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'properly sets its child models' do
|
70
|
-
source =
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
source = source.join("\n")
|
70
|
+
source = "@a_tag
|
71
|
+
#{@outline_keyword}:
|
72
|
+
#{@step_keyword} a step
|
73
|
+
#{@example_keyword}:
|
74
|
+
| param |
|
75
|
+
| value |"
|
77
76
|
|
78
77
|
outline = clazz.new(source)
|
79
78
|
example = outline.examples.first
|
@@ -85,18 +84,16 @@ describe 'Outline, Integration' do
|
|
85
84
|
expect(tag.parent_model).to equal(outline)
|
86
85
|
end
|
87
86
|
|
88
|
-
|
89
87
|
describe 'getting ancestors' do
|
90
88
|
|
91
89
|
before(:each) do
|
92
|
-
source =
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
source = source.join("\n")
|
90
|
+
source = "#{@feature_keyword}: Test feature
|
91
|
+
|
92
|
+
#{@outline_keyword}: Test test
|
93
|
+
#{@step_keyword} a step
|
94
|
+
#{@example_keyword}: Test example
|
95
|
+
| a param |
|
96
|
+
| a value |"
|
100
97
|
|
101
98
|
file_path = "#{@default_file_directory}/outline_test_file.feature"
|
102
99
|
File.open(file_path, 'w') { |file| file.write(source) }
|
@@ -130,447 +127,455 @@ describe 'Outline, Integration' do
|
|
130
127
|
expect(ancestor).to be_nil
|
131
128
|
end
|
132
129
|
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
describe 'model population' do
|
133
134
|
|
134
|
-
|
135
|
+
context 'from source text' do
|
135
136
|
|
136
|
-
|
137
|
+
let(:source_text) { "#{@outline_keyword}:" }
|
138
|
+
let(:outline) { clazz.new(source_text) }
|
137
139
|
|
138
|
-
it "models the outline's source line" do
|
139
|
-
source_text = 'Feature:
|
140
140
|
|
141
|
-
|
142
|
-
|
143
|
-
|
141
|
+
# gherkin 3.x does not accept incomplete outlines
|
142
|
+
it "models the outline's keyword", :gherkin3 => false do
|
143
|
+
expect(outline.keyword).to eq("#{@outline_keyword}")
|
144
|
+
end
|
145
|
+
|
146
|
+
it "models the outline's source line" do
|
147
|
+
source_text = "#{@feature_keyword}:
|
148
|
+
|
149
|
+
#{@outline_keyword}: foo
|
150
|
+
#{@step_keyword} step
|
151
|
+
#{@example_keyword}:
|
144
152
|
| param |
|
145
|
-
| value |
|
146
|
-
|
153
|
+
| value |"
|
154
|
+
outline = CukeModeler::Feature.new(source_text).tests.first
|
147
155
|
|
148
|
-
|
149
|
-
|
156
|
+
expect(outline.source_line).to eq(3)
|
157
|
+
end
|
150
158
|
|
151
159
|
|
152
|
-
|
160
|
+
context 'a filled outline' do
|
153
161
|
|
154
|
-
|
155
|
-
|
162
|
+
let(:source_text) { "@tag1 @tag2 @tag3
|
163
|
+
#{@outline_keyword}: Foo
|
156
164
|
Scenario description.
|
157
165
|
|
158
166
|
Some more.
|
159
167
|
Even more.
|
160
168
|
|
161
|
-
|
162
|
-
|
163
|
-
|
169
|
+
#{@step_keyword} a <setup> step
|
170
|
+
#{@step_keyword} an action step
|
171
|
+
#{@step_keyword} a <verification> step
|
164
172
|
|
165
|
-
|
173
|
+
#{@example_keyword}: example 1
|
166
174
|
| setup | verification |
|
167
175
|
| x | y |
|
168
|
-
|
176
|
+
#{@example_keyword}: example 2
|
169
177
|
| setup | verification |
|
170
|
-
| a | b |
|
171
|
-
|
172
|
-
|
178
|
+
| a | b |" }
|
179
|
+
let(:outline) { clazz.new(source_text) }
|
173
180
|
|
174
|
-
it "models the outline's name" do
|
175
|
-
expect(outline.name).to eq('Foo')
|
176
|
-
end
|
177
181
|
|
178
|
-
|
179
|
-
|
182
|
+
it "models the outline's name" do
|
183
|
+
expect(outline.name).to eq('Foo')
|
184
|
+
end
|
180
185
|
|
181
|
-
|
182
|
-
|
183
|
-
'Some more.',
|
184
|
-
' Even more.'])
|
185
|
-
end
|
186
|
+
it "models the outline's description" do
|
187
|
+
description = outline.description.split("\n", -1)
|
186
188
|
|
187
|
-
|
188
|
-
|
189
|
+
expect(description).to eq([' Scenario description.',
|
190
|
+
'',
|
191
|
+
'Some more.',
|
192
|
+
' Even more.'])
|
193
|
+
end
|
189
194
|
|
190
|
-
|
191
|
-
|
195
|
+
it "models the outline's steps" do
|
196
|
+
step_names = outline.steps.collect { |step| step.text }
|
192
197
|
|
193
|
-
|
194
|
-
|
198
|
+
expect(step_names).to eq(['a <setup> step', 'an action step', 'a <verification> step'])
|
199
|
+
end
|
195
200
|
|
196
|
-
|
197
|
-
|
201
|
+
it "models the outline's tags" do
|
202
|
+
tag_names = outline.tags.collect { |tag| tag.name }
|
198
203
|
|
199
|
-
|
200
|
-
|
204
|
+
expect(tag_names).to eq(['@tag1', '@tag2', '@tag3'])
|
205
|
+
end
|
201
206
|
|
202
|
-
|
203
|
-
|
207
|
+
it "models the outline's examples" do
|
208
|
+
example_names = outline.examples.collect { |example| example.name }
|
204
209
|
|
210
|
+
expect(example_names).to eq(['example 1', 'example 2'])
|
205
211
|
end
|
206
212
|
|
213
|
+
end
|
207
214
|
|
208
|
-
# gherkin 3.x does not accept incomplete outlines
|
209
|
-
context 'an empty outline', :gherkin3 => false do
|
210
215
|
|
211
|
-
|
212
|
-
|
216
|
+
# gherkin 3.x does not accept incomplete outlines
|
217
|
+
context 'an empty outline', :gherkin3 => false do
|
213
218
|
|
219
|
+
let(:source_text) { "#{@outline_keyword}:" }
|
220
|
+
let(:outline) { clazz.new(source_text) }
|
214
221
|
|
215
|
-
it "models the outline's name" do
|
216
|
-
expect(outline.name).to eq('')
|
217
|
-
end
|
218
222
|
|
219
|
-
|
220
|
-
|
221
|
-
|
223
|
+
it "models the outline's name" do
|
224
|
+
expect(outline.name).to eq('')
|
225
|
+
end
|
222
226
|
|
223
|
-
|
224
|
-
|
225
|
-
|
227
|
+
it "models the outline's description" do
|
228
|
+
expect(outline.description).to eq('')
|
229
|
+
end
|
226
230
|
|
227
|
-
|
228
|
-
|
229
|
-
|
231
|
+
it "models the outline's steps" do
|
232
|
+
expect(outline.steps).to eq([])
|
233
|
+
end
|
230
234
|
|
231
|
-
|
232
|
-
|
233
|
-
|
235
|
+
it "models the outline's tags" do
|
236
|
+
expect(outline.tags).to eq([])
|
237
|
+
end
|
234
238
|
|
239
|
+
it "models the outline's examples" do
|
240
|
+
expect(outline.examples).to eq([])
|
235
241
|
end
|
236
242
|
|
237
243
|
end
|
238
244
|
|
239
|
-
|
240
|
-
source = ['Scenario Outline:',
|
241
|
-
' ',
|
242
|
-
' description line 1',
|
243
|
-
'',
|
244
|
-
' description line 2',
|
245
|
-
' description line 3 ',
|
246
|
-
'',
|
247
|
-
'',
|
248
|
-
'',
|
249
|
-
' * a step',
|
250
|
-
'',
|
251
|
-
'Examples:',
|
252
|
-
'|param|',
|
253
|
-
'|value|']
|
254
|
-
source = source.join("\n")
|
245
|
+
end
|
255
246
|
|
256
|
-
|
257
|
-
description = outline.description.split("\n")
|
247
|
+
end
|
258
248
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
249
|
+
it 'trims whitespace from its source description' do
|
250
|
+
source = ["#{@outline_keyword}:",
|
251
|
+
' ',
|
252
|
+
' description line 1',
|
253
|
+
'',
|
254
|
+
' description line 2',
|
255
|
+
' description line 3 ',
|
256
|
+
'',
|
257
|
+
'',
|
258
|
+
'',
|
259
|
+
" #{@step_keyword} a step",
|
260
|
+
'',
|
261
|
+
"#{@example_keyword}:",
|
262
|
+
'|param|',
|
263
|
+
'|value|']
|
264
|
+
source = source.join("\n")
|
264
265
|
|
265
|
-
|
266
|
+
outline = clazz.new(source)
|
267
|
+
description = outline.description.split("\n", -1)
|
268
|
+
|
269
|
+
expect(description).to eq([' description line 1',
|
270
|
+
'',
|
271
|
+
'description line 2',
|
272
|
+
' description line 3'])
|
273
|
+
end
|
266
274
|
|
267
275
|
|
268
|
-
|
276
|
+
describe 'comparison' do
|
269
277
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
278
|
+
it 'is equal to a background with the same steps' do
|
279
|
+
source = "#{@outline_keyword}:
|
280
|
+
#{@step_keyword} step 1
|
281
|
+
#{@step_keyword} step 2
|
282
|
+
#{@example_keyword}:
|
275
283
|
| param |
|
276
284
|
| value |"
|
277
|
-
|
285
|
+
outline = clazz.new(source)
|
278
286
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
287
|
+
source = "#{@background_keyword}:
|
288
|
+
#{@step_keyword} step 1
|
289
|
+
#{@step_keyword} step 2"
|
290
|
+
background_1 = CukeModeler::Background.new(source)
|
283
291
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
292
|
+
source = "#{@background_keyword}:
|
293
|
+
#{@step_keyword} step 2
|
294
|
+
#{@step_keyword} step 1"
|
295
|
+
background_2 = CukeModeler::Background.new(source)
|
288
296
|
|
289
297
|
|
290
|
-
|
291
|
-
|
292
|
-
|
298
|
+
expect(outline).to eq(background_1)
|
299
|
+
expect(outline).to_not eq(background_2)
|
300
|
+
end
|
293
301
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
302
|
+
it 'is equal to a scenario with the same steps' do
|
303
|
+
source = "#{@outline_keyword}:
|
304
|
+
#{@step_keyword} step 1
|
305
|
+
#{@step_keyword} step 2
|
306
|
+
#{@example_keyword}:
|
299
307
|
| param |
|
300
308
|
| value |"
|
301
|
-
|
309
|
+
outline = clazz.new(source)
|
302
310
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
311
|
+
source = "#{@scenario_keyword}:
|
312
|
+
#{@step_keyword} step 1
|
313
|
+
#{@step_keyword} step 2"
|
314
|
+
scenario_1 = CukeModeler::Scenario.new(source)
|
307
315
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
316
|
+
source = "#{@scenario_keyword}:
|
317
|
+
#{@step_keyword} step 2
|
318
|
+
#{@step_keyword} step 1"
|
319
|
+
scenario_2 = CukeModeler::Scenario.new(source)
|
312
320
|
|
313
321
|
|
314
|
-
|
315
|
-
|
316
|
-
|
322
|
+
expect(outline).to eq(scenario_1)
|
323
|
+
expect(outline).to_not eq(scenario_2)
|
324
|
+
end
|
317
325
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
326
|
+
it 'is equal to an outline with the same steps' do
|
327
|
+
source = "#{@outline_keyword}:
|
328
|
+
#{@step_keyword} step 1
|
329
|
+
#{@step_keyword} step 2
|
330
|
+
#{@example_keyword}:
|
323
331
|
| param |
|
324
332
|
| value |"
|
325
|
-
|
333
|
+
outline_1 = clazz.new(source)
|
326
334
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
335
|
+
source = "#{@outline_keyword}:
|
336
|
+
#{@step_keyword} step 1
|
337
|
+
#{@step_keyword} step 2
|
338
|
+
#{@example_keyword}:
|
331
339
|
| param |
|
332
340
|
| value |"
|
333
|
-
|
341
|
+
outline_2 = clazz.new(source)
|
334
342
|
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
343
|
+
source = "#{@outline_keyword}:
|
344
|
+
#{@step_keyword} step 2
|
345
|
+
#{@step_keyword} step 1
|
346
|
+
#{@example_keyword}:
|
339
347
|
| param |
|
340
348
|
| value |"
|
341
|
-
|
349
|
+
outline_3 = clazz.new(source)
|
342
350
|
|
343
351
|
|
344
|
-
|
345
|
-
|
346
|
-
|
352
|
+
expect(outline_1).to eq(outline_2)
|
353
|
+
expect(outline_1).to_not eq(outline_3)
|
354
|
+
end
|
355
|
+
|
356
|
+
end
|
357
|
+
|
358
|
+
|
359
|
+
describe 'outline output' do
|
360
|
+
|
361
|
+
it 'can be remade from its own output' do
|
362
|
+
source = "@tag1 @tag2 @tag3
|
363
|
+
#{@outline_keyword}: An outline with everything it could have
|
364
|
+
|
365
|
+
Some description.
|
366
|
+
Some more description.
|
347
367
|
|
368
|
+
#{@step_keyword} a step
|
369
|
+
| value |
|
370
|
+
#{@step_keyword} a <value> step
|
371
|
+
\"\"\"
|
372
|
+
some string
|
373
|
+
\"\"\"
|
374
|
+
|
375
|
+
#{@example_keyword}:
|
376
|
+
|
377
|
+
Some description.
|
378
|
+
Some more description.
|
379
|
+
|
380
|
+
| value |
|
381
|
+
| x |
|
382
|
+
|
383
|
+
@example_tag
|
384
|
+
#{@example_keyword}:
|
385
|
+
| value |
|
386
|
+
| y |"
|
387
|
+
outline = clazz.new(source)
|
388
|
+
|
389
|
+
outline_output = outline.to_s
|
390
|
+
remade_outline_output = clazz.new(outline_output).to_s
|
391
|
+
|
392
|
+
expect(remade_outline_output).to eq(outline_output)
|
348
393
|
end
|
349
394
|
|
350
395
|
|
351
|
-
|
396
|
+
context 'from source text' do
|
352
397
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
'',
|
357
|
-
'Some description.',
|
358
|
-
'Some more description.',
|
359
|
-
'',
|
360
|
-
' * a step',
|
361
|
-
' | value |',
|
362
|
-
' * a <value> step',
|
363
|
-
' """',
|
364
|
-
' some string',
|
365
|
-
' """',
|
366
|
-
'',
|
367
|
-
'Examples:',
|
368
|
-
'',
|
369
|
-
'Some description.',
|
370
|
-
'Some more description.',
|
371
|
-
'',
|
372
|
-
' | value |',
|
373
|
-
' | x |',
|
374
|
-
'',
|
375
|
-
'@example_tag',
|
376
|
-
'Examples:',
|
377
|
-
' | value |',
|
378
|
-
' | y |']
|
398
|
+
# gherkin 3.x does not accept incomplete outlines
|
399
|
+
it 'can output an empty outline', :gherkin3 => false do
|
400
|
+
source = ["#{@outline_keyword}:"]
|
379
401
|
source = source.join("\n")
|
380
402
|
outline = clazz.new(source)
|
381
403
|
|
382
|
-
outline_output = outline.to_s
|
383
|
-
remade_outline_output = clazz.new(outline_output).to_s
|
404
|
+
outline_output = outline.to_s.split("\n", -1)
|
384
405
|
|
385
|
-
expect(
|
406
|
+
expect(outline_output).to eq(["#{@outline_keyword}:"])
|
386
407
|
end
|
387
408
|
|
409
|
+
# gherkin 3.x does not accept incomplete outlines
|
410
|
+
it 'can output a outline that has a name', :gherkin3 => false do
|
411
|
+
source = ["#{@outline_keyword}: test outline"]
|
412
|
+
source = source.join("\n")
|
413
|
+
outline = clazz.new(source)
|
388
414
|
|
389
|
-
|
390
|
-
|
391
|
-
# gherkin 3.x does not accept incomplete outlines
|
392
|
-
it 'can output an empty outline', :gherkin3 => false do
|
393
|
-
source = ['Scenario Outline:']
|
394
|
-
source = source.join("\n")
|
395
|
-
outline = clazz.new(source)
|
396
|
-
|
397
|
-
outline_output = outline.to_s.split("\n")
|
415
|
+
outline_output = outline.to_s.split("\n", -1)
|
398
416
|
|
399
|
-
|
400
|
-
|
417
|
+
expect(outline_output).to eq(["#{@outline_keyword}: test outline"])
|
418
|
+
end
|
401
419
|
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
420
|
+
# gherkin 3.x does not accept incomplete outlines
|
421
|
+
it 'can output a outline that has a description', :gherkin3 => false do
|
422
|
+
source = ["#{@outline_keyword}:",
|
423
|
+
'Some description.',
|
424
|
+
'Some more description.']
|
425
|
+
source = source.join("\n")
|
426
|
+
outline = clazz.new(source)
|
407
427
|
|
408
|
-
|
428
|
+
outline_output = outline.to_s.split("\n", -1)
|
409
429
|
|
410
|
-
|
411
|
-
|
430
|
+
expect(outline_output).to eq(["#{@outline_keyword}:",
|
431
|
+
'',
|
432
|
+
'Some description.',
|
433
|
+
'Some more description.'])
|
434
|
+
end
|
412
435
|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
436
|
+
# gherkin 3.x does not accept incomplete outlines
|
437
|
+
it 'can output a outline that has steps', :gherkin3 => false do
|
438
|
+
source = ["#{@outline_keyword}:",
|
439
|
+
" #{@step_keyword} a step",
|
440
|
+
' | value |',
|
441
|
+
" #{@step_keyword} another step",
|
442
|
+
' """',
|
443
|
+
' some string',
|
444
|
+
' """']
|
445
|
+
source = source.join("\n")
|
446
|
+
outline = clazz.new(source)
|
420
447
|
|
421
|
-
|
448
|
+
outline_output = outline.to_s.split("\n", -1)
|
422
449
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
450
|
+
expect(outline_output).to eq(["#{@outline_keyword}:",
|
451
|
+
" #{@step_keyword} a step",
|
452
|
+
' | value |',
|
453
|
+
" #{@step_keyword} another step",
|
454
|
+
' """',
|
455
|
+
' some string',
|
456
|
+
' """'])
|
457
|
+
end
|
428
458
|
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
' some string',
|
437
|
-
' """']
|
438
|
-
source = source.join("\n")
|
439
|
-
outline = clazz.new(source)
|
440
|
-
|
441
|
-
outline_output = outline.to_s.split("\n")
|
442
|
-
|
443
|
-
expect(outline_output).to eq(['Scenario Outline:',
|
444
|
-
' * a step',
|
445
|
-
' | value |',
|
446
|
-
' * another step',
|
447
|
-
' """',
|
448
|
-
' some string',
|
449
|
-
' """'])
|
450
|
-
end
|
459
|
+
# gherkin 3.x does not accept incomplete outlines
|
460
|
+
it 'can output a outline that has tags', :gherkin3 => false do
|
461
|
+
source = ['@tag1 @tag2',
|
462
|
+
'@tag3',
|
463
|
+
"#{@outline_keyword}:"]
|
464
|
+
source = source.join("\n")
|
465
|
+
outline = clazz.new(source)
|
451
466
|
|
452
|
-
|
453
|
-
it 'can output a outline that has tags', :gherkin3 => false do
|
454
|
-
source = ['@tag1 @tag2',
|
455
|
-
'@tag3',
|
456
|
-
'Scenario Outline:']
|
457
|
-
source = source.join("\n")
|
458
|
-
outline = clazz.new(source)
|
467
|
+
outline_output = outline.to_s.split("\n", -1)
|
459
468
|
|
460
|
-
|
469
|
+
expect(outline_output).to eq(['@tag1 @tag2 @tag3',
|
470
|
+
"#{@outline_keyword}:"])
|
471
|
+
end
|
461
472
|
|
462
|
-
|
463
|
-
|
464
|
-
|
473
|
+
it 'can output a outline that has examples' do
|
474
|
+
source = ["#{@outline_keyword}:",
|
475
|
+
"#{@step_keyword} a step",
|
476
|
+
"#{@example_keyword}:",
|
477
|
+
'| value |',
|
478
|
+
'| x |',
|
479
|
+
"#{@example_keyword}:",
|
480
|
+
'| value |',
|
481
|
+
'| y |']
|
482
|
+
source = source.join("\n")
|
483
|
+
outline = clazz.new(source)
|
465
484
|
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
expect(outline_output).to eq(['Scenario Outline:',
|
481
|
-
' * a step',
|
482
|
-
'',
|
483
|
-
'Examples:',
|
484
|
-
' | value |',
|
485
|
-
' | x |',
|
486
|
-
'',
|
487
|
-
'Examples:',
|
488
|
-
' | value |',
|
489
|
-
' | y |'])
|
490
|
-
end
|
485
|
+
outline_output = outline.to_s.split("\n", -1)
|
486
|
+
|
487
|
+
expect(outline_output).to eq(["#{@outline_keyword}:",
|
488
|
+
" #{@step_keyword} a step",
|
489
|
+
'',
|
490
|
+
"#{@example_keyword}:",
|
491
|
+
' | value |',
|
492
|
+
' | x |',
|
493
|
+
'',
|
494
|
+
"#{@example_keyword}:",
|
495
|
+
' | value |',
|
496
|
+
' | y |'])
|
497
|
+
end
|
491
498
|
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
outline_output = outline.to_s.split("\n")
|
520
|
-
|
521
|
-
expect(outline_output).to eq(['@tag1 @tag2 @tag3',
|
522
|
-
'Scenario Outline: A outline with everything it could have',
|
523
|
-
'',
|
524
|
-
'Including a description',
|
525
|
-
'and then some.',
|
526
|
-
'',
|
527
|
-
' * a step',
|
528
|
-
' | value |',
|
529
|
-
' * another step',
|
530
|
-
' """',
|
531
|
-
' some string',
|
532
|
-
' """',
|
533
|
-
'',
|
534
|
-
'Examples:',
|
535
|
-
'',
|
536
|
-
'Some description.',
|
537
|
-
'Some more description.',
|
538
|
-
'',
|
539
|
-
' | value |',
|
540
|
-
' | x |',
|
541
|
-
'',
|
542
|
-
'@example_tag',
|
543
|
-
'Examples:',
|
544
|
-
' | value |',
|
545
|
-
' | y |'])
|
546
|
-
end
|
499
|
+
it 'can output a outline that has everything' do
|
500
|
+
source = ['@tag1 @tag2 @tag3',
|
501
|
+
"#{@outline_keyword}: A outline with everything it could have",
|
502
|
+
'Including a description',
|
503
|
+
'and then some.',
|
504
|
+
"#{@step_keyword} a step",
|
505
|
+
'|value|',
|
506
|
+
"#{@step_keyword} another step",
|
507
|
+
'"""',
|
508
|
+
'some string',
|
509
|
+
'"""',
|
510
|
+
'',
|
511
|
+
"#{@example_keyword}:",
|
512
|
+
'',
|
513
|
+
'Some description.',
|
514
|
+
'Some more description.',
|
515
|
+
'',
|
516
|
+
'| value |',
|
517
|
+
'| x |',
|
518
|
+
'',
|
519
|
+
'@example_tag',
|
520
|
+
"#{@example_keyword}:",
|
521
|
+
'| value |',
|
522
|
+
'| y |']
|
523
|
+
source = source.join("\n")
|
524
|
+
outline = clazz.new(source)
|
547
525
|
|
526
|
+
outline_output = outline.to_s.split("\n", -1)
|
527
|
+
|
528
|
+
expect(outline_output).to eq(['@tag1 @tag2 @tag3',
|
529
|
+
"#{@outline_keyword}: A outline with everything it could have",
|
530
|
+
'',
|
531
|
+
'Including a description',
|
532
|
+
'and then some.',
|
533
|
+
'',
|
534
|
+
" #{@step_keyword} a step",
|
535
|
+
' | value |',
|
536
|
+
" #{@step_keyword} another step",
|
537
|
+
' """',
|
538
|
+
' some string',
|
539
|
+
' """',
|
540
|
+
'',
|
541
|
+
"#{@example_keyword}:",
|
542
|
+
'',
|
543
|
+
'Some description.',
|
544
|
+
'Some more description.',
|
545
|
+
'',
|
546
|
+
' | value |',
|
547
|
+
' | x |',
|
548
|
+
'',
|
549
|
+
'@example_tag',
|
550
|
+
"#{@example_keyword}:",
|
551
|
+
' | value |',
|
552
|
+
' | y |'])
|
548
553
|
end
|
549
554
|
|
555
|
+
end
|
550
556
|
|
551
|
-
context 'from abstract instantiation' do
|
552
557
|
|
553
|
-
|
558
|
+
context 'from abstract instantiation' do
|
554
559
|
|
560
|
+
let(:outline) { clazz.new }
|
555
561
|
|
556
|
-
it 'can output an outline that has only tags' do
|
557
|
-
outline.tags = [CukeModeler::Tag.new]
|
558
562
|
|
559
|
-
|
560
|
-
|
563
|
+
it 'can output an outline that has only tags' do
|
564
|
+
outline.tags = [CukeModeler::Tag.new]
|
561
565
|
|
562
|
-
|
563
|
-
|
566
|
+
expect { outline.to_s }.to_not raise_error
|
567
|
+
end
|
564
568
|
|
565
|
-
|
566
|
-
|
569
|
+
it 'can output an outline that has only steps' do
|
570
|
+
outline.steps = [CukeModeler::Step.new]
|
567
571
|
|
568
|
-
|
569
|
-
|
572
|
+
expect { outline.to_s }.to_not raise_error
|
573
|
+
end
|
570
574
|
|
571
|
-
|
572
|
-
|
575
|
+
it 'can output an outline that has only examples' do
|
576
|
+
outline.examples = [CukeModeler::Example.new]
|
573
577
|
|
578
|
+
expect { outline.to_s }.to_not raise_error
|
574
579
|
end
|
575
580
|
|
576
581
|
end
|