cuke_modeler 1.3.0 → 2.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.
- 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/{cell_integration_spec.rb → models/cell_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 'Cell, Integration' do
|
|
@@ -44,30 +44,41 @@ describe 'Cell, Integration' do
|
|
|
44
44
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_cell\.feature'/)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
cell = clazz.new('a cell')
|
|
49
|
-
data = cell.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?(6, 7, 8, 9) do
|
|
50
|
+
cell = clazz.new('a cell')
|
|
51
|
+
data = cell.parsing_data
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
expect(data.keys).to match_array([:location, :value])
|
|
54
|
+
expect(data[:value]).to eq('a cell')
|
|
55
|
+
end
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
|
|
58
|
+
cell = clazz.new('a cell')
|
|
59
|
+
data = cell.parsing_data
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
expect(data.keys).to match_array([:type, :location, :value])
|
|
62
|
+
expect(data[:type]).to eq(:TableCell)
|
|
63
|
+
end
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
|
|
66
|
+
cell = clazz.new("a cell")
|
|
67
|
+
data = cell.parsing_data
|
|
70
68
|
|
|
69
|
+
expect(data.keys).to match_array([:type, :location, :value])
|
|
70
|
+
expect(data[:type]).to eq('TableCell')
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
|
74
|
+
cell = clazz.new("a cell")
|
|
75
|
+
data = cell.parsing_data
|
|
76
|
+
|
|
77
|
+
# Cells did not exist as full fledged objects in the Gherkin2 parser
|
|
78
|
+
expect(data).to eq('a cell')
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
end
|
|
71
82
|
|
|
72
83
|
describe 'getting ancestors' do
|
|
73
84
|
|
|
@@ -77,10 +88,10 @@ describe 'Cell, Integration' do
|
|
|
77
88
|
|
|
78
89
|
|
|
79
90
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
80
|
-
let(:source_gherkin) { "#{
|
|
91
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
81
92
|
|
|
82
|
-
#{
|
|
83
|
-
#{
|
|
93
|
+
#{SCENARIO_KEYWORD}: Test test
|
|
94
|
+
#{STEP_KEYWORD} a step
|
|
84
95
|
| a value |"
|
|
85
96
|
}
|
|
86
97
|
|
|
@@ -109,11 +120,11 @@ describe 'Cell, Integration' do
|
|
|
109
120
|
context 'a cell that is part of an outline' do
|
|
110
121
|
|
|
111
122
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
112
|
-
let(:source_gherkin) { "#{
|
|
123
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
113
124
|
|
|
114
|
-
#{
|
|
115
|
-
#{
|
|
116
|
-
#{
|
|
125
|
+
#{OUTLINE_KEYWORD}: Test outline
|
|
126
|
+
#{STEP_KEYWORD} a step
|
|
127
|
+
#{EXAMPLE_KEYWORD}:
|
|
117
128
|
| param |
|
|
118
129
|
| value |"
|
|
119
130
|
}
|
|
@@ -146,10 +157,10 @@ describe 'Cell, Integration' do
|
|
|
146
157
|
context 'a cell that is part of a scenario' do
|
|
147
158
|
|
|
148
159
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
149
|
-
let(:source_gherkin) { "#{
|
|
160
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
150
161
|
|
|
151
|
-
#{
|
|
152
|
-
#{
|
|
162
|
+
#{SCENARIO_KEYWORD}: Test test
|
|
163
|
+
#{STEP_KEYWORD} a step:
|
|
153
164
|
| a | table |"
|
|
154
165
|
}
|
|
155
166
|
|
|
@@ -168,10 +179,10 @@ describe 'Cell, Integration' do
|
|
|
168
179
|
context 'a cell that is part of a background' do
|
|
169
180
|
|
|
170
181
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
171
|
-
let(:source_gherkin) { "#{
|
|
182
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
172
183
|
|
|
173
|
-
#{
|
|
174
|
-
#{
|
|
184
|
+
#{BACKGROUND_KEYWORD}: Test background
|
|
185
|
+
#{STEP_KEYWORD} a step:
|
|
175
186
|
| a | table |"
|
|
176
187
|
}
|
|
177
188
|
|
|
@@ -190,10 +201,10 @@ describe 'Cell, Integration' do
|
|
|
190
201
|
context 'a cell that is part of a step' do
|
|
191
202
|
|
|
192
203
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
193
|
-
let(:source_gherkin) { "#{
|
|
204
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
194
205
|
|
|
195
|
-
#{
|
|
196
|
-
#{
|
|
206
|
+
#{SCENARIO_KEYWORD}: Test test
|
|
207
|
+
#{STEP_KEYWORD} a step:
|
|
197
208
|
| a | table |"
|
|
198
209
|
}
|
|
199
210
|
|
|
@@ -243,10 +254,10 @@ describe 'Cell, Integration' do
|
|
|
243
254
|
end
|
|
244
255
|
|
|
245
256
|
it "models the cell's source line" do
|
|
246
|
-
source_text = "#{
|
|
257
|
+
source_text = "#{FEATURE_KEYWORD}:
|
|
247
258
|
|
|
248
|
-
#{
|
|
249
|
-
#{
|
|
259
|
+
#{SCENARIO_KEYWORD}:
|
|
260
|
+
#{STEP_KEYWORD} a step
|
|
250
261
|
| value |"
|
|
251
262
|
cell = CukeModeler::Feature.new(source_text).tests.first.steps.first.block.rows.first.cells.first
|
|
252
263
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "#{File.dirname(__FILE__)}
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../../spec_helper"
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
describe 'Comment, Integration' do
|
|
@@ -44,29 +44,40 @@ describe 'Comment, Integration' do
|
|
|
44
44
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_comment\.feature'/)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
comment = clazz.new('# a comment')
|
|
49
|
-
data = comment.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?(6, 7, 8, 9) do
|
|
50
|
+
comment = clazz.new('# a comment')
|
|
51
|
+
data = comment.parsing_data
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
expect(data.keys).to match_array([:location, :text])
|
|
54
|
+
expect(data[:text]).to eq('# a comment')
|
|
55
|
+
end
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
|
|
58
|
+
comment = clazz.new('# a comment')
|
|
59
|
+
data = comment.parsing_data
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
expect(data.keys).to match_array([:type, :location, :text])
|
|
62
|
+
expect(data[:type]).to eq(:Comment)
|
|
63
|
+
end
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
|
|
66
|
+
comment = clazz.new('# a comment')
|
|
67
|
+
data = comment.parsing_data
|
|
69
68
|
|
|
69
|
+
expect(data.keys).to match_array([:type, :location, :text])
|
|
70
|
+
expect(data[:type]).to eq('Comment')
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
|
74
|
+
comment = clazz.new('# a comment')
|
|
75
|
+
data = comment.parsing_data
|
|
76
|
+
|
|
77
|
+
expect(data.keys).to match_array(['value', 'line'])
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
70
81
|
|
|
71
82
|
describe 'getting ancestors' do
|
|
72
83
|
|
|
@@ -77,7 +88,7 @@ describe 'Comment, Integration' do
|
|
|
77
88
|
|
|
78
89
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
79
90
|
let(:source_gherkin) { "# feature comment
|
|
80
|
-
#{
|
|
91
|
+
#{FEATURE_KEYWORD}: Test feature"
|
|
81
92
|
}
|
|
82
93
|
|
|
83
94
|
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
|
@@ -119,7 +130,7 @@ describe 'Comment, Integration' do
|
|
|
119
130
|
|
|
120
131
|
it "models the comment's source line" do
|
|
121
132
|
source_text = "# a comment
|
|
122
|
-
#{
|
|
133
|
+
#{FEATURE_KEYWORD}:"
|
|
123
134
|
|
|
124
135
|
test_file_path = CukeModeler::FileHelper.create_feature_file(:text => source_text, :name => 'comment_test_file')
|
|
125
136
|
comment = CukeModeler::FeatureFile.new(test_file_path).comments.first
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "#{File.dirname(__FILE__)}
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../../spec_helper"
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
describe 'Directory, Integration' do
|
|
@@ -46,7 +46,7 @@ describe 'Directory, Integration' do
|
|
|
46
46
|
before(:each) do
|
|
47
47
|
feature_files.each do |file_name|
|
|
48
48
|
# Some versions of Gherkin require feature content to be present in feature files
|
|
49
|
-
CukeModeler::FileHelper.create_feature_file(:text => "#{
|
|
49
|
+
CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: Test feature", :name => file_name, :directory => directory_path)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
non_feature_files.each do |file_name|
|
|
@@ -146,7 +146,7 @@ describe 'Directory, Integration' do
|
|
|
146
146
|
directory_path = CukeModeler::FileHelper.create_directory
|
|
147
147
|
_nested_directory_path = CukeModeler::FileHelper.create_directory(:name => 'nested_directory', :directory => directory_path)
|
|
148
148
|
|
|
149
|
-
CukeModeler::FileHelper.create_feature_file(:text => "#{
|
|
149
|
+
CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: Test feature", :name => 'test_file', :directory => directory_path)
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
directory_model = clazz.new(directory_path)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "#{File.dirname(__FILE__)}
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../../spec_helper"
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
describe 'DocString, Integration' do
|
|
@@ -43,28 +43,32 @@ describe 'DocString, Integration' do
|
|
|
43
43
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_doc_string\.feature'/)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
|
|
48
|
-
data = doc_string.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
|
+
doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
|
|
50
|
+
data = doc_string.parsing_data
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
expect(data.keys).to match_array([:location, :content, :content_type, :delimiter])
|
|
53
|
+
expect(data[:content]).to eq('some doc string')
|
|
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
|
+
doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
|
|
58
|
+
data = doc_string.parsing_data
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
expect(data.keys).to match_array([:type, :location, :content, :contentType])
|
|
61
|
+
expect(data[:type]).to eq(:DocString)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
|
65
|
+
doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
|
|
66
|
+
data = doc_string.parsing_data
|
|
67
|
+
|
|
68
|
+
expect(data.keys).to match_array(['value', 'content_type', 'line'])
|
|
69
|
+
expect(data['value']).to eq('some doc string')
|
|
70
|
+
end
|
|
65
71
|
|
|
66
|
-
expect(data.keys).to match_array(['value', 'content_type', 'line'])
|
|
67
|
-
expect(data['value']).to eq('some doc string')
|
|
68
72
|
end
|
|
69
73
|
|
|
70
74
|
it 'stores its content as a String' do
|
|
@@ -85,10 +89,10 @@ describe 'DocString, Integration' do
|
|
|
85
89
|
|
|
86
90
|
|
|
87
91
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
88
|
-
let(:source_gherkin) { "#{
|
|
92
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
89
93
|
|
|
90
|
-
#{
|
|
91
|
-
#{
|
|
94
|
+
#{SCENARIO_KEYWORD}: Test test
|
|
95
|
+
#{STEP_KEYWORD} a big step:
|
|
92
96
|
\"\"\"
|
|
93
97
|
a
|
|
94
98
|
doc
|
|
@@ -121,10 +125,10 @@ describe 'DocString, Integration' do
|
|
|
121
125
|
context 'a doc string that is part of a scenario' do
|
|
122
126
|
|
|
123
127
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
124
|
-
let(:source_gherkin) { "#{
|
|
128
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
125
129
|
|
|
126
|
-
#{
|
|
127
|
-
#{
|
|
130
|
+
#{SCENARIO_KEYWORD}: Test test
|
|
131
|
+
#{STEP_KEYWORD} a big step:
|
|
128
132
|
\"\"\"
|
|
129
133
|
a
|
|
130
134
|
doc
|
|
@@ -147,16 +151,16 @@ describe 'DocString, Integration' do
|
|
|
147
151
|
context 'a doc string that is part of an outline' do
|
|
148
152
|
|
|
149
153
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
150
|
-
let(:source_gherkin) { "#{
|
|
154
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
151
155
|
|
|
152
|
-
#{
|
|
153
|
-
#{
|
|
156
|
+
#{OUTLINE_KEYWORD}: Test outline
|
|
157
|
+
#{STEP_KEYWORD} a big step:
|
|
154
158
|
\"\"\"
|
|
155
159
|
a
|
|
156
160
|
doc
|
|
157
161
|
string
|
|
158
162
|
\"\"\"
|
|
159
|
-
#{
|
|
163
|
+
#{EXAMPLE_KEYWORD}:
|
|
160
164
|
| param |
|
|
161
165
|
| value |"
|
|
162
166
|
}
|
|
@@ -176,10 +180,10 @@ describe 'DocString, Integration' do
|
|
|
176
180
|
context 'a doc string that is part of a background' do
|
|
177
181
|
|
|
178
182
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
179
|
-
let(:source_gherkin) { "#{
|
|
183
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
180
184
|
|
|
181
|
-
#{
|
|
182
|
-
#{
|
|
185
|
+
#{BACKGROUND_KEYWORD}: Test background
|
|
186
|
+
#{STEP_KEYWORD} a big step:
|
|
183
187
|
\"\"\"
|
|
184
188
|
a
|
|
185
189
|
doc
|
|
@@ -253,10 +257,10 @@ describe 'DocString, Integration' do
|
|
|
253
257
|
end
|
|
254
258
|
|
|
255
259
|
it "models the doc string's source line" do
|
|
256
|
-
source_text = "#{
|
|
260
|
+
source_text = "#{FEATURE_KEYWORD}:
|
|
257
261
|
|
|
258
|
-
#{
|
|
259
|
-
#{
|
|
262
|
+
#{SCENARIO_KEYWORD}:
|
|
263
|
+
#{STEP_KEYWORD} step
|
|
260
264
|
\"\"\"
|
|
261
265
|
foo
|
|
262
266
|
\"\"\""
|
|
@@ -274,7 +278,7 @@ describe 'DocString, Integration' do
|
|
|
274
278
|
|
|
275
279
|
it 'can be remade from its own output' do
|
|
276
280
|
source = ['"""" the type',
|
|
277
|
-
"#{
|
|
281
|
+
"#{STEP_KEYWORD} a step",
|
|
278
282
|
' \"\"\"',
|
|
279
283
|
' that also has a doc string',
|
|
280
284
|
' \"\"\"',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "#{File.dirname(__FILE__)}
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../../spec_helper"
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
describe 'Example, Integration' do
|
|
@@ -15,22 +15,22 @@ describe 'Example, Integration' do
|
|
|
15
15
|
|
|
16
16
|
describe 'unique behavior' do
|
|
17
17
|
|
|
18
|
-
it 'can be instantiated with the minimum viable Gherkin', :
|
|
19
|
-
source = "#{
|
|
18
|
+
it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(4, 5, 6, 7, 8, 9) do
|
|
19
|
+
source = "#{EXAMPLE_KEYWORD}:"
|
|
20
20
|
|
|
21
21
|
expect { @model = clazz.new(source) }.to_not raise_error
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
it 'can be instantiated with the minimum viable Gherkin', :
|
|
25
|
-
source = "#{
|
|
24
|
+
it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(3) do
|
|
25
|
+
source = "#{EXAMPLE_KEYWORD}:
|
|
26
26
|
|param|
|
|
27
27
|
|value|"
|
|
28
28
|
|
|
29
29
|
expect { @model = clazz.new(source) }.to_not raise_error
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
it 'can be instantiated with the minimum viable Gherkin', :
|
|
33
|
-
source = "#{
|
|
32
|
+
it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(2) do
|
|
33
|
+
source = "#{EXAMPLE_KEYWORD}:
|
|
34
34
|
|param|"
|
|
35
35
|
|
|
36
36
|
expect { @model = clazz.new(source) }.to_not raise_error
|
|
@@ -55,28 +55,32 @@ describe 'Example, Integration' do
|
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
example = clazz.new("@tag\n#{@example_keyword}: test example\ndescription\n|param|\n|value|")
|
|
60
|
-
data = example.parsing_data
|
|
58
|
+
describe 'parsing data' do
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
|
|
61
|
+
example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
|
|
62
|
+
data = example.parsing_data
|
|
65
63
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
expect(data.keys).to match_array([:tags, :location, :keyword, :name, :table_header, :table_body, :description])
|
|
65
|
+
expect(data[:name]).to eq('test example')
|
|
66
|
+
end
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
|
|
69
|
+
example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
|
|
70
|
+
data = example.parsing_data
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody, :description])
|
|
73
|
+
expect(data[:type]).to eq(:Examples)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
|
|
77
|
+
example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
|
|
78
|
+
data = example.parsing_data
|
|
79
|
+
|
|
80
|
+
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows', 'tags'])
|
|
81
|
+
expect(data['keyword']).to eq('Examples')
|
|
82
|
+
end
|
|
77
83
|
|
|
78
|
-
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows', 'tags'])
|
|
79
|
-
expect(data['keyword']).to eq('Examples')
|
|
80
84
|
end
|
|
81
85
|
|
|
82
86
|
it 'provides a descriptive filename when being parsed from stand alone text' do
|
|
@@ -86,7 +90,7 @@ describe 'Example, Integration' do
|
|
|
86
90
|
end
|
|
87
91
|
|
|
88
92
|
it 'trims whitespace from its source description' do
|
|
89
|
-
source = ["#{
|
|
93
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
|
90
94
|
' ',
|
|
91
95
|
' description line 1',
|
|
92
96
|
'',
|
|
@@ -113,21 +117,43 @@ describe 'Example, Integration' do
|
|
|
113
117
|
|
|
114
118
|
context 'from source text' do
|
|
115
119
|
|
|
116
|
-
let(:source_text) { "#{
|
|
120
|
+
let(:source_text) { "#{EXAMPLE_KEYWORD}:" }
|
|
117
121
|
let(:example) { clazz.new(source_text) }
|
|
118
122
|
|
|
119
123
|
|
|
120
124
|
# gherkin 2.x/3.x does not accept incomplete examples
|
|
121
|
-
it "models the example's keyword", :
|
|
122
|
-
expect(example.keyword).to eq("#{
|
|
125
|
+
it "models the example's keyword", :unless => gherkin?(2, 3) do
|
|
126
|
+
expect(example.keyword).to eq("#{EXAMPLE_KEYWORD}")
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
context 'using gherkin 2.x', :if => gherkin?(2) do
|
|
130
|
+
|
|
131
|
+
let(:source_text) { "#{EXAMPLE_KEYWORD}:\n|param|" }
|
|
132
|
+
let(:example) { clazz.new(source_text) }
|
|
133
|
+
|
|
134
|
+
it "models the example's keyword" do
|
|
135
|
+
expect(example.keyword).to eq(EXAMPLE_KEYWORD)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
context 'using gherkin 3.x', :if => gherkin?(3) do
|
|
141
|
+
|
|
142
|
+
let(:source_text) { "#{EXAMPLE_KEYWORD}:\n|param|\n|value|" }
|
|
143
|
+
let(:example) { clazz.new(source_text) }
|
|
144
|
+
|
|
145
|
+
it "models the example's keyword" do
|
|
146
|
+
expect(example.keyword).to eq(EXAMPLE_KEYWORD)
|
|
147
|
+
end
|
|
148
|
+
|
|
123
149
|
end
|
|
124
150
|
|
|
125
151
|
it "models the example's source line" do
|
|
126
|
-
source_text = "#{
|
|
152
|
+
source_text = "#{FEATURE_KEYWORD}:
|
|
127
153
|
|
|
128
|
-
#{
|
|
129
|
-
#{
|
|
130
|
-
#{
|
|
154
|
+
#{OUTLINE_KEYWORD}:
|
|
155
|
+
#{STEP_KEYWORD} step
|
|
156
|
+
#{EXAMPLE_KEYWORD}:
|
|
131
157
|
| param |
|
|
132
158
|
| value |"
|
|
133
159
|
example = CukeModeler::Feature.new(source_text).tests.first.examples.first
|
|
@@ -139,7 +165,7 @@ describe 'Example, Integration' do
|
|
|
139
165
|
context 'a filled example' do
|
|
140
166
|
|
|
141
167
|
let(:source_text) { "@tag1 @tag2 @tag3
|
|
142
|
-
#{
|
|
168
|
+
#{EXAMPLE_KEYWORD}: test example
|
|
143
169
|
|
|
144
170
|
Some example description.
|
|
145
171
|
|
|
@@ -183,9 +209,9 @@ describe 'Example, Integration' do
|
|
|
183
209
|
end
|
|
184
210
|
|
|
185
211
|
# gherkin 2.x/3.x does not accept incomplete examples
|
|
186
|
-
context 'an empty example', :
|
|
212
|
+
context 'an empty example', :unless => gherkin?(2, 3) do
|
|
187
213
|
|
|
188
|
-
let(:source_text) { "#{
|
|
214
|
+
let(:source_text) { "#{EXAMPLE_KEYWORD}:" }
|
|
189
215
|
let(:example) { clazz.new(source_text) }
|
|
190
216
|
|
|
191
217
|
|
|
@@ -214,7 +240,7 @@ describe 'Example, Integration' do
|
|
|
214
240
|
|
|
215
241
|
it 'properly sets its child models' do
|
|
216
242
|
source = "@a_tag
|
|
217
|
-
#{
|
|
243
|
+
#{EXAMPLE_KEYWORD}:
|
|
218
244
|
| param |
|
|
219
245
|
| value 1 |"
|
|
220
246
|
|
|
@@ -228,7 +254,7 @@ describe 'Example, Integration' do
|
|
|
228
254
|
end
|
|
229
255
|
|
|
230
256
|
it 'does not include the parameter row when accessing argument rows' do
|
|
231
|
-
source = "#{
|
|
257
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
|
232
258
|
example = clazz.new(source)
|
|
233
259
|
|
|
234
260
|
rows = example.argument_rows
|
|
@@ -238,7 +264,7 @@ describe 'Example, Integration' do
|
|
|
238
264
|
end
|
|
239
265
|
|
|
240
266
|
it 'does not include argument rows when accessing the parameter row' do
|
|
241
|
-
source = "#{
|
|
267
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
|
242
268
|
example = clazz.new(source)
|
|
243
269
|
|
|
244
270
|
row = example.parameter_row
|
|
@@ -251,7 +277,7 @@ describe 'Example, Integration' do
|
|
|
251
277
|
describe 'adding rows' do
|
|
252
278
|
|
|
253
279
|
it 'can add a new row as a hash, string values' do
|
|
254
|
-
source = "#{
|
|
280
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
|
255
281
|
example = clazz.new(source)
|
|
256
282
|
|
|
257
283
|
new_row = {'param1' => 'value3', 'param2' => 'value4'}
|
|
@@ -262,7 +288,7 @@ describe 'Example, Integration' do
|
|
|
262
288
|
end
|
|
263
289
|
|
|
264
290
|
it 'can add a new row as a hash, non-string values' do
|
|
265
|
-
source = "#{
|
|
291
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
|
266
292
|
example = clazz.new(source)
|
|
267
293
|
|
|
268
294
|
new_row = {:param1 => 'value3', 'param2' => 4}
|
|
@@ -273,7 +299,7 @@ describe 'Example, Integration' do
|
|
|
273
299
|
end
|
|
274
300
|
|
|
275
301
|
it 'can add a new row as a hash, random key order' do
|
|
276
|
-
source = "#{
|
|
302
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
|
277
303
|
example = clazz.new(source)
|
|
278
304
|
|
|
279
305
|
new_row = {'param2' => 'value4', 'param1' => 'value3'}
|
|
@@ -284,7 +310,7 @@ describe 'Example, Integration' do
|
|
|
284
310
|
end
|
|
285
311
|
|
|
286
312
|
it 'can add a new row as an array, string values' do
|
|
287
|
-
source = "#{
|
|
313
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
|
288
314
|
example = clazz.new(source)
|
|
289
315
|
|
|
290
316
|
new_row = ['value3', 'value4']
|
|
@@ -295,7 +321,7 @@ describe 'Example, Integration' do
|
|
|
295
321
|
end
|
|
296
322
|
|
|
297
323
|
it 'can add a new row as an array, non-string values' do
|
|
298
|
-
source = "#{
|
|
324
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|param3|\n|value1|value2|value3|"
|
|
299
325
|
example = clazz.new(source)
|
|
300
326
|
|
|
301
327
|
new_row = [:value4, 5, 'value6']
|
|
@@ -306,7 +332,7 @@ describe 'Example, Integration' do
|
|
|
306
332
|
end
|
|
307
333
|
|
|
308
334
|
it 'can only use a Hash or an Array to add a new row' do
|
|
309
|
-
source = "#{
|
|
335
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param|\n|value|"
|
|
310
336
|
example = clazz.new(source)
|
|
311
337
|
|
|
312
338
|
expect { example.add_row({}) }.to_not raise_error
|
|
@@ -315,7 +341,7 @@ describe 'Example, Integration' do
|
|
|
315
341
|
end
|
|
316
342
|
|
|
317
343
|
it 'trims whitespace from added rows' do
|
|
318
|
-
source = "#{
|
|
344
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
|
319
345
|
example = clazz.new(source)
|
|
320
346
|
|
|
321
347
|
hash_row = {'param1' => 'value3 ', 'param2' => ' value4'}
|
|
@@ -339,7 +365,7 @@ describe 'Example, Integration' do
|
|
|
339
365
|
end
|
|
340
366
|
|
|
341
367
|
it 'does not modify its row input' do
|
|
342
|
-
source = "#{
|
|
368
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
|
343
369
|
example = clazz.new(source)
|
|
344
370
|
|
|
345
371
|
array_row = ['value1'.freeze, 'value2'.freeze].freeze
|
|
@@ -355,7 +381,7 @@ describe 'Example, Integration' do
|
|
|
355
381
|
describe 'removing rows' do
|
|
356
382
|
|
|
357
383
|
it 'can remove an existing row as a hash' do
|
|
358
|
-
source = "#{
|
|
384
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
|
359
385
|
example = clazz.new(source)
|
|
360
386
|
|
|
361
387
|
old_row = {'param1' => 'value3', 'param2' => 'value4'}
|
|
@@ -366,7 +392,7 @@ describe 'Example, Integration' do
|
|
|
366
392
|
end
|
|
367
393
|
|
|
368
394
|
it 'can remove an existing row as a hash, random key order' do
|
|
369
|
-
source = "#{
|
|
395
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
|
370
396
|
example = clazz.new(source)
|
|
371
397
|
|
|
372
398
|
old_row = {'param2' => 'value4', 'param1' => 'value3'}
|
|
@@ -377,7 +403,7 @@ describe 'Example, Integration' do
|
|
|
377
403
|
end
|
|
378
404
|
|
|
379
405
|
it 'can remove an existing row as an array' do
|
|
380
|
-
source = "#{
|
|
406
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|"
|
|
381
407
|
example = clazz.new(source)
|
|
382
408
|
|
|
383
409
|
old_row = ['value3', 'value4']
|
|
@@ -394,7 +420,7 @@ describe 'Example, Integration' do
|
|
|
394
420
|
end
|
|
395
421
|
|
|
396
422
|
it 'trims whitespace from removed rows' do
|
|
397
|
-
source = "#{
|
|
423
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|value3|value4|\n|value5|value6|"
|
|
398
424
|
example = clazz.new(source)
|
|
399
425
|
|
|
400
426
|
# These will affect different rows
|
|
@@ -417,7 +443,7 @@ describe 'Example, Integration' do
|
|
|
417
443
|
end
|
|
418
444
|
|
|
419
445
|
it 'will not remove the parameter row' do
|
|
420
|
-
source = "#{
|
|
446
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|"
|
|
421
447
|
example = clazz.new(source)
|
|
422
448
|
|
|
423
449
|
hash_row = {'param1' => 'param1', 'param2' => 'param2'}
|
|
@@ -435,7 +461,7 @@ describe 'Example, Integration' do
|
|
|
435
461
|
end
|
|
436
462
|
|
|
437
463
|
it 'will remove an argument row that is the same as the parameter row' do
|
|
438
|
-
source = "#{
|
|
464
|
+
source = "#{EXAMPLE_KEYWORD}:\n|param1|param2|\n|value1|value2|\n|param1|param2|"
|
|
439
465
|
example = clazz.new(source)
|
|
440
466
|
|
|
441
467
|
hash_row = {'param1' => 'param1', 'param2' => 'param2'}
|
|
@@ -463,11 +489,11 @@ describe 'Example, Integration' do
|
|
|
463
489
|
|
|
464
490
|
|
|
465
491
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
466
|
-
let(:source_gherkin) { "#{
|
|
492
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
467
493
|
|
|
468
|
-
#{
|
|
469
|
-
#{
|
|
470
|
-
#{
|
|
494
|
+
#{OUTLINE_KEYWORD}: Test test
|
|
495
|
+
#{STEP_KEYWORD} a step
|
|
496
|
+
#{EXAMPLE_KEYWORD}: Test example
|
|
471
497
|
| a param |
|
|
472
498
|
| a value |"
|
|
473
499
|
}
|
|
@@ -497,11 +523,11 @@ describe 'Example, Integration' do
|
|
|
497
523
|
context 'an example that is part of an outline' do
|
|
498
524
|
|
|
499
525
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
|
500
|
-
let(:source_gherkin) { "#{
|
|
526
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
|
501
527
|
|
|
502
|
-
#{
|
|
503
|
-
#{
|
|
504
|
-
#{
|
|
528
|
+
#{OUTLINE_KEYWORD}: Test outline
|
|
529
|
+
#{STEP_KEYWORD} a step
|
|
530
|
+
#{EXAMPLE_KEYWORD}:
|
|
505
531
|
| param |
|
|
506
532
|
| value |"
|
|
507
533
|
}
|
|
@@ -531,7 +557,7 @@ describe 'Example, Integration' do
|
|
|
531
557
|
|
|
532
558
|
it 'can be remade from its own output' do
|
|
533
559
|
source = "@tag1 @tag2 @tag3
|
|
534
|
-
#{
|
|
560
|
+
#{EXAMPLE_KEYWORD}: with everything it could have
|
|
535
561
|
|
|
536
562
|
Some description.
|
|
537
563
|
Some more description.
|
|
@@ -553,7 +579,7 @@ describe 'Example, Integration' do
|
|
|
553
579
|
# and it is possible that during that process it messes up the cell's output.
|
|
554
580
|
|
|
555
581
|
it 'can correctly output a row that has special characters in it' do
|
|
556
|
-
source = ["#{
|
|
582
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
|
557
583
|
' | param with \| |',
|
|
558
584
|
' | a value with \| and \\\\ |',
|
|
559
585
|
' | a value with \\\\ |']
|
|
@@ -562,7 +588,7 @@ describe 'Example, Integration' do
|
|
|
562
588
|
|
|
563
589
|
example_output = example.to_s.split("\n", -1)
|
|
564
590
|
|
|
565
|
-
expect(example_output).to eq(["#{
|
|
591
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
|
566
592
|
' | param with \| |',
|
|
567
593
|
' | a value with \| and \\\\ |',
|
|
568
594
|
' | a value with \\\\ |'])
|
|
@@ -572,30 +598,30 @@ describe 'Example, Integration' do
|
|
|
572
598
|
context 'from source text' do
|
|
573
599
|
|
|
574
600
|
# gherkin 2.x/3.x does not accept incomplete examples
|
|
575
|
-
it 'can output an empty example', :
|
|
576
|
-
source = ["#{
|
|
601
|
+
it 'can output an empty example', :unless => gherkin?(2, 3) do
|
|
602
|
+
source = ["#{EXAMPLE_KEYWORD}:"]
|
|
577
603
|
source = source.join("\n")
|
|
578
604
|
example = clazz.new(source)
|
|
579
605
|
|
|
580
606
|
example_output = example.to_s.split("\n", -1)
|
|
581
607
|
|
|
582
|
-
expect(example_output).to eq(["#{
|
|
608
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:"])
|
|
583
609
|
end
|
|
584
610
|
|
|
585
611
|
# gherkin 2.x/3.x does not accept incomplete examples
|
|
586
|
-
it 'can output an example that has a name', :
|
|
587
|
-
source = ["#{
|
|
612
|
+
it 'can output an example that has a name', :unless => gherkin?(2, 3) do
|
|
613
|
+
source = ["#{EXAMPLE_KEYWORD}: test example"]
|
|
588
614
|
source = source.join("\n")
|
|
589
615
|
example = clazz.new(source)
|
|
590
616
|
|
|
591
617
|
example_output = example.to_s.split("\n", -1)
|
|
592
618
|
|
|
593
|
-
expect(example_output).to eq(["#{
|
|
619
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}: test example"])
|
|
594
620
|
end
|
|
595
621
|
|
|
596
622
|
# gherkin 2.x/3.x does not accept incomplete examples
|
|
597
|
-
it 'can output an example that has a description', :
|
|
598
|
-
source = ["#{
|
|
623
|
+
it 'can output an example that has a description', :unless => gherkin?(2, 3) do
|
|
624
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
|
599
625
|
'Some description.',
|
|
600
626
|
'Some more description.']
|
|
601
627
|
source = source.join("\n")
|
|
@@ -603,7 +629,7 @@ describe 'Example, Integration' do
|
|
|
603
629
|
|
|
604
630
|
example_output = example.to_s.split("\n", -1)
|
|
605
631
|
|
|
606
|
-
expect(example_output).to eq(["#{
|
|
632
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
|
607
633
|
'',
|
|
608
634
|
'Some description.',
|
|
609
635
|
'Some more description.'])
|
|
@@ -611,20 +637,20 @@ describe 'Example, Integration' do
|
|
|
611
637
|
|
|
612
638
|
|
|
613
639
|
# gherkin 3.x does not accept incomplete examples
|
|
614
|
-
it 'can output an example that has a single row', :
|
|
615
|
-
source = ["#{
|
|
640
|
+
it 'can output an example that has a single row', :unless => gherkin?(3) do
|
|
641
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
|
616
642
|
'|param1|param2|']
|
|
617
643
|
source = source.join("\n")
|
|
618
644
|
example = clazz.new(source)
|
|
619
645
|
|
|
620
646
|
example_output = example.to_s.split("\n", -1)
|
|
621
647
|
|
|
622
|
-
expect(example_output).to eq(["#{
|
|
648
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
|
623
649
|
' | param1 | param2 |'])
|
|
624
650
|
end
|
|
625
651
|
|
|
626
652
|
it 'can output an example that has multiple rows' do
|
|
627
|
-
source = ["#{
|
|
653
|
+
source = ["#{EXAMPLE_KEYWORD}:",
|
|
628
654
|
'|param1|param2|',
|
|
629
655
|
'|value1|value2|',
|
|
630
656
|
'|value3|value4|']
|
|
@@ -633,7 +659,7 @@ describe 'Example, Integration' do
|
|
|
633
659
|
|
|
634
660
|
example_output = example.to_s.split("\n", -1)
|
|
635
661
|
|
|
636
|
-
expect(example_output).to eq(["#{
|
|
662
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
|
637
663
|
' | param1 | param2 |',
|
|
638
664
|
' | value1 | value2 |',
|
|
639
665
|
' | value3 | value4 |'])
|
|
@@ -642,7 +668,7 @@ describe 'Example, Integration' do
|
|
|
642
668
|
it 'can output an example that has tags' do
|
|
643
669
|
source = ['@tag1',
|
|
644
670
|
'@tag2 @tag3',
|
|
645
|
-
"#{
|
|
671
|
+
"#{EXAMPLE_KEYWORD}:",
|
|
646
672
|
'|param1|param2|',
|
|
647
673
|
'|value1|value2|',
|
|
648
674
|
'|value3|value4|']
|
|
@@ -652,7 +678,7 @@ describe 'Example, Integration' do
|
|
|
652
678
|
example_output = example.to_s.split("\n", -1)
|
|
653
679
|
|
|
654
680
|
expect(example_output).to eq(['@tag1 @tag2 @tag3',
|
|
655
|
-
"#{
|
|
681
|
+
"#{EXAMPLE_KEYWORD}:",
|
|
656
682
|
' | param1 | param2 |',
|
|
657
683
|
' | value1 | value2 |',
|
|
658
684
|
' | value3 | value4 |'])
|
|
@@ -661,7 +687,7 @@ describe 'Example, Integration' do
|
|
|
661
687
|
it 'can output an example that has everything' do
|
|
662
688
|
source = ['@tag1',
|
|
663
689
|
'@tag2 @tag3',
|
|
664
|
-
"#{
|
|
690
|
+
"#{EXAMPLE_KEYWORD}: with everything it could have",
|
|
665
691
|
'Some description.',
|
|
666
692
|
'Some more description.',
|
|
667
693
|
'|param1|param2|',
|
|
@@ -673,7 +699,7 @@ describe 'Example, Integration' do
|
|
|
673
699
|
example_output = example.to_s.split("\n", -1)
|
|
674
700
|
|
|
675
701
|
expect(example_output).to eq(['@tag1 @tag2 @tag3',
|
|
676
|
-
"#{
|
|
702
|
+
"#{EXAMPLE_KEYWORD}: with everything it could have",
|
|
677
703
|
'',
|
|
678
704
|
'Some description.',
|
|
679
705
|
'Some more description.',
|
|
@@ -684,7 +710,7 @@ describe 'Example, Integration' do
|
|
|
684
710
|
end
|
|
685
711
|
|
|
686
712
|
it 'buffers row cells based on the longest value in a column' do
|
|
687
|
-
source = "#{
|
|
713
|
+
source = "#{EXAMPLE_KEYWORD}:
|
|
688
714
|
|parameter 1| x|
|
|
689
715
|
|y|value 1|
|
|
690
716
|
|a|b|"
|
|
@@ -692,7 +718,7 @@ describe 'Example, Integration' do
|
|
|
692
718
|
|
|
693
719
|
example_output = example.to_s.split("\n", -1)
|
|
694
720
|
|
|
695
|
-
expect(example_output).to eq(["#{
|
|
721
|
+
expect(example_output).to eq(["#{EXAMPLE_KEYWORD}:",
|
|
696
722
|
' | parameter 1 | x |',
|
|
697
723
|
' | y | value 1 |',
|
|
698
724
|
' | a | b |'])
|