cuke_modeler 1.3.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +60 -17
- data/CHANGELOG.md +312 -0
- data/Gemfile +19 -3
- data/LICENSE.txt +1 -1
- data/README.md +17 -7
- data/Rakefile +45 -28
- data/appveyor.yml +57 -17
- data/cuke_modeler.gemspec +6 -3
- data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +1 -0
- data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +1 -0
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +2 -1
- data/lib/cuke_modeler/adapters/gherkin_5_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +310 -0
- data/lib/cuke_modeler/adapters/gherkin_7_adapter.rb +307 -0
- data/lib/cuke_modeler/adapters/gherkin_8_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +12 -0
- data/lib/cuke_modeler/containing.rb +16 -0
- data/lib/cuke_modeler/described.rb +1 -0
- data/lib/cuke_modeler/models/step.rb +31 -2
- data/lib/cuke_modeler/named.rb +1 -0
- data/lib/cuke_modeler/nested.rb +1 -0
- data/lib/cuke_modeler/parsed.rb +1 -0
- data/lib/cuke_modeler/parsing.rb +116 -68
- data/lib/cuke_modeler/sourceable.rb +1 -0
- data/lib/cuke_modeler/stepped.rb +1 -0
- data/lib/cuke_modeler/taggable.rb +1 -0
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/features/analysis/step_comparison.feature +25 -0
- data/testing/cucumber/features/analysis/test_comparison.feature +1 -1
- data/testing/cucumber/step_definitions/feature_file_steps.rb +1 -1
- data/testing/cucumber/step_definitions/modeling_steps.rb +7 -2
- data/testing/cucumber/step_definitions/verification_steps.rb +11 -2
- data/testing/file_helper.rb +3 -0
- data/testing/gemfiles/gherkin2.gemfile +8 -0
- data/testing/gemfiles/gherkin3.gemfile +6 -0
- data/testing/gemfiles/gherkin4.gemfile +7 -0
- data/testing/gemfiles/gherkin5.gemfile +7 -0
- data/testing/gemfiles/gherkin6.gemfile +10 -0
- data/testing/gemfiles/gherkin7.gemfile +9 -0
- data/testing/gemfiles/gherkin8.gemfile +9 -0
- data/testing/gemfiles/gherkin9.gemfile +9 -0
- data/testing/helper_methods.rb +23 -0
- data/testing/rspec/spec/integration/{gherkin_2_adapter_spec.rb → adapters/gherkin_2_adapter_spec.rb} +13 -13
- data/testing/rspec/spec/integration/{gherkin_3_adapter_spec.rb → adapters/gherkin_3_adapter_spec.rb} +13 -13
- data/testing/rspec/spec/integration/{gherkin_4_adapter_spec.rb → adapters/gherkin_4_adapter_spec.rb} +13 -13
- data/testing/rspec/spec/integration/adapters/gherkin_5_adapter_spec.rb +165 -0
- data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +159 -0
- data/testing/rspec/spec/integration/adapters/gherkin_7_adapter_spec.rb +162 -0
- data/testing/rspec/spec/integration/adapters/gherkin_8_adapter_spec.rb +162 -0
- data/testing/rspec/spec/integration/adapters/gherkin_9_adapter_spec.rb +162 -0
- data/testing/rspec/spec/integration/{background_integration_spec.rb → models/background_integration_spec.rb} +90 -86
- data/testing/rspec/spec/integration/{cell_integration_spec.rb → models/cell_integration_spec.rb} +49 -38
- data/testing/rspec/spec/integration/{comment_integration_spec.rb → models/comment_integration_spec.rb} +31 -20
- data/testing/rspec/spec/integration/{directory_integration_spec.rb → models/directory_integration_spec.rb} +3 -3
- data/testing/rspec/spec/integration/{doc_string_integration_spec.rb → models/doc_string_integration_spec.rb} +39 -35
- data/testing/rspec/spec/integration/{example_integration_spec.rb → models/example_integration_spec.rb} +109 -83
- data/testing/rspec/spec/integration/{feature_file_integration_spec.rb → models/feature_file_integration_spec.rb} +52 -38
- data/testing/rspec/spec/integration/{feature_integration_spec.rb → models/feature_integration_spec.rb} +125 -112
- data/testing/rspec/spec/integration/{model_integration_spec.rb → models/model_integration_spec.rb} +1 -1
- data/testing/rspec/spec/integration/{outline_integration_spec.rb → models/outline_integration_spec.rb} +138 -129
- data/testing/rspec/spec/integration/{row_integration_spec.rb → models/row_integration_spec.rb} +55 -35
- data/testing/rspec/spec/integration/{scenario_integration_spec.rb → models/scenario_integration_spec.rb} +92 -88
- data/testing/rspec/spec/integration/models/step_integration_spec.rb +573 -0
- data/testing/rspec/spec/integration/{table_integration_spec.rb → models/table_integration_spec.rb} +38 -34
- data/testing/rspec/spec/integration/{tag_integration_spec.rb → models/tag_integration_spec.rb} +56 -36
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +45 -7
- data/testing/rspec/spec/spec_helper.rb +79 -43
- data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +25 -0
- data/testing/rspec/spec/unit/{background_unit_spec.rb → models/background_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{cell_unit_spec.rb → models/cell_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{comment_unit_spec.rb → models/comment_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{directory_unit_spec.rb → models/directory_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{doc_string_unit_spec.rb → models/doc_string_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{example_unit_spec.rb → models/example_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{feature_file_unit_spec.rb → models/feature_file_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{feature_unit_spec.rb → models/feature_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{model_unit_spec.rb → models/model_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{outline_unit_spec.rb → models/outline_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{row_unit_spec.rb → models/row_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{scenario_unit_spec.rb → models/scenario_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{step_unit_spec.rb → models/step_unit_spec.rb} +2 -2
- data/testing/rspec/spec/unit/{table_unit_spec.rb → models/table_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/{tag_unit_spec.rb → models/tag_unit_spec.rb} +1 -1
- data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +102 -0
- data/todo.txt +5 -2
- metadata +80 -47
- data/History.md +0 -186
- data/testing/cucumber/support/transforms.rb +0 -3
- data/testing/rspec/spec/integration/step_integration_spec.rb +0 -459
data/testing/rspec/spec/integration/{row_integration_spec.rb → models/row_integration_spec.rb}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}
|
1
|
+
require "#{File.dirname(__FILE__)}/../../spec_helper"
|
2
2
|
|
3
3
|
|
4
4
|
describe 'Row, Integration' do
|
@@ -44,28 +44,48 @@ describe 'Row, Integration' do
|
|
44
44
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_row\.feature'/)
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
example_row = clazz.new("| a | row |")
|
49
|
-
data = example_row.parsing_data
|
47
|
+
describe 'parsing data' do
|
50
48
|
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(8, 9) do
|
50
|
+
example_row = clazz.new("| a | row |")
|
51
|
+
data = example_row.parsing_data
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
expect(data.keys).to match_array([:location, :cells, :id])
|
54
|
+
expect(data[:location][:line]).to eq(5)
|
55
|
+
end
|
58
56
|
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7) do
|
58
|
+
example_row = clazz.new("| a | row |")
|
59
|
+
data = example_row.parsing_data
|
62
60
|
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
expect(data.keys).to match_array([:location, :cells])
|
62
|
+
expect(data[:location][:line]).to eq(5)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
|
66
|
+
example_row = clazz.new("| a | row |")
|
67
|
+
data = example_row.parsing_data
|
68
|
+
|
69
|
+
expect(data.keys).to match_array([:type, :location, :cells])
|
70
|
+
expect(data[:type]).to eq(:TableRow)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
|
74
|
+
example_row = clazz.new("| a | row |")
|
75
|
+
data = example_row.parsing_data
|
76
|
+
|
77
|
+
expect(data.keys).to match_array([:type, :location, :cells])
|
78
|
+
expect(data[:type]).to eq('TableRow')
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
82
|
+
example_row = clazz.new("| a | row |")
|
83
|
+
data = example_row.parsing_data
|
84
|
+
|
85
|
+
expect(data.keys).to match_array(['cells', 'line'])
|
86
|
+
expect(data['line']).to eq(5)
|
87
|
+
end
|
66
88
|
|
67
|
-
expect(data.keys).to match_array(['cells', 'line'])
|
68
|
-
expect(data['line']).to eq(5)
|
69
89
|
end
|
70
90
|
|
71
91
|
it 'properly sets its child models' do
|
@@ -88,10 +108,10 @@ describe 'Row, Integration' do
|
|
88
108
|
|
89
109
|
|
90
110
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
91
|
-
let(:source_gherkin) { "#{
|
111
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
92
112
|
|
93
|
-
#{
|
94
|
-
#{
|
113
|
+
#{SCENARIO_KEYWORD}: Test test
|
114
|
+
#{STEP_KEYWORD} a step:
|
95
115
|
| a | table |"
|
96
116
|
}
|
97
117
|
|
@@ -132,10 +152,10 @@ describe 'Row, Integration' do
|
|
132
152
|
context 'a row that is part of a scenario' do
|
133
153
|
|
134
154
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
135
|
-
let(:source_gherkin) { "#{
|
155
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
136
156
|
|
137
|
-
#{
|
138
|
-
#{
|
157
|
+
#{SCENARIO_KEYWORD}: Test test
|
158
|
+
#{STEP_KEYWORD} a step:
|
139
159
|
| a | table |"
|
140
160
|
}
|
141
161
|
|
@@ -155,10 +175,10 @@ describe 'Row, Integration' do
|
|
155
175
|
context 'a row that is part of a background' do
|
156
176
|
|
157
177
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
158
|
-
let(:source_gherkin) { "#{
|
178
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
159
179
|
|
160
|
-
#{
|
161
|
-
#{
|
180
|
+
#{BACKGROUND_KEYWORD}: Test background
|
181
|
+
#{STEP_KEYWORD} a step:
|
162
182
|
| a | table |"
|
163
183
|
}
|
164
184
|
|
@@ -177,11 +197,11 @@ describe 'Row, Integration' do
|
|
177
197
|
context 'a row that is part of an outline' do
|
178
198
|
|
179
199
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
180
|
-
let(:source_gherkin) { "#{
|
200
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
181
201
|
|
182
|
-
#{
|
183
|
-
#{
|
184
|
-
#{
|
202
|
+
#{OUTLINE_KEYWORD}: Test outline
|
203
|
+
#{STEP_KEYWORD} a step
|
204
|
+
#{EXAMPLE_KEYWORD}:
|
185
205
|
| param |
|
186
206
|
| value |"
|
187
207
|
}
|
@@ -228,11 +248,11 @@ describe 'Row, Integration' do
|
|
228
248
|
end
|
229
249
|
|
230
250
|
it "models the row's source line" do
|
231
|
-
source_text = "#{
|
251
|
+
source_text = "#{FEATURE_KEYWORD}: Test feature
|
232
252
|
|
233
|
-
#{
|
234
|
-
#{
|
235
|
-
#{
|
253
|
+
#{OUTLINE_KEYWORD}: Test outline
|
254
|
+
#{STEP_KEYWORD} a step
|
255
|
+
#{EXAMPLE_KEYWORD}:
|
236
256
|
| param |
|
237
257
|
| value |"
|
238
258
|
row = CukeModeler::Feature.new(source_text).tests.first.examples.first.rows.first
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}
|
1
|
+
require "#{File.dirname(__FILE__)}/../../spec_helper"
|
2
2
|
|
3
3
|
|
4
4
|
describe 'Scenario, Integration' do
|
@@ -15,7 +15,7 @@ describe 'Scenario, Integration' do
|
|
15
15
|
describe 'unique behavior' do
|
16
16
|
|
17
17
|
it 'can be instantiated with the minimum viable Gherkin' do
|
18
|
-
source = "#{
|
18
|
+
source = "#{SCENARIO_KEYWORD}:"
|
19
19
|
|
20
20
|
expect { clazz.new(source) }.to_not raise_error
|
21
21
|
end
|
@@ -38,39 +38,43 @@ describe 'Scenario, Integration' do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'provides a descriptive filename when being parsed from stand alone text' do
|
41
|
-
source = "bad scenario text \n #{
|
41
|
+
source = "bad scenario text \n #{SCENARIO_KEYWORD}:\n And a step\n @foo "
|
42
42
|
|
43
43
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_scenario\.feature'/)
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
scenario = clazz.new("@tag\n#{@scenario_keyword}: test scenario\ndescription\n#{@step_keyword} a step")
|
48
|
-
data = scenario.parsing_data
|
46
|
+
describe 'parsing data' do
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
|
49
|
+
scenario = clazz.new("@tag\n#{SCENARIO_KEYWORD}: test scenario\ndescription\n#{STEP_KEYWORD} a step")
|
50
|
+
data = scenario.parsing_data
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
expect(data.keys).to match_array([:background, :rule, :scenario])
|
53
|
+
expect(data[:scenario][:name]).to eq('test scenario')
|
54
|
+
end
|
57
55
|
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
|
57
|
+
scenario = clazz.new("@tag\n#{SCENARIO_KEYWORD}: test scenario\ndescription\n#{STEP_KEYWORD} a step")
|
58
|
+
data = scenario.parsing_data
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :description])
|
61
|
+
expect(data[:type]).to eq(:Scenario)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
65
|
+
scenario = clazz.new("@tag\n#{SCENARIO_KEYWORD}: test scenario\ndescription\n#{STEP_KEYWORD} a step")
|
66
|
+
data = scenario.parsing_data
|
67
|
+
|
68
|
+
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'steps', 'tags'])
|
69
|
+
expect(data['keyword']).to eq('Scenario')
|
70
|
+
end
|
65
71
|
|
66
|
-
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'steps', 'tags'])
|
67
|
-
expect(data['keyword']).to eq('Scenario')
|
68
72
|
end
|
69
73
|
|
70
74
|
it 'properly sets its child models' do
|
71
75
|
source = "@a_tag
|
72
|
-
#{
|
73
|
-
#{
|
76
|
+
#{SCENARIO_KEYWORD}: Test scenario
|
77
|
+
#{STEP_KEYWORD} a step"
|
74
78
|
|
75
79
|
scenario = clazz.new(source)
|
76
80
|
step = scenario.steps.first
|
@@ -81,7 +85,7 @@ describe 'Scenario, Integration' do
|
|
81
85
|
end
|
82
86
|
|
83
87
|
it 'trims whitespace from its source description' do
|
84
|
-
source = ["#{
|
88
|
+
source = ["#{SCENARIO_KEYWORD}:",
|
85
89
|
' ',
|
86
90
|
' description line 1',
|
87
91
|
'',
|
@@ -90,7 +94,7 @@ describe 'Scenario, Integration' do
|
|
90
94
|
'',
|
91
95
|
'',
|
92
96
|
'',
|
93
|
-
" #{
|
97
|
+
" #{STEP_KEYWORD} a step"]
|
94
98
|
source = source.join("\n")
|
95
99
|
|
96
100
|
scenario = clazz.new(source)
|
@@ -111,10 +115,10 @@ describe 'Scenario, Integration' do
|
|
111
115
|
|
112
116
|
|
113
117
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
114
|
-
let(:source_gherkin) { "#{
|
118
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
115
119
|
|
116
|
-
#{
|
117
|
-
#{
|
120
|
+
#{SCENARIO_KEYWORD}: Test test
|
121
|
+
#{STEP_KEYWORD} a step"
|
118
122
|
}
|
119
123
|
|
120
124
|
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
@@ -152,19 +156,19 @@ describe 'Scenario, Integration' do
|
|
152
156
|
|
153
157
|
context 'from source text' do
|
154
158
|
|
155
|
-
let(:source_text) { "#{
|
159
|
+
let(:source_text) { "#{SCENARIO_KEYWORD}:" }
|
156
160
|
let(:scenario) { clazz.new(source_text) }
|
157
161
|
|
158
162
|
|
159
163
|
it "models the scenario's keyword" do
|
160
|
-
expect(scenario.keyword).to eq("#{
|
164
|
+
expect(scenario.keyword).to eq("#{SCENARIO_KEYWORD}")
|
161
165
|
end
|
162
166
|
|
163
167
|
it "models the scenario's source line" do
|
164
|
-
source_text = "#{
|
168
|
+
source_text = "#{FEATURE_KEYWORD}:
|
165
169
|
|
166
|
-
#{
|
167
|
-
#{
|
170
|
+
#{SCENARIO_KEYWORD}: foo
|
171
|
+
#{STEP_KEYWORD} step"
|
168
172
|
scenario = CukeModeler::Feature.new(source_text).tests.first
|
169
173
|
|
170
174
|
expect(scenario.source_line).to eq(3)
|
@@ -174,15 +178,15 @@ describe 'Scenario, Integration' do
|
|
174
178
|
context 'a filled scenario' do
|
175
179
|
|
176
180
|
let(:source_text) { "@tag1 @tag2 @tag3
|
177
|
-
#{
|
181
|
+
#{SCENARIO_KEYWORD}: Scenario name
|
178
182
|
|
179
183
|
Scenario description.
|
180
184
|
|
181
185
|
Some more.
|
182
186
|
Even more.
|
183
187
|
|
184
|
-
#{
|
185
|
-
#{
|
188
|
+
#{STEP_KEYWORD} a step
|
189
|
+
#{STEP_KEYWORD} another step" }
|
186
190
|
let(:scenario) { clazz.new(source_text) }
|
187
191
|
|
188
192
|
|
@@ -215,7 +219,7 @@ describe 'Scenario, Integration' do
|
|
215
219
|
|
216
220
|
context 'an empty scenario' do
|
217
221
|
|
218
|
-
let(:source_text) { "#{
|
222
|
+
let(:source_text) { "#{SCENARIO_KEYWORD}:" }
|
219
223
|
let(:scenario) { clazz.new(source_text) }
|
220
224
|
|
221
225
|
|
@@ -245,19 +249,19 @@ describe 'Scenario, Integration' do
|
|
245
249
|
describe 'comparison' do
|
246
250
|
|
247
251
|
it 'is equal to a background with the same steps' do
|
248
|
-
source = "#{
|
249
|
-
#{
|
250
|
-
#{
|
252
|
+
source = "#{SCENARIO_KEYWORD}:
|
253
|
+
#{STEP_KEYWORD} step 1
|
254
|
+
#{STEP_KEYWORD} step 2"
|
251
255
|
scenario = clazz.new(source)
|
252
256
|
|
253
|
-
source = "#{
|
254
|
-
#{
|
255
|
-
#{
|
257
|
+
source = "#{BACKGROUND_KEYWORD}:
|
258
|
+
#{STEP_KEYWORD} step 1
|
259
|
+
#{STEP_KEYWORD} step 2"
|
256
260
|
background_1 = CukeModeler::Background.new(source)
|
257
261
|
|
258
|
-
source = "#{
|
259
|
-
#{
|
260
|
-
#{
|
262
|
+
source = "#{BACKGROUND_KEYWORD}:
|
263
|
+
#{STEP_KEYWORD} step 2
|
264
|
+
#{STEP_KEYWORD} step 1"
|
261
265
|
background_2 = CukeModeler::Background.new(source)
|
262
266
|
|
263
267
|
|
@@ -266,19 +270,19 @@ describe 'Scenario, Integration' do
|
|
266
270
|
end
|
267
271
|
|
268
272
|
it 'is equal to a scenario with the same steps' do
|
269
|
-
source = "#{
|
270
|
-
#{
|
271
|
-
#{
|
273
|
+
source = "#{SCENARIO_KEYWORD}:
|
274
|
+
#{STEP_KEYWORD} step 1
|
275
|
+
#{STEP_KEYWORD} step 2"
|
272
276
|
scenario_1 = clazz.new(source)
|
273
277
|
|
274
|
-
source = "#{
|
275
|
-
#{
|
276
|
-
#{
|
278
|
+
source = "#{SCENARIO_KEYWORD}:
|
279
|
+
#{STEP_KEYWORD} step 1
|
280
|
+
#{STEP_KEYWORD} step 2"
|
277
281
|
scenario_2 = clazz.new(source)
|
278
282
|
|
279
|
-
source = "#{
|
280
|
-
#{
|
281
|
-
#{
|
283
|
+
source = "#{SCENARIO_KEYWORD}:
|
284
|
+
#{STEP_KEYWORD} step 2
|
285
|
+
#{STEP_KEYWORD} step 1"
|
282
286
|
scenario_3 = clazz.new(source)
|
283
287
|
|
284
288
|
|
@@ -287,23 +291,23 @@ describe 'Scenario, Integration' do
|
|
287
291
|
end
|
288
292
|
|
289
293
|
it 'is equal to an outline with the same steps' do
|
290
|
-
source = "#{
|
291
|
-
#{
|
292
|
-
#{
|
294
|
+
source = "#{SCENARIO_KEYWORD}:
|
295
|
+
#{STEP_KEYWORD} step 1
|
296
|
+
#{STEP_KEYWORD} step 2"
|
293
297
|
scenario = clazz.new(source)
|
294
298
|
|
295
|
-
source = "#{
|
296
|
-
#{
|
297
|
-
#{
|
298
|
-
#{
|
299
|
+
source = "#{OUTLINE_KEYWORD}:
|
300
|
+
#{STEP_KEYWORD} step 1
|
301
|
+
#{STEP_KEYWORD} step 2
|
302
|
+
#{EXAMPLE_KEYWORD}:
|
299
303
|
| param |
|
300
304
|
| value |"
|
301
305
|
outline_1 = CukeModeler::Outline.new(source)
|
302
306
|
|
303
|
-
source = "#{
|
304
|
-
#{
|
305
|
-
#{
|
306
|
-
#{
|
307
|
+
source = "#{OUTLINE_KEYWORD}:
|
308
|
+
#{STEP_KEYWORD} step 2
|
309
|
+
#{STEP_KEYWORD} step 1
|
310
|
+
#{EXAMPLE_KEYWORD}:
|
307
311
|
| param |
|
308
312
|
| value |"
|
309
313
|
outline_2 = CukeModeler::Outline.new(source)
|
@@ -320,14 +324,14 @@ describe 'Scenario, Integration' do
|
|
320
324
|
|
321
325
|
it 'can be remade from its own output' do
|
322
326
|
source = "@tag1 @tag2 @tag3
|
323
|
-
#{
|
327
|
+
#{SCENARIO_KEYWORD}: A scenario with everything it could have
|
324
328
|
|
325
329
|
Including a description
|
326
330
|
and then some.
|
327
331
|
|
328
|
-
#{
|
332
|
+
#{STEP_KEYWORD} a step
|
329
333
|
| value |
|
330
|
-
#{
|
334
|
+
#{STEP_KEYWORD} another step
|
331
335
|
\"\"\"
|
332
336
|
some string
|
333
337
|
\"\"\""
|
@@ -343,27 +347,27 @@ describe 'Scenario, Integration' do
|
|
343
347
|
context 'from source text' do
|
344
348
|
|
345
349
|
it 'can output an empty scenario' do
|
346
|
-
source = ["#{
|
350
|
+
source = ["#{SCENARIO_KEYWORD}:"]
|
347
351
|
source = source.join("\n")
|
348
352
|
scenario = clazz.new(source)
|
349
353
|
|
350
354
|
scenario_output = scenario.to_s.split("\n", -1)
|
351
355
|
|
352
|
-
expect(scenario_output).to eq(["#{
|
356
|
+
expect(scenario_output).to eq(["#{SCENARIO_KEYWORD}:"])
|
353
357
|
end
|
354
358
|
|
355
359
|
it 'can output a scenario that has a name' do
|
356
|
-
source = ["#{
|
360
|
+
source = ["#{SCENARIO_KEYWORD}: test scenario"]
|
357
361
|
source = source.join("\n")
|
358
362
|
scenario = clazz.new(source)
|
359
363
|
|
360
364
|
scenario_output = scenario.to_s.split("\n", -1)
|
361
365
|
|
362
|
-
expect(scenario_output).to eq(["#{
|
366
|
+
expect(scenario_output).to eq(["#{SCENARIO_KEYWORD}: test scenario"])
|
363
367
|
end
|
364
368
|
|
365
369
|
it 'can output a scenario that has a description' do
|
366
|
-
source = ["#{
|
370
|
+
source = ["#{SCENARIO_KEYWORD}:",
|
367
371
|
'Some description.',
|
368
372
|
'Some more description.']
|
369
373
|
source = source.join("\n")
|
@@ -371,17 +375,17 @@ describe 'Scenario, Integration' do
|
|
371
375
|
|
372
376
|
scenario_output = scenario.to_s.split("\n", -1)
|
373
377
|
|
374
|
-
expect(scenario_output).to eq(["#{
|
378
|
+
expect(scenario_output).to eq(["#{SCENARIO_KEYWORD}:",
|
375
379
|
'',
|
376
380
|
'Some description.',
|
377
381
|
'Some more description.'])
|
378
382
|
end
|
379
383
|
|
380
384
|
it 'can output a scenario that has steps' do
|
381
|
-
source = ["#{
|
382
|
-
"#{
|
385
|
+
source = ["#{SCENARIO_KEYWORD}:",
|
386
|
+
"#{STEP_KEYWORD} a step",
|
383
387
|
'|value|',
|
384
|
-
"#{
|
388
|
+
"#{STEP_KEYWORD} another step",
|
385
389
|
'"""',
|
386
390
|
'some string',
|
387
391
|
'"""']
|
@@ -390,10 +394,10 @@ describe 'Scenario, Integration' do
|
|
390
394
|
|
391
395
|
scenario_output = scenario.to_s.split("\n", -1)
|
392
396
|
|
393
|
-
expect(scenario_output).to eq(["#{
|
394
|
-
" #{
|
397
|
+
expect(scenario_output).to eq(["#{SCENARIO_KEYWORD}:",
|
398
|
+
" #{STEP_KEYWORD} a step",
|
395
399
|
' | value |',
|
396
|
-
" #{
|
400
|
+
" #{STEP_KEYWORD} another step",
|
397
401
|
' """',
|
398
402
|
' some string',
|
399
403
|
' """'])
|
@@ -402,24 +406,24 @@ describe 'Scenario, Integration' do
|
|
402
406
|
it 'can output a scenario that has tags' do
|
403
407
|
source = ['@tag1 @tag2',
|
404
408
|
'@tag3',
|
405
|
-
"#{
|
409
|
+
"#{SCENARIO_KEYWORD}:"]
|
406
410
|
source = source.join("\n")
|
407
411
|
scenario = clazz.new(source)
|
408
412
|
|
409
413
|
scenario_output = scenario.to_s.split("\n", -1)
|
410
414
|
|
411
415
|
expect(scenario_output).to eq(['@tag1 @tag2 @tag3',
|
412
|
-
"#{
|
416
|
+
"#{SCENARIO_KEYWORD}:"])
|
413
417
|
end
|
414
418
|
|
415
419
|
it 'can output a scenario that has everything' do
|
416
420
|
source = ['@tag1 @tag2 @tag3',
|
417
|
-
"#{
|
421
|
+
"#{SCENARIO_KEYWORD}: A scenario with everything it could have",
|
418
422
|
'Including a description',
|
419
423
|
'and then some.',
|
420
|
-
"#{
|
424
|
+
"#{STEP_KEYWORD} a step",
|
421
425
|
'|value|',
|
422
|
-
"#{
|
426
|
+
"#{STEP_KEYWORD} another step",
|
423
427
|
'"""',
|
424
428
|
'some string',
|
425
429
|
'"""']
|
@@ -429,14 +433,14 @@ describe 'Scenario, Integration' do
|
|
429
433
|
scenario_output = scenario.to_s.split("\n", -1)
|
430
434
|
|
431
435
|
expect(scenario_output).to eq(['@tag1 @tag2 @tag3',
|
432
|
-
"#{
|
436
|
+
"#{SCENARIO_KEYWORD}: A scenario with everything it could have",
|
433
437
|
'',
|
434
438
|
'Including a description',
|
435
439
|
'and then some.',
|
436
440
|
'',
|
437
|
-
" #{
|
441
|
+
" #{STEP_KEYWORD} a step",
|
438
442
|
' | value |',
|
439
|
-
" #{
|
443
|
+
" #{STEP_KEYWORD} another step",
|
440
444
|
' """',
|
441
445
|
' some string',
|
442
446
|
' """'])
|