cuke_modeler 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +12 -0
  3. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +5 -5
  4. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +8 -5
  5. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +8 -5
  6. data/lib/cuke_modeler/containing.rb +12 -7
  7. data/lib/cuke_modeler/models/background.rb +7 -2
  8. data/lib/cuke_modeler/models/cell.rb +2 -1
  9. data/lib/cuke_modeler/models/doc_string.rb +2 -1
  10. data/lib/cuke_modeler/models/example.rb +8 -4
  11. data/lib/cuke_modeler/models/feature.rb +4 -1
  12. data/lib/cuke_modeler/models/outline.rb +6 -2
  13. data/lib/cuke_modeler/models/row.rb +2 -1
  14. data/lib/cuke_modeler/models/scenario.rb +7 -2
  15. data/lib/cuke_modeler/models/step.rb +2 -1
  16. data/lib/cuke_modeler/models/table.rb +2 -1
  17. data/lib/cuke_modeler/models/tag.rb +2 -1
  18. data/lib/cuke_modeler/parsing.rb +45 -0
  19. data/lib/cuke_modeler/version.rb +1 -1
  20. data/testing/cucumber/features/modeling/background_modeling.feature +7 -0
  21. data/testing/cucumber/features/modeling/background_output.feature +6 -1
  22. data/testing/cucumber/features/modeling/directory_output.feature +6 -1
  23. data/testing/cucumber/features/modeling/doc_string_output.feature +6 -1
  24. data/testing/cucumber/features/modeling/example_modeling.feature +7 -0
  25. data/testing/cucumber/features/modeling/example_output.feature +6 -1
  26. data/testing/cucumber/features/modeling/feature_file_output.feature +6 -1
  27. data/testing/cucumber/features/modeling/feature_modeling.feature +7 -0
  28. data/testing/cucumber/features/modeling/feature_output.feature +6 -1
  29. data/testing/cucumber/features/modeling/model_output.feature +1 -8
  30. data/testing/cucumber/features/modeling/outline_modeling.feature +7 -0
  31. data/testing/cucumber/features/modeling/outline_output.feature +6 -1
  32. data/testing/cucumber/features/modeling/row_output.feature +6 -1
  33. data/testing/cucumber/features/modeling/scenario_modeling.feature +7 -0
  34. data/testing/cucumber/features/modeling/scenario_output.feature +6 -1
  35. data/testing/cucumber/features/modeling/step_output.feature +6 -1
  36. data/testing/cucumber/features/modeling/table_output.feature +6 -1
  37. data/testing/cucumber/features/modeling/tag_output.feature +6 -1
  38. data/testing/cucumber/step_definitions/verification_steps.rb +21 -12
  39. data/testing/dialect_helper.rb +48 -0
  40. data/testing/rspec/spec/integration/background_integration_spec.rb +93 -88
  41. data/testing/rspec/spec/integration/cell_integration_spec.rb +26 -27
  42. data/testing/rspec/spec/integration/directory_integration_spec.rb +4 -4
  43. data/testing/rspec/spec/integration/doc_string_integration_spec.rb +38 -39
  44. data/testing/rspec/spec/integration/example_integration_spec.rb +97 -95
  45. data/testing/rspec/spec/integration/feature_file_integration_spec.rb +5 -5
  46. data/testing/rspec/spec/integration/feature_integration_spec.rb +157 -155
  47. data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +17 -17
  48. data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +17 -17
  49. data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +17 -17
  50. data/testing/rspec/spec/integration/outline_integration_spec.rb +359 -354
  51. data/testing/rspec/spec/integration/parsing_integration_spec.rb +30 -2
  52. data/testing/rspec/spec/integration/row_integration_spec.rb +23 -25
  53. data/testing/rspec/spec/integration/scenario_integration_spec.rb +238 -235
  54. data/testing/rspec/spec/integration/step_integration_spec.rb +69 -64
  55. data/testing/rspec/spec/integration/table_integration_spec.rb +32 -36
  56. data/testing/rspec/spec/integration/tag_integration_spec.rb +26 -27
  57. data/testing/rspec/spec/spec_helper.rb +43 -0
  58. data/testing/rspec/spec/unit/background_unit_spec.rb +7 -0
  59. data/testing/rspec/spec/unit/example_unit_spec.rb +7 -0
  60. data/testing/rspec/spec/unit/feature_unit_spec.rb +7 -0
  61. data/testing/rspec/spec/unit/outline_unit_spec.rb +7 -0
  62. data/testing/rspec/spec/unit/parsing_unit_spec.rb +33 -0
  63. data/testing/rspec/spec/unit/scenario_unit_spec.rb +7 -0
  64. data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +58 -0
  65. data/testing/rspec/spec/unit/step_unit_spec.rb +1 -23
  66. data/testing/test_languages.json +45 -0
  67. data/todo.txt +1 -1
  68. 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) { '@tag1 @tag2 @tag3
7
- Feature: A feature with everything it could have
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
- Background:
12
+ #{@background_keyword}:
13
13
 
14
14
  Background
15
15
  description
16
16
 
17
- * a step
17
+ #{@step_keyword} a step
18
18
  | value1 |
19
- * another step
19
+ #{@step_keyword} another step
20
20
 
21
21
  @scenario_tag
22
- Scenario:
22
+ #{@scenario_keyword}:
23
23
 
24
24
  Scenario
25
25
  description
26
26
 
27
- * a step
28
- * another step
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
- Scenario Outline:
34
+ #{@outline_keyword}:
35
35
 
36
36
  Outline
37
37
  description
38
38
 
39
- * a step
39
+ #{@step_keyword} a step
40
40
  | value2 |
41
- * another step
42
- """
41
+ #{@step_keyword} another step
42
+ \"\"\"
43
43
  some text
44
- """
44
+ \"\"\"
45
45
 
46
46
  @example_tag
47
- Examples:
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) { '@tag1 @tag2 @tag3
7
- Feature: A feature with everything it could have
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
- Background:
12
+ #{@background_keyword}:
13
13
 
14
14
  Background
15
15
  description
16
16
 
17
- * a step
17
+ #{@step_keyword} a step
18
18
  | value1 |
19
- * another step
19
+ #{@step_keyword} another step
20
20
 
21
21
  @scenario_tag
22
- Scenario:
22
+ #{@scenario_keyword}:
23
23
 
24
24
  Scenario
25
25
  description
26
26
 
27
- * a step
28
- * another step
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
- Scenario Outline:
34
+ #{@outline_keyword}:
35
35
 
36
36
  Outline
37
37
  description
38
38
 
39
- * a step
39
+ #{@step_keyword} a step
40
40
  | value2 |
41
- * another step
42
- """
41
+ #{@step_keyword} another step
42
+ \"\"\"
43
43
  some text
44
- """
44
+ \"\"\"
45
45
 
46
46
  @example_tag
47
- Examples:
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) { '@tag1 @tag2 @tag3
7
- Feature: A feature with everything it could have
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
- Background:
12
+ #{@background_keyword}:
13
13
 
14
14
  Background
15
15
  description
16
16
 
17
- * a step
17
+ #{@step_keyword} a step
18
18
  | value1 |
19
- * another step
19
+ #{@step_keyword} another step
20
20
 
21
21
  @scenario_tag
22
- Scenario:
22
+ #{@scenario_keyword}:
23
23
 
24
24
  Scenario
25
25
  description
26
26
 
27
- * a step
28
- * another step
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
- Scenario Outline:
34
+ #{@outline_keyword}:
35
35
 
36
36
  Outline
37
37
  description
38
38
 
39
- * a step
39
+ #{@step_keyword} a step
40
40
  | value2 |
41
- * another step
42
- """
41
+ #{@step_keyword} another step
42
+ \"\"\"
43
43
  some text
44
- """
44
+ \"\"\"
45
45
 
46
46
  @example_tag
47
- Examples:
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 = "Scenario Outline:"
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 = "Scenario Outline:"
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 = "Scenario Outline:
32
- Examples:
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\nScenario Outline: test outline\ndescription\n* a step\nExamples:\n|param|\n|value|")
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\nScenario Outline: test outline\ndescription\n* a step\nExamples:\n|param|\n|value|")
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\nScenario Outline: test outline\ndescription\n* a step\nExamples:\n|param|\n|value|")
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 Scenario Outline:\n And a step\n @foo "
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 = ['@a_tag',
71
- ' Scenario Outline:',
72
- ' * a step',
73
- ' Examples:',
74
- ' | param |',
75
- ' | value |']
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 = ['Feature: Test feature',
93
- '',
94
- ' Scenario Outline: Test test',
95
- ' * a step',
96
- ' Examples: Test example',
97
- ' | a param |',
98
- ' | a value |']
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
- describe 'model population' do
135
+ context 'from source text' do
135
136
 
136
- context 'from source text' do
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
- Scenario Outline: foo
142
- * step
143
- Examples:
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
- outline = CukeModeler::Feature.new(source_text).tests.first
153
+ | value |"
154
+ outline = CukeModeler::Feature.new(source_text).tests.first
147
155
 
148
- expect(outline.source_line).to eq(3)
149
- end
156
+ expect(outline.source_line).to eq(3)
157
+ end
150
158
 
151
159
 
152
- context 'a filled outline' do
160
+ context 'a filled outline' do
153
161
 
154
- let(:source_text) { '@tag1 @tag2 @tag3
155
- Scenario Outline: Foo
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
- Given a <setup> step
162
- When an action step
163
- Then a <verification> step
169
+ #{@step_keyword} a <setup> step
170
+ #{@step_keyword} an action step
171
+ #{@step_keyword} a <verification> step
164
172
 
165
- Examples: example 1
173
+ #{@example_keyword}: example 1
166
174
  | setup | verification |
167
175
  | x | y |
168
- Examples: example 2
176
+ #{@example_keyword}: example 2
169
177
  | setup | verification |
170
- | a | b |' }
171
- let(:outline) { clazz.new(source_text) }
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
- it "models the outline's description" do
179
- description = outline.description.split("\n")
182
+ it "models the outline's name" do
183
+ expect(outline.name).to eq('Foo')
184
+ end
180
185
 
181
- expect(description).to eq([' Scenario description.',
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
- it "models the outline's steps" do
188
- step_names = outline.steps.collect { |step| step.text }
189
+ expect(description).to eq([' Scenario description.',
190
+ '',
191
+ 'Some more.',
192
+ ' Even more.'])
193
+ end
189
194
 
190
- expect(step_names).to eq(['a <setup> step', 'an action step', 'a <verification> step'])
191
- end
195
+ it "models the outline's steps" do
196
+ step_names = outline.steps.collect { |step| step.text }
192
197
 
193
- it "models the outline's tags" do
194
- tag_names = outline.tags.collect { |tag| tag.name }
198
+ expect(step_names).to eq(['a <setup> step', 'an action step', 'a <verification> step'])
199
+ end
195
200
 
196
- expect(tag_names).to eq(['@tag1', '@tag2', '@tag3'])
197
- end
201
+ it "models the outline's tags" do
202
+ tag_names = outline.tags.collect { |tag| tag.name }
198
203
 
199
- it "models the outline's examples" do
200
- example_names = outline.examples.collect { |example| example.name }
204
+ expect(tag_names).to eq(['@tag1', '@tag2', '@tag3'])
205
+ end
201
206
 
202
- expect(example_names).to eq(['example 1', 'example 2'])
203
- end
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
- let(:source_text) { 'Scenario Outline:' }
212
- let(:outline) { clazz.new(source_text) }
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
- it "models the outline's description" do
220
- expect(outline.description).to eq('')
221
- end
223
+ it "models the outline's name" do
224
+ expect(outline.name).to eq('')
225
+ end
222
226
 
223
- it "models the outline's steps" do
224
- expect(outline.steps).to eq([])
225
- end
227
+ it "models the outline's description" do
228
+ expect(outline.description).to eq('')
229
+ end
226
230
 
227
- it "models the outline's tags" do
228
- expect(outline.tags).to eq([])
229
- end
231
+ it "models the outline's steps" do
232
+ expect(outline.steps).to eq([])
233
+ end
230
234
 
231
- it "models the outline's examples" do
232
- expect(outline.examples).to eq([])
233
- end
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
- it 'trims whitespace from its source description' do
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
- outline = clazz.new(source)
257
- description = outline.description.split("\n")
247
+ end
258
248
 
259
- expect(description).to eq([' description line 1',
260
- '',
261
- 'description line 2',
262
- ' description line 3'])
263
- end
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
- end
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
- describe 'comparison' do
276
+ describe 'comparison' do
269
277
 
270
- it 'is equal to a background with the same steps' do
271
- source = "Scenario Outline:
272
- * step 1
273
- * step 2
274
- Examples:
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
- outline = clazz.new(source)
285
+ outline = clazz.new(source)
278
286
 
279
- source = "Background:
280
- * step 1
281
- * step 2"
282
- background_1 = CukeModeler::Background.new(source)
287
+ source = "#{@background_keyword}:
288
+ #{@step_keyword} step 1
289
+ #{@step_keyword} step 2"
290
+ background_1 = CukeModeler::Background.new(source)
283
291
 
284
- source = "Background:
285
- * step 2
286
- * step 1"
287
- background_2 = CukeModeler::Background.new(source)
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
- expect(outline).to eq(background_1)
291
- expect(outline).to_not eq(background_2)
292
- end
298
+ expect(outline).to eq(background_1)
299
+ expect(outline).to_not eq(background_2)
300
+ end
293
301
 
294
- it 'is equal to a scenario with the same steps' do
295
- source = "Scenario Outline:
296
- * step 1
297
- * step 2
298
- Examples:
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
- outline = clazz.new(source)
309
+ outline = clazz.new(source)
302
310
 
303
- source = "Scenario:
304
- * step 1
305
- * step 2"
306
- scenario_1 = CukeModeler::Scenario.new(source)
311
+ source = "#{@scenario_keyword}:
312
+ #{@step_keyword} step 1
313
+ #{@step_keyword} step 2"
314
+ scenario_1 = CukeModeler::Scenario.new(source)
307
315
 
308
- source = "Scenario:
309
- * step 2
310
- * step 1"
311
- scenario_2 = CukeModeler::Scenario.new(source)
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
- expect(outline).to eq(scenario_1)
315
- expect(outline).to_not eq(scenario_2)
316
- end
322
+ expect(outline).to eq(scenario_1)
323
+ expect(outline).to_not eq(scenario_2)
324
+ end
317
325
 
318
- it 'is equal to an outline with the same steps' do
319
- source = "Scenario Outline:
320
- * step 1
321
- * step 2
322
- Examples:
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
- outline_1 = clazz.new(source)
333
+ outline_1 = clazz.new(source)
326
334
 
327
- source = "Scenario Outline:
328
- * step 1
329
- * step 2
330
- Examples:
335
+ source = "#{@outline_keyword}:
336
+ #{@step_keyword} step 1
337
+ #{@step_keyword} step 2
338
+ #{@example_keyword}:
331
339
  | param |
332
340
  | value |"
333
- outline_2 = clazz.new(source)
341
+ outline_2 = clazz.new(source)
334
342
 
335
- source = "Scenario Outline:
336
- * step 2
337
- * step 1
338
- Examples:
343
+ source = "#{@outline_keyword}:
344
+ #{@step_keyword} step 2
345
+ #{@step_keyword} step 1
346
+ #{@example_keyword}:
339
347
  | param |
340
348
  | value |"
341
- outline_3 = clazz.new(source)
349
+ outline_3 = clazz.new(source)
342
350
 
343
351
 
344
- expect(outline_1).to eq(outline_2)
345
- expect(outline_1).to_not eq(outline_3)
346
- end
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
- describe 'outline output' do
396
+ context 'from source text' do
352
397
 
353
- it 'can be remade from its own output' do
354
- source = ['@tag1 @tag2 @tag3',
355
- 'Scenario Outline: An outline with everything it could have',
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(remade_outline_output).to eq(outline_output)
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
- context 'from source text' do
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
- expect(outline_output).to eq(['Scenario Outline:'])
400
- end
417
+ expect(outline_output).to eq(["#{@outline_keyword}: test outline"])
418
+ end
401
419
 
402
- # gherkin 3.x does not accept incomplete outlines
403
- it 'can output a outline that has a name', :gherkin3 => false do
404
- source = ['Scenario Outline: test outline']
405
- source = source.join("\n")
406
- outline = clazz.new(source)
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
- outline_output = outline.to_s.split("\n")
428
+ outline_output = outline.to_s.split("\n", -1)
409
429
 
410
- expect(outline_output).to eq(['Scenario Outline: test outline'])
411
- end
430
+ expect(outline_output).to eq(["#{@outline_keyword}:",
431
+ '',
432
+ 'Some description.',
433
+ 'Some more description.'])
434
+ end
412
435
 
413
- # gherkin 3.x does not accept incomplete outlines
414
- it 'can output a outline that has a description', :gherkin3 => false do
415
- source = ['Scenario Outline:',
416
- 'Some description.',
417
- 'Some more description.']
418
- source = source.join("\n")
419
- outline = clazz.new(source)
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
- outline_output = outline.to_s.split("\n")
448
+ outline_output = outline.to_s.split("\n", -1)
422
449
 
423
- expect(outline_output).to eq(['Scenario Outline:',
424
- '',
425
- 'Some description.',
426
- 'Some more description.'])
427
- end
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
- # gherkin 3.x does not accept incomplete outlines
430
- it 'can output a outline that has steps', :gherkin3 => false do
431
- source = ['Scenario Outline:',
432
- ' * a step',
433
- ' | value |',
434
- ' * another step',
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
- # gherkin 3.x does not accept incomplete outlines
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
- outline_output = outline.to_s.split("\n")
469
+ expect(outline_output).to eq(['@tag1 @tag2 @tag3',
470
+ "#{@outline_keyword}:"])
471
+ end
461
472
 
462
- expect(outline_output).to eq(['@tag1 @tag2 @tag3',
463
- 'Scenario Outline:'])
464
- end
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
- it 'can output a outline that has examples' do
467
- source = ['Scenario Outline:',
468
- '* a step',
469
- 'Examples:',
470
- '| value |',
471
- '| x |',
472
- 'Examples:',
473
- '| value |',
474
- '| y |']
475
- source = source.join("\n")
476
- outline = clazz.new(source)
477
-
478
- outline_output = outline.to_s.split("\n")
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
- it 'can output a outline that has everything' do
493
- source = ['@tag1 @tag2 @tag3',
494
- 'Scenario Outline: A outline with everything it could have',
495
- 'Including a description',
496
- 'and then some.',
497
- '* a step',
498
- '|value|',
499
- '* another step',
500
- '"""',
501
- 'some string',
502
- '"""',
503
- '',
504
- 'Examples:',
505
- '',
506
- 'Some description.',
507
- 'Some more description.',
508
- '',
509
- '| value |',
510
- '| x |',
511
- '',
512
- '@example_tag',
513
- 'Examples:',
514
- '| value |',
515
- '| y |']
516
- source = source.join("\n")
517
- outline = clazz.new(source)
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
- let(:outline) { clazz.new }
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
- expect { outline.to_s }.to_not raise_error
560
- end
563
+ it 'can output an outline that has only tags' do
564
+ outline.tags = [CukeModeler::Tag.new]
561
565
 
562
- it 'can output an outline that has only steps' do
563
- outline.steps = [CukeModeler::Step.new]
566
+ expect { outline.to_s }.to_not raise_error
567
+ end
564
568
 
565
- expect { outline.to_s }.to_not raise_error
566
- end
569
+ it 'can output an outline that has only steps' do
570
+ outline.steps = [CukeModeler::Step.new]
567
571
 
568
- it 'can output an outline that has only examples' do
569
- outline.examples = [CukeModeler::Example.new]
572
+ expect { outline.to_s }.to_not raise_error
573
+ end
570
574
 
571
- expect { outline.to_s }.to_not raise_error
572
- end
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