cuke_modeler 1.3.0 → 1.4.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 +16 -0
- data/Gemfile +11 -3
- data/History.md +5 -0
- data/LICENSE.txt +1 -1
- data/Rakefile +8 -1
- data/appveyor.yml +7 -12
- data/cuke_modeler.gemspec +2 -2
- data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +309 -0
- data/lib/cuke_modeler/parsing.rb +28 -5
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/step_definitions/feature_file_steps.rb +1 -1
- data/testing/cucumber/step_definitions/modeling_steps.rb +2 -2
- data/testing/cucumber/step_definitions/verification_steps.rb +3 -2
- data/testing/file_helper.rb +3 -0
- data/testing/gemfiles/gherkin2.gemfile +7 -0
- data/testing/gemfiles/gherkin3.gemfile +6 -0
- data/testing/gemfiles/gherkin4.gemfile +7 -0
- data/testing/gemfiles/gherkin5.gemfile +6 -0
- data/testing/gemfiles/gherkin6.gemfile +10 -0
- data/testing/rspec/spec/integration/background_integration_spec.rb +80 -72
- data/testing/rspec/spec/integration/cell_integration_spec.rb +28 -20
- data/testing/rspec/spec/integration/comment_integration_spec.rb +11 -3
- data/testing/rspec/spec/integration/directory_integration_spec.rb +2 -2
- data/testing/rspec/spec/integration/doc_string_integration_spec.rb +26 -18
- data/testing/rspec/spec/integration/example_integration_spec.rb +75 -61
- data/testing/rspec/spec/integration/feature_file_integration_spec.rb +30 -20
- data/testing/rspec/spec/integration/feature_integration_spec.rb +106 -98
- data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +11 -11
- data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +11 -11
- data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +12 -12
- data/testing/rspec/spec/integration/gherkin_6_adapter_spec.rb +166 -0
- data/testing/rspec/spec/integration/outline_integration_spec.rb +116 -102
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +16 -4
- data/testing/rspec/spec/integration/row_integration_spec.rb +26 -18
- data/testing/rspec/spec/integration/scenario_integration_spec.rb +82 -74
- data/testing/rspec/spec/integration/step_integration_spec.rb +65 -49
- data/testing/rspec/spec/integration/table_integration_spec.rb +25 -17
- data/testing/rspec/spec/integration/tag_integration_spec.rb +27 -19
- data/testing/rspec/spec/spec_helper.rb +64 -35
- data/todo.txt +3 -1
- metadata +10 -8
- data/testing/cucumber/support/transforms.rb +0 -3
data/lib/cuke_modeler/parsing.rb
CHANGED
@@ -11,19 +11,40 @@ module CukeModeler
|
|
11
11
|
begin
|
12
12
|
require 'gherkin'
|
13
13
|
rescue LoadError
|
14
|
-
|
14
|
+
begin
|
15
|
+
require 'gherkin/parser'
|
16
|
+
rescue LoadError
|
17
|
+
# Gherkin 6.x
|
18
|
+
require 'gherkin/gherkin'
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
|
18
23
|
# The *gherkin* gem loads differently and has different grammar rules across major versions. Parsing
|
19
24
|
# will be done with an 'adapter' appropriate to the version of the *gherkin* gem that has been activated.
|
20
25
|
|
21
|
-
|
26
|
+
gherkin_version = Gem.loaded_specs['gherkin'].version.version
|
27
|
+
|
28
|
+
case gherkin_version
|
29
|
+
when /^6\./
|
30
|
+
require 'gherkin/gherkin'
|
31
|
+
require 'cuke_modeler/adapters/gherkin_6_adapter'
|
32
|
+
|
33
|
+
def self.parsing_method(source_text, filename)
|
34
|
+
messages = Gherkin::Gherkin.from_source(filename, source_text, {:default_dialect => CukeModeler::Parsing.dialect}).to_a
|
35
|
+
|
36
|
+
messages.map(&:to_hash).find { |message| message[:gherkinDocument] }[:gherkinDocument]
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.adapter_class
|
40
|
+
CukeModeler::Gherkin6Adapter
|
41
|
+
end
|
42
|
+
|
22
43
|
when /^[54]\./
|
23
44
|
require 'gherkin/parser'
|
24
45
|
require 'cuke_modeler/adapters/gherkin_4_adapter'
|
25
46
|
|
26
|
-
|
47
|
+
# TODO: shouldn't the filename be used?
|
27
48
|
# todo - make these methods private?
|
28
49
|
def self.parsing_method(source_text, _filename)
|
29
50
|
Gherkin::Parser.new.parse(source_text)
|
@@ -45,8 +66,7 @@ module CukeModeler
|
|
45
66
|
def self.adapter_class
|
46
67
|
CukeModeler::Gherkin3Adapter
|
47
68
|
end
|
48
|
-
|
49
|
-
else # Assume version 2.x
|
69
|
+
when /^2\./
|
50
70
|
require 'stringio'
|
51
71
|
require 'gherkin/formatter/json_formatter'
|
52
72
|
require 'gherkin'
|
@@ -68,6 +88,9 @@ module CukeModeler
|
|
68
88
|
CukeModeler::Gherkin2Adapter
|
69
89
|
end
|
70
90
|
|
91
|
+
else
|
92
|
+
# TODO: test this
|
93
|
+
raise("Unknown Gherkin version: '#{gherkin_version}'")
|
71
94
|
end
|
72
95
|
|
73
96
|
|
data/lib/cuke_modeler/version.rb
CHANGED
@@ -6,7 +6,7 @@ Given(/^a feature file model based on "([^"]*)"$/) do |file_name|
|
|
6
6
|
end
|
7
7
|
|
8
8
|
And(/^a feature file model based on that file$/) do |code_text|
|
9
|
-
code_text.gsub
|
9
|
+
code_text = code_text.gsub('<file_path>', "'#{@file_path}'")
|
10
10
|
|
11
11
|
eval(code_text)
|
12
12
|
end
|
@@ -13,13 +13,13 @@ When(/^the model is output as a string$/) do |code_text|
|
|
13
13
|
end
|
14
14
|
|
15
15
|
And(/^a(?:n)? \w+(?: \w+)? model based on that gherkin$/) do |code_text|
|
16
|
-
code_text.gsub
|
16
|
+
code_text = code_text.gsub('<source_text>', "'#{@source_text}'")
|
17
17
|
|
18
18
|
eval(code_text)
|
19
19
|
end
|
20
20
|
|
21
21
|
Given(/^(?:a|the) (?:directory|feature file) is modeled$/) do |code_text|
|
22
|
-
code_text.gsub
|
22
|
+
code_text = code_text.gsub('<path_to>', @root_test_directory)
|
23
23
|
|
24
24
|
eval(code_text)
|
25
25
|
end
|
@@ -12,7 +12,7 @@ Then(/^all of them can be output as text appropriate to the model type$/) do |co
|
|
12
12
|
end
|
13
13
|
|
14
14
|
Then(/^the following text is provided:$/) do |expected_text|
|
15
|
-
expected_text.sub
|
15
|
+
expected_text = expected_text.sub('<path_to>', @root_test_directory)
|
16
16
|
|
17
17
|
expect(@output).to eq(expected_text)
|
18
18
|
end
|
@@ -58,12 +58,13 @@ end
|
|
58
58
|
|
59
59
|
Then(/^the model returns "([^"]*)"$/) do |value|
|
60
60
|
value.gsub!('path_to', @root_test_directory) if value.is_a?(String)
|
61
|
+
value = value.to_i if value =~ /^\d+$/
|
61
62
|
|
62
63
|
expect(@result).to eq(value)
|
63
64
|
end
|
64
65
|
|
65
66
|
Then(/^the model returns$/) do |value|
|
66
|
-
value.gsub
|
67
|
+
value = value.gsub('path_to', @root_test_directory) if value.is_a?(String)
|
67
68
|
|
68
69
|
expect(@result).to eq(value)
|
69
70
|
end
|
data/testing/file_helper.rb
CHANGED
@@ -7,6 +7,11 @@ gem "gherkin", "~> 2.0"
|
|
7
7
|
|
8
8
|
if RUBY_VERSION =~ /^1\./
|
9
9
|
|
10
|
+
if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
|
11
|
+
gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
|
12
|
+
end
|
13
|
+
|
14
|
+
gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
|
10
15
|
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
11
16
|
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
12
17
|
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
@@ -14,6 +19,8 @@ if RUBY_VERSION =~ /^1\./
|
|
14
19
|
if RUBY_VERSION =~ /^1\.8/
|
15
20
|
gem 'cucumber', '~> 1.0' # Ruby 1.8.x support dropped after this version
|
16
21
|
gem 'rake', '< 11.0' # Ruby 1.8.x support dropped after this version
|
22
|
+
else
|
23
|
+
gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
|
17
24
|
end
|
18
25
|
|
19
26
|
elsif RUBY_VERSION =~ /^2\./
|
@@ -7,9 +7,15 @@ gem "gherkin", "~> 3.0"
|
|
7
7
|
|
8
8
|
if RUBY_VERSION =~ /^1\./
|
9
9
|
|
10
|
+
if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
|
11
|
+
gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
|
12
|
+
end
|
13
|
+
|
14
|
+
gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
|
10
15
|
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
11
16
|
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
12
17
|
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
18
|
+
gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
|
13
19
|
|
14
20
|
elsif RUBY_VERSION =~ /^2\./
|
15
21
|
|
@@ -7,9 +7,16 @@ gem "gherkin", "~> 4.0"
|
|
7
7
|
|
8
8
|
if RUBY_VERSION =~ /^1\./
|
9
9
|
|
10
|
+
if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
|
11
|
+
gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
|
12
|
+
end
|
13
|
+
|
14
|
+
gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
|
10
15
|
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
11
16
|
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
12
17
|
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
18
|
+
gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
|
19
|
+
gem 'cucumber', '< 3.0.0' # Ruby 1.9.x support dropped after this version
|
13
20
|
|
14
21
|
elsif RUBY_VERSION =~ /^2\./
|
15
22
|
|
@@ -7,9 +7,15 @@ gem "gherkin", "~> 5.0"
|
|
7
7
|
|
8
8
|
if RUBY_VERSION =~ /^1\./
|
9
9
|
|
10
|
+
if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
|
11
|
+
gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
|
12
|
+
end
|
13
|
+
|
14
|
+
gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
|
10
15
|
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
11
16
|
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
12
17
|
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
18
|
+
gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
|
13
19
|
|
14
20
|
elsif RUBY_VERSION =~ /^2\./
|
15
21
|
|
@@ -15,7 +15,7 @@ describe 'Background, 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 = "#{BACKGROUND_KEYWORD}:"
|
19
19
|
|
20
20
|
expect { clazz.new(source) }.to_not raise_error
|
21
21
|
end
|
@@ -37,8 +37,16 @@ describe 'Background, Integration' do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
it 'stores the original data generated by the parsing adapter', :
|
41
|
-
background = clazz.new("#{
|
40
|
+
it 'stores the original data generated by the parsing adapter', :gherkin6 => true do
|
41
|
+
background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
|
42
|
+
data = background.parsing_data
|
43
|
+
|
44
|
+
expect(data.keys).to match_array([:background, :rule, :scenario])
|
45
|
+
expect(data[:background][:name]).to eq('test background')
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
|
49
|
+
background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
|
42
50
|
data = background.parsing_data
|
43
51
|
|
44
52
|
expect(data.keys).to match_array([:type, :location, :keyword, :name, :steps, :description])
|
@@ -46,7 +54,7 @@ describe 'Background, Integration' do
|
|
46
54
|
end
|
47
55
|
|
48
56
|
it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
|
49
|
-
background = clazz.new("#{
|
57
|
+
background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
|
50
58
|
data = background.parsing_data
|
51
59
|
|
52
60
|
expect(data.keys).to match_array([:type, :location, :keyword, :name, :steps, :description])
|
@@ -54,7 +62,7 @@ describe 'Background, Integration' do
|
|
54
62
|
end
|
55
63
|
|
56
64
|
it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
|
57
|
-
background = clazz.new("#{
|
65
|
+
background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
|
58
66
|
data = background.parsing_data
|
59
67
|
|
60
68
|
expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'steps', 'type'])
|
@@ -62,14 +70,14 @@ describe 'Background, Integration' do
|
|
62
70
|
end
|
63
71
|
|
64
72
|
it 'provides a descriptive filename when being parsed from stand alone text' do
|
65
|
-
source = "bad background text \n #{
|
73
|
+
source = "bad background text \n #{BACKGROUND_KEYWORD}:\n #{STEP_KEYWORD} a step\n @foo "
|
66
74
|
|
67
75
|
expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_background\.feature'/)
|
68
76
|
end
|
69
77
|
|
70
78
|
it 'properly sets its child models' do
|
71
|
-
source = "#{
|
72
|
-
#{
|
79
|
+
source = "#{BACKGROUND_KEYWORD}: Test background
|
80
|
+
#{STEP_KEYWORD} a step"
|
73
81
|
|
74
82
|
background = clazz.new(source)
|
75
83
|
step = background.steps.first
|
@@ -78,7 +86,7 @@ describe 'Background, Integration' do
|
|
78
86
|
end
|
79
87
|
|
80
88
|
it 'trims whitespace from its source description' do
|
81
|
-
source = ["#{
|
89
|
+
source = ["#{BACKGROUND_KEYWORD}:",
|
82
90
|
' ',
|
83
91
|
' description line 1',
|
84
92
|
'',
|
@@ -87,7 +95,7 @@ describe 'Background, Integration' do
|
|
87
95
|
'',
|
88
96
|
'',
|
89
97
|
'',
|
90
|
-
" #{
|
98
|
+
" #{STEP_KEYWORD} a step"]
|
91
99
|
source = source.join("\n")
|
92
100
|
|
93
101
|
background = clazz.new(source)
|
@@ -108,10 +116,10 @@ describe 'Background, Integration' do
|
|
108
116
|
|
109
117
|
|
110
118
|
let(:test_directory) { CukeModeler::FileHelper.create_directory }
|
111
|
-
let(:source_gherkin) { "#{
|
119
|
+
let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
|
112
120
|
|
113
|
-
#{
|
114
|
-
#{
|
121
|
+
#{BACKGROUND_KEYWORD}: Test background
|
122
|
+
#{STEP_KEYWORD} a step"
|
115
123
|
}
|
116
124
|
|
117
125
|
let(:directory_model) { CukeModeler::Directory.new(test_directory) }
|
@@ -149,19 +157,19 @@ describe 'Background, Integration' do
|
|
149
157
|
|
150
158
|
context 'from source text' do
|
151
159
|
|
152
|
-
let(:source_text) { "#{
|
160
|
+
let(:source_text) { "#{BACKGROUND_KEYWORD}:" }
|
153
161
|
let(:background) { clazz.new(source_text) }
|
154
162
|
|
155
163
|
|
156
164
|
it "models the background's keyword" do
|
157
|
-
expect(background.keyword).to eq("#{
|
165
|
+
expect(background.keyword).to eq("#{BACKGROUND_KEYWORD}")
|
158
166
|
end
|
159
167
|
|
160
168
|
it "models the background's source line" do
|
161
|
-
source_text = "#{
|
169
|
+
source_text = "#{FEATURE_KEYWORD}:
|
162
170
|
|
163
|
-
#{
|
164
|
-
#{
|
171
|
+
#{BACKGROUND_KEYWORD}: foo
|
172
|
+
#{STEP_KEYWORD} step"
|
165
173
|
background = CukeModeler::Feature.new(source_text).background
|
166
174
|
|
167
175
|
expect(background.source_line).to eq(3)
|
@@ -169,15 +177,15 @@ describe 'Background, Integration' do
|
|
169
177
|
|
170
178
|
context 'a filled background' do
|
171
179
|
|
172
|
-
let(:source_text) { "#{
|
180
|
+
let(:source_text) { "#{BACKGROUND_KEYWORD}: Background name
|
173
181
|
|
174
182
|
Background description.
|
175
183
|
|
176
184
|
Some more.
|
177
185
|
Even more.
|
178
186
|
|
179
|
-
#{
|
180
|
-
#{
|
187
|
+
#{STEP_KEYWORD} a step
|
188
|
+
#{STEP_KEYWORD} another step" }
|
181
189
|
let(:background) { clazz.new(source_text) }
|
182
190
|
|
183
191
|
|
@@ -204,7 +212,7 @@ describe 'Background, Integration' do
|
|
204
212
|
|
205
213
|
context 'an empty background' do
|
206
214
|
|
207
|
-
let(:source_text) { "#{
|
215
|
+
let(:source_text) { "#{BACKGROUND_KEYWORD}:" }
|
208
216
|
let(:background) { clazz.new(source_text) }
|
209
217
|
|
210
218
|
|
@@ -230,19 +238,19 @@ describe 'Background, Integration' do
|
|
230
238
|
describe 'comparison' do
|
231
239
|
|
232
240
|
it 'is equal to a background with the same steps' do
|
233
|
-
source = "#{
|
234
|
-
#{
|
235
|
-
#{
|
241
|
+
source = "#{BACKGROUND_KEYWORD}:
|
242
|
+
#{STEP_KEYWORD} step 1
|
243
|
+
#{STEP_KEYWORD} step 2"
|
236
244
|
background_1 = clazz.new(source)
|
237
245
|
|
238
|
-
source = "#{
|
239
|
-
#{
|
240
|
-
#{
|
246
|
+
source = "#{BACKGROUND_KEYWORD}:
|
247
|
+
#{STEP_KEYWORD} step 1
|
248
|
+
#{STEP_KEYWORD} step 2"
|
241
249
|
background_2 = clazz.new(source)
|
242
250
|
|
243
|
-
source = "#{
|
244
|
-
#{
|
245
|
-
#{
|
251
|
+
source = "#{BACKGROUND_KEYWORD}:
|
252
|
+
#{STEP_KEYWORD} step 2
|
253
|
+
#{STEP_KEYWORD} step 1"
|
246
254
|
background_3 = clazz.new(source)
|
247
255
|
|
248
256
|
|
@@ -251,19 +259,19 @@ describe 'Background, Integration' do
|
|
251
259
|
end
|
252
260
|
|
253
261
|
it 'is equal to a scenario with the same steps' do
|
254
|
-
source = "#{
|
255
|
-
#{
|
256
|
-
#{
|
262
|
+
source = "#{BACKGROUND_KEYWORD}:
|
263
|
+
#{STEP_KEYWORD} step 1
|
264
|
+
#{STEP_KEYWORD} step 2"
|
257
265
|
background = clazz.new(source)
|
258
266
|
|
259
|
-
source = "#{
|
260
|
-
#{
|
261
|
-
#{
|
267
|
+
source = "#{SCENARIO_KEYWORD}:
|
268
|
+
#{STEP_KEYWORD} step 1
|
269
|
+
#{STEP_KEYWORD} step 2"
|
262
270
|
scenario_1 = CukeModeler::Scenario.new(source)
|
263
271
|
|
264
|
-
source = "#{
|
265
|
-
#{
|
266
|
-
#{
|
272
|
+
source = "#{SCENARIO_KEYWORD}:
|
273
|
+
#{STEP_KEYWORD} step 2
|
274
|
+
#{STEP_KEYWORD} step 1"
|
267
275
|
scenario_2 = CukeModeler::Scenario.new(source)
|
268
276
|
|
269
277
|
|
@@ -272,23 +280,23 @@ describe 'Background, Integration' do
|
|
272
280
|
end
|
273
281
|
|
274
282
|
it 'is equal to an outline with the same steps' do
|
275
|
-
source = "#{
|
276
|
-
#{
|
277
|
-
#{
|
283
|
+
source = "#{BACKGROUND_KEYWORD}:
|
284
|
+
#{STEP_KEYWORD} step 1
|
285
|
+
#{STEP_KEYWORD} step 2"
|
278
286
|
background = clazz.new(source)
|
279
287
|
|
280
|
-
source = "#{
|
281
|
-
#{
|
282
|
-
#{
|
283
|
-
#{
|
288
|
+
source = "#{OUTLINE_KEYWORD}:
|
289
|
+
#{STEP_KEYWORD} step 1
|
290
|
+
#{STEP_KEYWORD} step 2
|
291
|
+
#{EXAMPLE_KEYWORD}:
|
284
292
|
| param |
|
285
293
|
| value |"
|
286
294
|
outline_1 = CukeModeler::Outline.new(source)
|
287
295
|
|
288
|
-
source = "#{
|
289
|
-
#{
|
290
|
-
#{
|
291
|
-
#{
|
296
|
+
source = "#{OUTLINE_KEYWORD}:
|
297
|
+
#{STEP_KEYWORD} step 2
|
298
|
+
#{STEP_KEYWORD} step 1
|
299
|
+
#{EXAMPLE_KEYWORD}:
|
292
300
|
| param |
|
293
301
|
| value |"
|
294
302
|
outline_2 = CukeModeler::Outline.new(source)
|
@@ -304,14 +312,14 @@ describe 'Background, Integration' do
|
|
304
312
|
describe 'background output' do
|
305
313
|
|
306
314
|
it 'can be remade from its own output' do
|
307
|
-
source = "#{
|
315
|
+
source = "#{BACKGROUND_KEYWORD}: A background with everything it could have
|
308
316
|
|
309
317
|
Including a description
|
310
318
|
and then some.
|
311
319
|
|
312
|
-
#{
|
320
|
+
#{STEP_KEYWORD} a step
|
313
321
|
| value |
|
314
|
-
#{
|
322
|
+
#{STEP_KEYWORD} another step
|
315
323
|
\"\"\"
|
316
324
|
some string
|
317
325
|
\"\"\""
|
@@ -327,27 +335,27 @@ describe 'Background, Integration' do
|
|
327
335
|
context 'from source text' do
|
328
336
|
|
329
337
|
it 'can output an empty background' do
|
330
|
-
source = ["#{
|
338
|
+
source = ["#{BACKGROUND_KEYWORD}:"]
|
331
339
|
source = source.join("\n")
|
332
340
|
background = clazz.new(source)
|
333
341
|
|
334
342
|
background_output = background.to_s.split("\n", -1)
|
335
343
|
|
336
|
-
expect(background_output).to eq(["#{
|
344
|
+
expect(background_output).to eq(["#{BACKGROUND_KEYWORD}:"])
|
337
345
|
end
|
338
346
|
|
339
347
|
it 'can output a background that has a name' do
|
340
|
-
source = ["#{
|
348
|
+
source = ["#{BACKGROUND_KEYWORD}: test background"]
|
341
349
|
source = source.join("\n")
|
342
350
|
background = clazz.new(source)
|
343
351
|
|
344
352
|
background_output = background.to_s.split("\n", -1)
|
345
353
|
|
346
|
-
expect(background_output).to eq(["#{
|
354
|
+
expect(background_output).to eq(["#{BACKGROUND_KEYWORD}: test background"])
|
347
355
|
end
|
348
356
|
|
349
357
|
it 'can output a background that has a description' do
|
350
|
-
source = ["#{
|
358
|
+
source = ["#{BACKGROUND_KEYWORD}:",
|
351
359
|
'Some description.',
|
352
360
|
'Some more description.']
|
353
361
|
source = source.join("\n")
|
@@ -355,17 +363,17 @@ describe 'Background, Integration' do
|
|
355
363
|
|
356
364
|
background_output = background.to_s.split("\n", -1)
|
357
365
|
|
358
|
-
expect(background_output).to eq(["#{
|
366
|
+
expect(background_output).to eq(["#{BACKGROUND_KEYWORD}:",
|
359
367
|
'',
|
360
368
|
'Some description.',
|
361
369
|
'Some more description.'])
|
362
370
|
end
|
363
371
|
|
364
372
|
it 'can output a background that has steps' do
|
365
|
-
source = ["#{
|
366
|
-
"#{
|
373
|
+
source = ["#{BACKGROUND_KEYWORD}:",
|
374
|
+
"#{STEP_KEYWORD} a step",
|
367
375
|
'|value|',
|
368
|
-
"#{
|
376
|
+
"#{STEP_KEYWORD} another step",
|
369
377
|
'"""',
|
370
378
|
'some string',
|
371
379
|
'"""']
|
@@ -374,22 +382,22 @@ describe 'Background, Integration' do
|
|
374
382
|
|
375
383
|
background_output = background.to_s.split("\n", -1)
|
376
384
|
|
377
|
-
expect(background_output).to eq(["#{
|
378
|
-
" #{
|
385
|
+
expect(background_output).to eq(["#{BACKGROUND_KEYWORD}:",
|
386
|
+
" #{STEP_KEYWORD} a step",
|
379
387
|
' | value |',
|
380
|
-
" #{
|
388
|
+
" #{STEP_KEYWORD} another step",
|
381
389
|
' """',
|
382
390
|
' some string',
|
383
391
|
' """'])
|
384
392
|
end
|
385
393
|
|
386
394
|
it 'can output a background that has everything' do
|
387
|
-
source = ["#{
|
395
|
+
source = ["#{BACKGROUND_KEYWORD}: A background with everything it could have",
|
388
396
|
'Including a description',
|
389
397
|
'and then some.',
|
390
|
-
"#{
|
398
|
+
"#{STEP_KEYWORD} a step",
|
391
399
|
'|value|',
|
392
|
-
"#{
|
400
|
+
"#{STEP_KEYWORD} another step",
|
393
401
|
'"""',
|
394
402
|
'some string',
|
395
403
|
'"""']
|
@@ -398,14 +406,14 @@ describe 'Background, Integration' do
|
|
398
406
|
|
399
407
|
background_output = background.to_s.split("\n", -1)
|
400
408
|
|
401
|
-
expect(background_output).to eq(["#{
|
409
|
+
expect(background_output).to eq(["#{BACKGROUND_KEYWORD}: A background with everything it could have",
|
402
410
|
'',
|
403
411
|
'Including a description',
|
404
412
|
'and then some.',
|
405
413
|
'',
|
406
|
-
" #{
|
414
|
+
" #{STEP_KEYWORD} a step",
|
407
415
|
' | value |',
|
408
|
-
" #{
|
416
|
+
" #{STEP_KEYWORD} another step",
|
409
417
|
' """',
|
410
418
|
' some string',
|
411
419
|
' """'])
|