cuke_modeler 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +16 -0
  3. data/Gemfile +11 -3
  4. data/History.md +5 -0
  5. data/LICENSE.txt +1 -1
  6. data/Rakefile +8 -1
  7. data/appveyor.yml +7 -12
  8. data/cuke_modeler.gemspec +2 -2
  9. data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +309 -0
  10. data/lib/cuke_modeler/parsing.rb +28 -5
  11. data/lib/cuke_modeler/version.rb +1 -1
  12. data/testing/cucumber/step_definitions/feature_file_steps.rb +1 -1
  13. data/testing/cucumber/step_definitions/modeling_steps.rb +2 -2
  14. data/testing/cucumber/step_definitions/verification_steps.rb +3 -2
  15. data/testing/file_helper.rb +3 -0
  16. data/testing/gemfiles/gherkin2.gemfile +7 -0
  17. data/testing/gemfiles/gherkin3.gemfile +6 -0
  18. data/testing/gemfiles/gherkin4.gemfile +7 -0
  19. data/testing/gemfiles/gherkin5.gemfile +6 -0
  20. data/testing/gemfiles/gherkin6.gemfile +10 -0
  21. data/testing/rspec/spec/integration/background_integration_spec.rb +80 -72
  22. data/testing/rspec/spec/integration/cell_integration_spec.rb +28 -20
  23. data/testing/rspec/spec/integration/comment_integration_spec.rb +11 -3
  24. data/testing/rspec/spec/integration/directory_integration_spec.rb +2 -2
  25. data/testing/rspec/spec/integration/doc_string_integration_spec.rb +26 -18
  26. data/testing/rspec/spec/integration/example_integration_spec.rb +75 -61
  27. data/testing/rspec/spec/integration/feature_file_integration_spec.rb +30 -20
  28. data/testing/rspec/spec/integration/feature_integration_spec.rb +106 -98
  29. data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +11 -11
  30. data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +11 -11
  31. data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +12 -12
  32. data/testing/rspec/spec/integration/gherkin_6_adapter_spec.rb +166 -0
  33. data/testing/rspec/spec/integration/outline_integration_spec.rb +116 -102
  34. data/testing/rspec/spec/integration/parsing_integration_spec.rb +16 -4
  35. data/testing/rspec/spec/integration/row_integration_spec.rb +26 -18
  36. data/testing/rspec/spec/integration/scenario_integration_spec.rb +82 -74
  37. data/testing/rspec/spec/integration/step_integration_spec.rb +65 -49
  38. data/testing/rspec/spec/integration/table_integration_spec.rb +25 -17
  39. data/testing/rspec/spec/integration/tag_integration_spec.rb +27 -19
  40. data/testing/rspec/spec/spec_helper.rb +64 -35
  41. data/todo.txt +3 -1
  42. metadata +10 -8
  43. data/testing/cucumber/support/transforms.rb +0 -3
@@ -7,50 +7,50 @@ describe 'Gherkin2Adapter, Integration', :gherkin2 => true do
7
7
  let(:adapter) { clazz.new }
8
8
  let(:source_text) { "# feature comment
9
9
  @tag1 @tag2 @tag3
10
- #{@feature_keyword}: A feature with everything it could have
10
+ #{FEATURE_KEYWORD}: A feature with everything it could have
11
11
 
12
12
  Including a description
13
13
  and then some.
14
14
 
15
15
  # background comment
16
- #{@background_keyword}:
16
+ #{BACKGROUND_KEYWORD}:
17
17
 
18
18
  Background
19
19
  description
20
20
 
21
- #{@step_keyword} a step
21
+ #{STEP_KEYWORD} a step
22
22
  # table comment
23
23
  | value1 |
24
24
  # table row comment
25
25
  | value2 |
26
- #{@step_keyword} another step
26
+ #{STEP_KEYWORD} another step
27
27
 
28
28
  # scenario comment
29
29
  @scenario_tag
30
- #{@scenario_keyword}:
30
+ #{SCENARIO_KEYWORD}:
31
31
 
32
32
  Scenario
33
33
  description
34
34
 
35
- #{@step_keyword} a step
36
- #{@step_keyword} another step
35
+ #{STEP_KEYWORD} a step
36
+ #{STEP_KEYWORD} another step
37
37
  \"\"\"
38
38
  some text
39
39
  \"\"\"
40
40
 
41
41
  # outline comment
42
42
  @outline_tag
43
- #{@outline_keyword}:
43
+ #{OUTLINE_KEYWORD}:
44
44
 
45
45
  Outline
46
46
  description
47
47
 
48
48
  # step comment
49
- #{@step_keyword} a step
49
+ #{STEP_KEYWORD} a step
50
50
  # table comment
51
51
  | value2 |
52
52
  # step comment
53
- #{@step_keyword} another step
53
+ #{STEP_KEYWORD} another step
54
54
  # doc string comment
55
55
  \"\"\"
56
56
  some text
@@ -58,7 +58,7 @@ describe 'Gherkin2Adapter, Integration', :gherkin2 => true do
58
58
 
59
59
  # example comment
60
60
  @example_tag
61
- #{@example_keyword}:
61
+ #{EXAMPLE_KEYWORD}:
62
62
 
63
63
  Example
64
64
  description
@@ -7,50 +7,50 @@ describe 'Gherkin3Adapter, Integration', :gherkin3 => true do
7
7
  let(:adapter) { clazz.new }
8
8
  let(:source_text) { "# feature comment
9
9
  @tag1 @tag2 @tag3
10
- #{@feature_keyword}: A feature with everything it could have
10
+ #{FEATURE_KEYWORD}: A feature with everything it could have
11
11
 
12
12
  Including a description
13
13
  and then some.
14
14
 
15
15
  # background comment
16
- #{@background_keyword}:
16
+ #{BACKGROUND_KEYWORD}:
17
17
 
18
18
  Background
19
19
  description
20
20
 
21
- #{@step_keyword} a step
21
+ #{STEP_KEYWORD} a step
22
22
  # table comment
23
23
  | value1 |
24
24
  # table row comment
25
25
  | value2 |
26
- #{@step_keyword} another step
26
+ #{STEP_KEYWORD} another step
27
27
 
28
28
  # scenario comment
29
29
  @scenario_tag
30
- #{@scenario_keyword}:
30
+ #{SCENARIO_KEYWORD}:
31
31
 
32
32
  Scenario
33
33
  description
34
34
 
35
- #{@step_keyword} a step
36
- #{@step_keyword} another step
35
+ #{STEP_KEYWORD} a step
36
+ #{STEP_KEYWORD} another step
37
37
  \"\"\"
38
38
  some text
39
39
  \"\"\"
40
40
 
41
41
  # outline comment
42
42
  @outline_tag
43
- #{@outline_keyword}:
43
+ #{OUTLINE_KEYWORD}:
44
44
 
45
45
  Outline
46
46
  description
47
47
 
48
48
  # step comment
49
- #{@step_keyword} a step
49
+ #{STEP_KEYWORD} a step
50
50
  # table comment
51
51
  | value2 |
52
52
  # step comment
53
- #{@step_keyword} another step
53
+ #{STEP_KEYWORD} another step
54
54
  # doc string comment
55
55
  \"\"\"
56
56
  some text
@@ -58,7 +58,7 @@ describe 'Gherkin3Adapter, Integration', :gherkin3 => true do
58
58
 
59
59
  # example comment
60
60
  @example_tag
61
- #{@example_keyword}:
61
+ #{EXAMPLE_KEYWORD}:
62
62
 
63
63
  Example
64
64
  description
@@ -1,56 +1,56 @@
1
1
  require "#{File.dirname(__FILE__)}/../spec_helper"
2
2
 
3
3
 
4
- describe 'Gherkin4Adapter, Integration', :gherkin4 => true do
4
+ describe 'Gherkin4Adapter, Integration', :gherkin4_5 => true do
5
5
 
6
6
  let(:clazz) { CukeModeler::Gherkin4Adapter }
7
7
  let(:adapter) { clazz.new }
8
8
  let(:source_text) { "# feature comment
9
9
  @tag1 @tag2 @tag3
10
- #{@feature_keyword}: A feature with everything it could have
10
+ #{FEATURE_KEYWORD}: A feature with everything it could have
11
11
 
12
12
  Including a description
13
13
  and then some.
14
14
 
15
15
  # background comment
16
- #{@background_keyword}:
16
+ #{BACKGROUND_KEYWORD}:
17
17
 
18
18
  Background
19
19
  description
20
20
 
21
- #{@step_keyword} a step
21
+ #{STEP_KEYWORD} a step
22
22
  # table comment
23
23
  | value1 |
24
24
  # table row comment
25
25
  | value2 |
26
- #{@step_keyword} another step
26
+ #{STEP_KEYWORD} another step
27
27
 
28
28
  # scenario comment
29
29
  @scenario_tag
30
- #{@scenario_keyword}:
30
+ #{SCENARIO_KEYWORD}:
31
31
 
32
32
  Scenario
33
33
  description
34
34
 
35
- #{@step_keyword} a step
36
- #{@step_keyword} another step
35
+ #{STEP_KEYWORD} a step
36
+ #{STEP_KEYWORD} another step
37
37
  \"\"\"
38
38
  some text
39
39
  \"\"\"
40
40
 
41
41
  # outline comment
42
42
  @outline_tag
43
- #{@outline_keyword}:
43
+ #{OUTLINE_KEYWORD}:
44
44
 
45
45
  Outline
46
46
  description
47
47
 
48
48
  # step comment
49
- #{@step_keyword} a step
49
+ #{STEP_KEYWORD} a step
50
50
  # table comment
51
51
  | value2 |
52
52
  # step comment
53
- #{@step_keyword} another step
53
+ #{STEP_KEYWORD} another step
54
54
  # doc string comment
55
55
  \"\"\"
56
56
  some text
@@ -58,7 +58,7 @@ describe 'Gherkin4Adapter, Integration', :gherkin4 => true do
58
58
 
59
59
  # example comment
60
60
  @example_tag
61
- #{@example_keyword}:
61
+ #{EXAMPLE_KEYWORD}:
62
62
 
63
63
  Example
64
64
  description
@@ -0,0 +1,166 @@
1
+ require "#{File.dirname(__FILE__)}/../spec_helper"
2
+
3
+
4
+ describe 'Gherkin6Adapter, Integration', :gherkin6 => true do
5
+
6
+ let(:clazz) { CukeModeler::Gherkin6Adapter }
7
+ let(:adapter) { clazz.new }
8
+ let(:source_text) { "# feature comment
9
+ @tag1 @tag2 @tag3
10
+ #{FEATURE_KEYWORD}: A feature with everything it could have
11
+
12
+ Including a description
13
+ and then some.
14
+
15
+ # background comment
16
+ #{BACKGROUND_KEYWORD}:
17
+
18
+ Background
19
+ description
20
+
21
+ #{STEP_KEYWORD} a step
22
+ # table comment
23
+ | value1 |
24
+ # table row comment
25
+ | value2 |
26
+ #{STEP_KEYWORD} another step
27
+
28
+ # scenario comment
29
+ @scenario_tag
30
+ #{SCENARIO_KEYWORD}:
31
+
32
+ Scenario
33
+ description
34
+
35
+ #{STEP_KEYWORD} a step
36
+ #{STEP_KEYWORD} another step
37
+ \"\"\"
38
+ some text
39
+ \"\"\"
40
+
41
+ # outline comment
42
+ @outline_tag
43
+ #{OUTLINE_KEYWORD}:
44
+
45
+ Outline
46
+ description
47
+
48
+ # step comment
49
+ #{STEP_KEYWORD} a step
50
+ # table comment
51
+ | value2 |
52
+ # step comment
53
+ #{STEP_KEYWORD} another step
54
+ # doc string comment
55
+ \"\"\"
56
+ some text
57
+ \"\"\"
58
+
59
+ # example comment
60
+ @example_tag
61
+ #{EXAMPLE_KEYWORD}:
62
+
63
+ Example
64
+ description
65
+
66
+ # row comment
67
+ | param |
68
+ | value |
69
+ # final comment" }
70
+ let(:feature_file_model) { test_file_path = CukeModeler::FileHelper.create_feature_file(:text => source_text, :name => 'adapter_test_file')
71
+ CukeModeler::FeatureFile.new(test_file_path) }
72
+ let(:feature_model) { feature_file_model.feature }
73
+
74
+
75
+ it "does not store parsing data for a feature file's children" do
76
+ model = feature_file_model
77
+
78
+ expect(model.parsing_data[:comments]).to be_nil
79
+ expect(model.parsing_data[:feature]).to be_nil
80
+ end
81
+
82
+ it "does not store parsing data for a feature's children" do
83
+ model = feature_model
84
+
85
+ expect(model.parsing_data[:tags]).to be_nil
86
+ expect(model.parsing_data[:children]).to be_nil
87
+ end
88
+
89
+ it "does not store parsing data for a background's children" do
90
+ model = feature_model.background
91
+
92
+ expect(model.parsing_data[:background][:steps]).to be_nil
93
+ end
94
+
95
+ it "does not store parsing data for a scenario's children" do
96
+ model = feature_model.scenarios.first
97
+
98
+ expect(model.parsing_data[:scenario][:tags]).to be_nil
99
+ expect(model.parsing_data[:scenario][:steps]).to be_nil
100
+ end
101
+
102
+ it "does not store parsing data for an outline's children" do
103
+ model = feature_model.outlines.first
104
+
105
+ expect(model.parsing_data[:scenario][:tags]).to be_nil
106
+ expect(model.parsing_data[:scenario][:steps]).to be_nil
107
+ expect(model.parsing_data[:scenario][:examples]).to be_nil
108
+ end
109
+
110
+ it "does not store parsing data for an example's children" do
111
+ model = feature_model.outlines.first.examples.first
112
+
113
+ expect(model.parsing_data[:tags]).to be_nil
114
+ expect(model.parsing_data[:table_header]).to be_nil
115
+ expect(model.parsing_data[:table_body]).to be_nil
116
+ end
117
+
118
+ it "does not store parsing data for an example row's children" do
119
+ model = feature_model.outlines.first.examples.first.rows.first
120
+
121
+ expect(model.parsing_data[:cells]).to be_nil
122
+ end
123
+
124
+ it "does not store parsing data for a step's children, table" do
125
+ model = feature_model.outlines.first.steps.first
126
+
127
+ expect(model.parsing_data[:data_table]).to be_nil
128
+ end
129
+
130
+ it "does not store parsing data for a step's children, doc string" do
131
+ model = feature_model.outlines.first.steps.last
132
+
133
+ expect(model.parsing_data[:doc_string]).to be_nil
134
+ end
135
+
136
+ it "does not store parsing data for a table's children" do
137
+ model = feature_model.outlines.first.steps.first.block
138
+
139
+ expect(model.parsing_data[:rows]).to be_nil
140
+ end
141
+
142
+ it "does not store parsing data for a table row's children" do
143
+ model = feature_model.outlines.first.steps.first.block.rows.first
144
+
145
+ expect(model.parsing_data[:cells]).to be_nil
146
+ end
147
+
148
+
149
+ describe 'stuff that is in no way part of the public API and entirely subject to change' do
150
+
151
+ it 'provides a useful explosion message if it encounters an entirely new type of test' do
152
+ partial_feature_ast = {:type => :Feature, :location => {:line => 1, :column => 1}, :children => [{:some_unknown_type => {}}]}
153
+
154
+ expect { adapter.adapt_feature!(partial_feature_ast) }.to raise_error(ArgumentError, /Unknown.*some_unknown_type/)
155
+ end
156
+
157
+ # TODO: no longer possible in G6?
158
+ # it 'provides a useful explosion message if it encounters an entirely new type of step block' do
159
+ # partial_feature_ast = {:type => :Feature, :location => {:line => 1, :column => 1}, :children => [{:type => :Scenario, :tags => [], :location => {:line => 1, :column => 1}, :steps => [{:type => :Step, :location => {:line => 1, :column => 1}, :argument => {:type => :some_unknown_type, :location => {:line => 1, :column => 1}, :content => ""}}]}]}
160
+ #
161
+ # expect { adapter.adapt_feature!(partial_feature_ast) }.to raise_error(ArgumentError, /Unknown.*some_unknown_type/)
162
+ # end
163
+
164
+ end
165
+
166
+ end
@@ -14,22 +14,28 @@ describe 'Outline, Integration' do
14
14
 
15
15
  describe 'unique behavior' do
16
16
 
17
- it 'can be instantiated with the minimum viable Gherkin', :gherkin4 => true do
18
- source = "#{@outline_keyword}:"
17
+ it 'can be instantiated with the minimum viable Gherkin', :gherkin6 => true do
18
+ source = "#{OUTLINE_KEYWORD}:"
19
+
20
+ expect { clazz.new(source) }.to_not raise_error
21
+ end
22
+
23
+ it 'can be instantiated with the minimum viable Gherkin', :gherkin4_5 => true do
24
+ source = "#{OUTLINE_KEYWORD}:"
19
25
 
20
26
  expect { clazz.new(source) }.to_not raise_error
21
27
  end
22
28
 
23
29
  it 'can be instantiated with the minimum viable Gherkin', :gherkin2 => true do
24
- source = "#{@outline_keyword}:"
30
+ source = "#{OUTLINE_KEYWORD}:"
25
31
 
26
32
  expect { clazz.new(source) }.to_not raise_error
27
33
  end
28
34
 
29
35
  # gherkin 3.x does not accept incomplete outlines
30
36
  it 'can be instantiated with the minimum viable Gherkin', :gherkin3 => true do
31
- source = "#{@outline_keyword}:
32
- #{@example_keyword}:
37
+ source = "#{OUTLINE_KEYWORD}:
38
+ #{EXAMPLE_KEYWORD}:
33
39
  | param |
34
40
  | value |"
35
41
 
@@ -57,8 +63,16 @@ describe 'Outline, Integration' do
57
63
  end
58
64
  end
59
65
 
60
- it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
61
- outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
66
+ it 'stores the original data generated by the parsing adapter', :gherkin6 => true do
67
+ outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
68
+ data = outline.parsing_data
69
+
70
+ expect(data.keys).to match_array([:background, :rule, :scenario])
71
+ expect(data[:scenario][:name]).to eq('test outline')
72
+ end
73
+
74
+ it 'stores the original data generated by the parsing adapter', :gherkin4_5 => true do
75
+ outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
62
76
  data = outline.parsing_data
63
77
 
64
78
  expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples, :description])
@@ -66,7 +80,7 @@ describe 'Outline, Integration' do
66
80
  end
67
81
 
68
82
  it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
69
- outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
83
+ outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
70
84
  data = outline.parsing_data
71
85
 
72
86
  expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples, :description])
@@ -74,7 +88,7 @@ describe 'Outline, Integration' do
74
88
  end
75
89
 
76
90
  it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
77
- outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
91
+ outline = clazz.new("@tag\n#{OUTLINE_KEYWORD}: test outline\ndescription\n#{STEP_KEYWORD} a step\n#{EXAMPLE_KEYWORD}:\n|param|\n|value|")
78
92
  data = outline.parsing_data
79
93
 
80
94
  expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type', 'examples', 'steps', 'tags'])
@@ -82,16 +96,16 @@ describe 'Outline, Integration' do
82
96
  end
83
97
 
84
98
  it 'provides a descriptive filename when being parsed from stand alone text' do
85
- source = "bad outline text \n #{@outline_keyword}:\n #{@step_keyword} a step\n @foo "
99
+ source = "bad outline text \n #{OUTLINE_KEYWORD}:\n #{STEP_KEYWORD} a step\n @foo "
86
100
 
87
101
  expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_outline\.feature'/)
88
102
  end
89
103
 
90
104
  it 'properly sets its child models' do
91
105
  source = "@a_tag
92
- #{@outline_keyword}:
93
- #{@step_keyword} a step
94
- #{@example_keyword}:
106
+ #{OUTLINE_KEYWORD}:
107
+ #{STEP_KEYWORD} a step
108
+ #{EXAMPLE_KEYWORD}:
95
109
  | param |
96
110
  | value |"
97
111
 
@@ -113,11 +127,11 @@ describe 'Outline, Integration' do
113
127
 
114
128
 
115
129
  let(:test_directory) { CukeModeler::FileHelper.create_directory }
116
- let(:source_gherkin) { "#{@feature_keyword}: Test feature
130
+ let(:source_gherkin) { "#{FEATURE_KEYWORD}: Test feature
117
131
 
118
- #{@outline_keyword}: Test test
119
- #{@step_keyword} a step
120
- #{@example_keyword}: Test example
132
+ #{OUTLINE_KEYWORD}: Test test
133
+ #{STEP_KEYWORD} a step
134
+ #{EXAMPLE_KEYWORD}: Test example
121
135
  | a param |
122
136
  | a value |"
123
137
  }
@@ -157,21 +171,21 @@ describe 'Outline, Integration' do
157
171
 
158
172
  context 'from source text' do
159
173
 
160
- let(:source_text) { "#{@outline_keyword}:" }
174
+ let(:source_text) { "#{OUTLINE_KEYWORD}:" }
161
175
  let(:outline) { clazz.new(source_text) }
162
176
 
163
177
 
164
178
  # gherkin 3.x does not accept incomplete outlines
165
179
  it "models the outline's keyword", :gherkin3 => false do
166
- expect(outline.keyword).to eq("#{@outline_keyword}")
180
+ expect(outline.keyword).to eq("#{OUTLINE_KEYWORD}")
167
181
  end
168
182
 
169
183
  it "models the outline's source line" do
170
- source_text = "#{@feature_keyword}:
184
+ source_text = "#{FEATURE_KEYWORD}:
171
185
 
172
- #{@outline_keyword}: foo
173
- #{@step_keyword} step
174
- #{@example_keyword}:
186
+ #{OUTLINE_KEYWORD}: foo
187
+ #{STEP_KEYWORD} step
188
+ #{EXAMPLE_KEYWORD}:
175
189
  | param |
176
190
  | value |"
177
191
  outline = CukeModeler::Feature.new(source_text).tests.first
@@ -183,20 +197,20 @@ describe 'Outline, Integration' do
183
197
  context 'a filled outline' do
184
198
 
185
199
  let(:source_text) { "@tag1 @tag2 @tag3
186
- #{@outline_keyword}: Foo
200
+ #{OUTLINE_KEYWORD}: Foo
187
201
  Scenario description.
188
202
 
189
203
  Some more.
190
204
  Even more.
191
205
 
192
- #{@step_keyword} a <setup> step
193
- #{@step_keyword} an action step
194
- #{@step_keyword} a <verification> step
206
+ #{STEP_KEYWORD} a <setup> step
207
+ #{STEP_KEYWORD} an action step
208
+ #{STEP_KEYWORD} a <verification> step
195
209
 
196
- #{@example_keyword}: example 1
210
+ #{EXAMPLE_KEYWORD}: example 1
197
211
  | setup | verification |
198
212
  | x | y |
199
- #{@example_keyword}: example 2
213
+ #{EXAMPLE_KEYWORD}: example 2
200
214
  | setup | verification |
201
215
  | a | b |" }
202
216
  let(:outline) { clazz.new(source_text) }
@@ -239,7 +253,7 @@ describe 'Outline, Integration' do
239
253
  # gherkin 3.x does not accept incomplete outlines
240
254
  context 'an empty outline', :gherkin3 => false do
241
255
 
242
- let(:source_text) { "#{@outline_keyword}:" }
256
+ let(:source_text) { "#{OUTLINE_KEYWORD}:" }
243
257
  let(:outline) { clazz.new(source_text) }
244
258
 
245
259
 
@@ -270,7 +284,7 @@ describe 'Outline, Integration' do
270
284
  end
271
285
 
272
286
  it 'trims whitespace from its source description' do
273
- source = ["#{@outline_keyword}:",
287
+ source = ["#{OUTLINE_KEYWORD}:",
274
288
  ' ',
275
289
  ' description line 1',
276
290
  '',
@@ -279,9 +293,9 @@ describe 'Outline, Integration' do
279
293
  '',
280
294
  '',
281
295
  '',
282
- " #{@step_keyword} a step",
296
+ " #{STEP_KEYWORD} a step",
283
297
  '',
284
- "#{@example_keyword}:",
298
+ "#{EXAMPLE_KEYWORD}:",
285
299
  '|param|',
286
300
  '|value|']
287
301
  source = source.join("\n")
@@ -299,22 +313,22 @@ describe 'Outline, Integration' do
299
313
  describe 'comparison' do
300
314
 
301
315
  it 'is equal to a background with the same steps' do
302
- source = "#{@outline_keyword}:
303
- #{@step_keyword} step 1
304
- #{@step_keyword} step 2
305
- #{@example_keyword}:
316
+ source = "#{OUTLINE_KEYWORD}:
317
+ #{STEP_KEYWORD} step 1
318
+ #{STEP_KEYWORD} step 2
319
+ #{EXAMPLE_KEYWORD}:
306
320
  | param |
307
321
  | value |"
308
322
  outline = clazz.new(source)
309
323
 
310
- source = "#{@background_keyword}:
311
- #{@step_keyword} step 1
312
- #{@step_keyword} step 2"
324
+ source = "#{BACKGROUND_KEYWORD}:
325
+ #{STEP_KEYWORD} step 1
326
+ #{STEP_KEYWORD} step 2"
313
327
  background_1 = CukeModeler::Background.new(source)
314
328
 
315
- source = "#{@background_keyword}:
316
- #{@step_keyword} step 2
317
- #{@step_keyword} step 1"
329
+ source = "#{BACKGROUND_KEYWORD}:
330
+ #{STEP_KEYWORD} step 2
331
+ #{STEP_KEYWORD} step 1"
318
332
  background_2 = CukeModeler::Background.new(source)
319
333
 
320
334
 
@@ -323,22 +337,22 @@ describe 'Outline, Integration' do
323
337
  end
324
338
 
325
339
  it 'is equal to a scenario with the same steps' do
326
- source = "#{@outline_keyword}:
327
- #{@step_keyword} step 1
328
- #{@step_keyword} step 2
329
- #{@example_keyword}:
340
+ source = "#{OUTLINE_KEYWORD}:
341
+ #{STEP_KEYWORD} step 1
342
+ #{STEP_KEYWORD} step 2
343
+ #{EXAMPLE_KEYWORD}:
330
344
  | param |
331
345
  | value |"
332
346
  outline = clazz.new(source)
333
347
 
334
- source = "#{@scenario_keyword}:
335
- #{@step_keyword} step 1
336
- #{@step_keyword} step 2"
348
+ source = "#{SCENARIO_KEYWORD}:
349
+ #{STEP_KEYWORD} step 1
350
+ #{STEP_KEYWORD} step 2"
337
351
  scenario_1 = CukeModeler::Scenario.new(source)
338
352
 
339
- source = "#{@scenario_keyword}:
340
- #{@step_keyword} step 2
341
- #{@step_keyword} step 1"
353
+ source = "#{SCENARIO_KEYWORD}:
354
+ #{STEP_KEYWORD} step 2
355
+ #{STEP_KEYWORD} step 1"
342
356
  scenario_2 = CukeModeler::Scenario.new(source)
343
357
 
344
358
 
@@ -347,26 +361,26 @@ describe 'Outline, Integration' do
347
361
  end
348
362
 
349
363
  it 'is equal to an outline with the same steps' do
350
- source = "#{@outline_keyword}:
351
- #{@step_keyword} step 1
352
- #{@step_keyword} step 2
353
- #{@example_keyword}:
364
+ source = "#{OUTLINE_KEYWORD}:
365
+ #{STEP_KEYWORD} step 1
366
+ #{STEP_KEYWORD} step 2
367
+ #{EXAMPLE_KEYWORD}:
354
368
  | param |
355
369
  | value |"
356
370
  outline_1 = clazz.new(source)
357
371
 
358
- source = "#{@outline_keyword}:
359
- #{@step_keyword} step 1
360
- #{@step_keyword} step 2
361
- #{@example_keyword}:
372
+ source = "#{OUTLINE_KEYWORD}:
373
+ #{STEP_KEYWORD} step 1
374
+ #{STEP_KEYWORD} step 2
375
+ #{EXAMPLE_KEYWORD}:
362
376
  | param |
363
377
  | value |"
364
378
  outline_2 = clazz.new(source)
365
379
 
366
- source = "#{@outline_keyword}:
367
- #{@step_keyword} step 2
368
- #{@step_keyword} step 1
369
- #{@example_keyword}:
380
+ source = "#{OUTLINE_KEYWORD}:
381
+ #{STEP_KEYWORD} step 2
382
+ #{STEP_KEYWORD} step 1
383
+ #{EXAMPLE_KEYWORD}:
370
384
  | param |
371
385
  | value |"
372
386
  outline_3 = clazz.new(source)
@@ -383,19 +397,19 @@ describe 'Outline, Integration' do
383
397
 
384
398
  it 'can be remade from its own output' do
385
399
  source = "@tag1 @tag2 @tag3
386
- #{@outline_keyword}: An outline with everything it could have
400
+ #{OUTLINE_KEYWORD}: An outline with everything it could have
387
401
 
388
402
  Some description.
389
403
  Some more description.
390
404
 
391
- #{@step_keyword} a step
405
+ #{STEP_KEYWORD} a step
392
406
  | value |
393
- #{@step_keyword} a <value> step
407
+ #{STEP_KEYWORD} a <value> step
394
408
  \"\"\"
395
409
  some string
396
410
  \"\"\"
397
411
 
398
- #{@example_keyword}:
412
+ #{EXAMPLE_KEYWORD}:
399
413
 
400
414
  Some description.
401
415
  Some more description.
@@ -404,7 +418,7 @@ describe 'Outline, Integration' do
404
418
  | x |
405
419
 
406
420
  @example_tag
407
- #{@example_keyword}:
421
+ #{EXAMPLE_KEYWORD}:
408
422
  | value |
409
423
  | y |"
410
424
  outline = clazz.new(source)
@@ -420,29 +434,29 @@ describe 'Outline, Integration' do
420
434
 
421
435
  # gherkin 3.x does not accept incomplete outlines
422
436
  it 'can output an empty outline', :gherkin3 => false do
423
- source = ["#{@outline_keyword}:"]
437
+ source = ["#{OUTLINE_KEYWORD}:"]
424
438
  source = source.join("\n")
425
439
  outline = clazz.new(source)
426
440
 
427
441
  outline_output = outline.to_s.split("\n", -1)
428
442
 
429
- expect(outline_output).to eq(["#{@outline_keyword}:"])
443
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:"])
430
444
  end
431
445
 
432
446
  # gherkin 3.x does not accept incomplete outlines
433
447
  it 'can output a outline that has a name', :gherkin3 => false do
434
- source = ["#{@outline_keyword}: test outline"]
448
+ source = ["#{OUTLINE_KEYWORD}: test outline"]
435
449
  source = source.join("\n")
436
450
  outline = clazz.new(source)
437
451
 
438
452
  outline_output = outline.to_s.split("\n", -1)
439
453
 
440
- expect(outline_output).to eq(["#{@outline_keyword}: test outline"])
454
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}: test outline"])
441
455
  end
442
456
 
443
457
  # gherkin 3.x does not accept incomplete outlines
444
458
  it 'can output a outline that has a description', :gherkin3 => false do
445
- source = ["#{@outline_keyword}:",
459
+ source = ["#{OUTLINE_KEYWORD}:",
446
460
  'Some description.',
447
461
  'Some more description.']
448
462
  source = source.join("\n")
@@ -450,7 +464,7 @@ describe 'Outline, Integration' do
450
464
 
451
465
  outline_output = outline.to_s.split("\n", -1)
452
466
 
453
- expect(outline_output).to eq(["#{@outline_keyword}:",
467
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:",
454
468
  '',
455
469
  'Some description.',
456
470
  'Some more description.'])
@@ -458,10 +472,10 @@ describe 'Outline, Integration' do
458
472
 
459
473
  # gherkin 3.x does not accept incomplete outlines
460
474
  it 'can output a outline that has steps', :gherkin3 => false do
461
- source = ["#{@outline_keyword}:",
462
- " #{@step_keyword} a step",
475
+ source = ["#{OUTLINE_KEYWORD}:",
476
+ " #{STEP_KEYWORD} a step",
463
477
  ' | value |',
464
- " #{@step_keyword} another step",
478
+ " #{STEP_KEYWORD} another step",
465
479
  ' """',
466
480
  ' some string',
467
481
  ' """']
@@ -470,10 +484,10 @@ describe 'Outline, Integration' do
470
484
 
471
485
  outline_output = outline.to_s.split("\n", -1)
472
486
 
473
- expect(outline_output).to eq(["#{@outline_keyword}:",
474
- " #{@step_keyword} a step",
487
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:",
488
+ " #{STEP_KEYWORD} a step",
475
489
  ' | value |',
476
- " #{@step_keyword} another step",
490
+ " #{STEP_KEYWORD} another step",
477
491
  ' """',
478
492
  ' some string',
479
493
  ' """'])
@@ -483,23 +497,23 @@ describe 'Outline, Integration' do
483
497
  it 'can output a outline that has tags', :gherkin3 => false do
484
498
  source = ['@tag1 @tag2',
485
499
  '@tag3',
486
- "#{@outline_keyword}:"]
500
+ "#{OUTLINE_KEYWORD}:"]
487
501
  source = source.join("\n")
488
502
  outline = clazz.new(source)
489
503
 
490
504
  outline_output = outline.to_s.split("\n", -1)
491
505
 
492
506
  expect(outline_output).to eq(['@tag1 @tag2 @tag3',
493
- "#{@outline_keyword}:"])
507
+ "#{OUTLINE_KEYWORD}:"])
494
508
  end
495
509
 
496
510
  it 'can output a outline that has examples' do
497
- source = ["#{@outline_keyword}:",
498
- "#{@step_keyword} a step",
499
- "#{@example_keyword}:",
511
+ source = ["#{OUTLINE_KEYWORD}:",
512
+ "#{STEP_KEYWORD} a step",
513
+ "#{EXAMPLE_KEYWORD}:",
500
514
  '| value |',
501
515
  '| x |',
502
- "#{@example_keyword}:",
516
+ "#{EXAMPLE_KEYWORD}:",
503
517
  '| value |',
504
518
  '| y |']
505
519
  source = source.join("\n")
@@ -507,31 +521,31 @@ describe 'Outline, Integration' do
507
521
 
508
522
  outline_output = outline.to_s.split("\n", -1)
509
523
 
510
- expect(outline_output).to eq(["#{@outline_keyword}:",
511
- " #{@step_keyword} a step",
524
+ expect(outline_output).to eq(["#{OUTLINE_KEYWORD}:",
525
+ " #{STEP_KEYWORD} a step",
512
526
  '',
513
- "#{@example_keyword}:",
527
+ "#{EXAMPLE_KEYWORD}:",
514
528
  ' | value |',
515
529
  ' | x |',
516
530
  '',
517
- "#{@example_keyword}:",
531
+ "#{EXAMPLE_KEYWORD}:",
518
532
  ' | value |',
519
533
  ' | y |'])
520
534
  end
521
535
 
522
536
  it 'can output a outline that has everything' do
523
537
  source = ['@tag1 @tag2 @tag3',
524
- "#{@outline_keyword}: A outline with everything it could have",
538
+ "#{OUTLINE_KEYWORD}: A outline with everything it could have",
525
539
  'Including a description',
526
540
  'and then some.',
527
- "#{@step_keyword} a step",
541
+ "#{STEP_KEYWORD} a step",
528
542
  '|value|',
529
- "#{@step_keyword} another step",
543
+ "#{STEP_KEYWORD} another step",
530
544
  '"""',
531
545
  'some string',
532
546
  '"""',
533
547
  '',
534
- "#{@example_keyword}:",
548
+ "#{EXAMPLE_KEYWORD}:",
535
549
  '',
536
550
  'Some description.',
537
551
  'Some more description.',
@@ -540,7 +554,7 @@ describe 'Outline, Integration' do
540
554
  '| x |',
541
555
  '',
542
556
  '@example_tag',
543
- "#{@example_keyword}:",
557
+ "#{EXAMPLE_KEYWORD}:",
544
558
  '| value |',
545
559
  '| y |']
546
560
  source = source.join("\n")
@@ -549,19 +563,19 @@ describe 'Outline, Integration' do
549
563
  outline_output = outline.to_s.split("\n", -1)
550
564
 
551
565
  expect(outline_output).to eq(['@tag1 @tag2 @tag3',
552
- "#{@outline_keyword}: A outline with everything it could have",
566
+ "#{OUTLINE_KEYWORD}: A outline with everything it could have",
553
567
  '',
554
568
  'Including a description',
555
569
  'and then some.',
556
570
  '',
557
- " #{@step_keyword} a step",
571
+ " #{STEP_KEYWORD} a step",
558
572
  ' | value |',
559
- " #{@step_keyword} another step",
573
+ " #{STEP_KEYWORD} another step",
560
574
  ' """',
561
575
  ' some string',
562
576
  ' """',
563
577
  '',
564
- "#{@example_keyword}:",
578
+ "#{EXAMPLE_KEYWORD}:",
565
579
  '',
566
580
  'Some description.',
567
581
  'Some more description.',
@@ -570,7 +584,7 @@ describe 'Outline, Integration' do
570
584
  ' | x |',
571
585
  '',
572
586
  '@example_tag',
573
- "#{@example_keyword}:",
587
+ "#{EXAMPLE_KEYWORD}:",
574
588
  ' | value |',
575
589
  ' | y |'])
576
590
  end