cuke_linter 0.13.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +4 -4
- data/cuke_linter.gemspec +3 -3
- data/lib/cuke_linter.rb +5 -3
- data/lib/cuke_linter/version.rb +1 -1
- metadata +2 -86
- data/.gitignore +0 -19
- data/.simplecov +0 -8
- data/.travis.yml +0 -33
- data/CONTRIBUTING.md +0 -26
- data/Gemfile +0 -6
- data/Rakefile +0 -63
- data/appveyor.yml +0 -43
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/environments/common_env.rb +0 -12
- data/environments/cucumber_env.rb +0 -22
- data/environments/rspec_env.rb +0 -50
- data/testing/cucumber/step_definitions/action_steps.rb +0 -84
- data/testing/cucumber/step_definitions/setup_steps.rb +0 -258
- data/testing/cucumber/step_definitions/verification_steps.rb +0 -94
- data/testing/file_helper.rb +0 -41
- data/testing/formatter_factory.rb +0 -15
- data/testing/gemfiles/cuke_modeler1.gemfile +0 -8
- data/testing/gemfiles/cuke_modeler2.gemfile +0 -8
- data/testing/linter_factory.rb +0 -60
- data/testing/model_factory.rb +0 -109
- data/testing/rspec/spec/integration/cli_integration_spec.rb +0 -556
- data/testing/rspec/spec/integration/configuration_spec.rb +0 -811
- data/testing/rspec/spec/integration/cuke_linter_integration_spec.rb +0 -243
- data/testing/rspec/spec/integration/formatters/formatter_integration_specs.rb +0 -5
- data/testing/rspec/spec/integration/formatters/pretty_formatter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/background_does_more_than_setup_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/element_with_common_tags_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/element_with_duplicate_tags_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/element_with_too_many_tags_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/example_without_name_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/feature_file_with_invalid_name_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/feature_file_with_mismatched_name_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/feature_with_too_many_different_tags_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/feature_without_description_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/feature_without_name_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/feature_without_scenarios_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/linter_integration_specs.rb +0 -7
- data/testing/rspec/spec/integration/linters/outline_with_single_example_row_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/single_test_background_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/step_with_end_period_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/step_with_too_many_characters_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_should_use_background_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_with_action_step_as_final_step_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_with_bad_name_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_with_no_action_step_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_with_no_name_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_with_no_verification_step_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_with_setup_step_after_action_step_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_with_setup_step_after_verification_step_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_with_setup_step_as_final_step_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/integration/linters/test_with_too_many_steps_linter_integration_spec.rb +0 -8
- data/testing/rspec/spec/unit/cuke_linter_unit_spec.rb +0 -114
- data/testing/rspec/spec/unit/formatters/formatter_unit_specs.rb +0 -11
- data/testing/rspec/spec/unit/formatters/pretty_formatter_unit_spec.rb +0 -115
- data/testing/rspec/spec/unit/linters/background_does_more_than_setup_linter_unit_spec.rb +0 -186
- data/testing/rspec/spec/unit/linters/configurable_linter_unit_specs.rb +0 -11
- data/testing/rspec/spec/unit/linters/element_with_common_tags_linter_unit_spec.rb +0 -248
- data/testing/rspec/spec/unit/linters/element_with_duplicate_tags_linter_unit_spec.rb +0 -203
- data/testing/rspec/spec/unit/linters/element_with_too_many_tags_linter_unit_spec.rb +0 -296
- data/testing/rspec/spec/unit/linters/example_without_name_linter_unit_spec.rb +0 -81
- data/testing/rspec/spec/unit/linters/feature_file_with_invalid_name_linter_unit_spec.rb +0 -106
- data/testing/rspec/spec/unit/linters/feature_file_with_mismatched_name_linter_unit_spec.rb +0 -124
- data/testing/rspec/spec/unit/linters/feature_with_too_many_different_tags_linter_unit_spec.rb +0 -293
- data/testing/rspec/spec/unit/linters/feature_without_description_linter_unit_spec.rb +0 -80
- data/testing/rspec/spec/unit/linters/feature_without_name_linter_unit_spec.rb +0 -84
- data/testing/rspec/spec/unit/linters/feature_without_scenarios_linter_unit_spec.rb +0 -102
- data/testing/rspec/spec/unit/linters/linter_unit_spec.rb +0 -197
- data/testing/rspec/spec/unit/linters/linter_unit_specs.rb +0 -57
- data/testing/rspec/spec/unit/linters/outline_with_single_example_row_linter_unit_spec.rb +0 -184
- data/testing/rspec/spec/unit/linters/single_test_background_linter_unit_spec.rb +0 -89
- data/testing/rspec/spec/unit/linters/step_with_end_period_linter_unit_spec.rb +0 -54
- data/testing/rspec/spec/unit/linters/step_with_too_many_characters_linter_unit_spec.rb +0 -155
- data/testing/rspec/spec/unit/linters/test_should_use_background_linter_unit_spec.rb +0 -464
- data/testing/rspec/spec/unit/linters/test_with_action_step_as_final_step_linter_unit_spec.rb +0 -165
- data/testing/rspec/spec/unit/linters/test_with_bad_name_linter_unit_spec.rb +0 -81
- data/testing/rspec/spec/unit/linters/test_with_no_action_step_linter_unit_spec.rb +0 -244
- data/testing/rspec/spec/unit/linters/test_with_no_name_linter_unit_spec.rb +0 -88
- data/testing/rspec/spec/unit/linters/test_with_no_verification_step_linter_unit_spec.rb +0 -246
- data/testing/rspec/spec/unit/linters/test_with_setup_step_after_action_step_linter_unit_spec.rb +0 -233
- data/testing/rspec/spec/unit/linters/test_with_setup_step_after_verification_step_linter_unit_spec.rb +0 -233
- data/testing/rspec/spec/unit/linters/test_with_setup_step_as_final_step_linter_unit_spec.rb +0 -164
- data/testing/rspec/spec/unit/linters/test_with_too_many_steps_linter_unit_spec.rb +0 -192
@@ -1,88 +0,0 @@
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
2
|
-
|
3
|
-
|
4
|
-
RSpec.describe CukeLinter::TestWithNoNameLinter do
|
5
|
-
|
6
|
-
let(:model_file_path) { 'some_file_path' }
|
7
|
-
|
8
|
-
it_should_behave_like 'a linter at the unit level'
|
9
|
-
|
10
|
-
|
11
|
-
it 'has a name' do
|
12
|
-
expect(subject.name).to eq('TestWithNoNameLinter')
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'linting' do
|
16
|
-
|
17
|
-
['scenario', 'outline'].each do |model_type|
|
18
|
-
|
19
|
-
context "with a #{model_type} that has no name" do
|
20
|
-
|
21
|
-
context 'because its name is empty' do
|
22
|
-
|
23
|
-
let(:test_model) do
|
24
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
25
|
-
model.name = ''
|
26
|
-
|
27
|
-
model
|
28
|
-
end
|
29
|
-
|
30
|
-
it_should_behave_like 'a linter linting a bad model'
|
31
|
-
|
32
|
-
|
33
|
-
it 'records a problem' do
|
34
|
-
result = subject.lint(test_model)
|
35
|
-
|
36
|
-
expect(result[:problem]).to eq('Test does not have a name.')
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'because its name is nil' do
|
42
|
-
|
43
|
-
let(:test_model) do
|
44
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
45
|
-
model.name = nil
|
46
|
-
|
47
|
-
model
|
48
|
-
end
|
49
|
-
|
50
|
-
it_should_behave_like 'a linter linting a bad model'
|
51
|
-
|
52
|
-
|
53
|
-
it 'records a problem' do
|
54
|
-
result = subject.lint(test_model)
|
55
|
-
|
56
|
-
expect(result[:problem]).to eq('Test does not have a name.')
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
context "with a #{model_type} that does have a name" do
|
64
|
-
|
65
|
-
let(:test_model) do
|
66
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
67
|
-
model.name = 'foo'
|
68
|
-
|
69
|
-
model
|
70
|
-
end
|
71
|
-
|
72
|
-
it_should_behave_like 'a linter linting a good model'
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
|
78
|
-
context 'a non-test model' do
|
79
|
-
|
80
|
-
let(:test_model) { CukeModeler::Model.new }
|
81
|
-
|
82
|
-
it_should_behave_like 'a linter linting a good model'
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
@@ -1,246 +0,0 @@
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
2
|
-
|
3
|
-
|
4
|
-
RSpec.describe CukeLinter::TestWithNoVerificationStepLinter do
|
5
|
-
|
6
|
-
let(:model_file_path) { 'some_file_path' }
|
7
|
-
|
8
|
-
it_should_behave_like 'a linter at the unit level'
|
9
|
-
it_should_behave_like 'a configurable linter at the unit level'
|
10
|
-
|
11
|
-
|
12
|
-
it 'has a name' do
|
13
|
-
expect(subject.name).to eq('TestWithNoVerificationStepLinter')
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'linting' do
|
17
|
-
|
18
|
-
['scenario', 'outline'].each do |model_type|
|
19
|
-
|
20
|
-
context "with a #{model_type} that has no verification step" do
|
21
|
-
|
22
|
-
context 'because it has no steps' do
|
23
|
-
|
24
|
-
context 'because its steps are empty' do
|
25
|
-
|
26
|
-
let(:test_model) do
|
27
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
28
|
-
model.steps = []
|
29
|
-
|
30
|
-
model
|
31
|
-
end
|
32
|
-
|
33
|
-
it_should_behave_like 'a linter linting a bad model'
|
34
|
-
|
35
|
-
|
36
|
-
it 'records a problem' do
|
37
|
-
result = subject.lint(test_model)
|
38
|
-
|
39
|
-
expect(result[:problem]).to eq("Test does not have a 'Then' step.")
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'because its steps are nil' do
|
45
|
-
|
46
|
-
let(:test_model) do
|
47
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
48
|
-
model.steps = nil
|
49
|
-
|
50
|
-
model
|
51
|
-
end
|
52
|
-
|
53
|
-
it_should_behave_like 'a linter linting a bad model'
|
54
|
-
|
55
|
-
|
56
|
-
it 'records a problem' do
|
57
|
-
result = subject.lint(test_model)
|
58
|
-
|
59
|
-
expect(result[:problem]).to eq("Test does not have a 'Then' step.")
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
context 'because none of its steps is a verification step' do
|
67
|
-
|
68
|
-
let(:test_model) do
|
69
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
70
|
-
model.steps = [CukeModeler::Step.new('* not a verification step')]
|
71
|
-
|
72
|
-
model
|
73
|
-
end
|
74
|
-
|
75
|
-
it_should_behave_like 'a linter linting a bad model'
|
76
|
-
|
77
|
-
|
78
|
-
it 'records a problem' do
|
79
|
-
result = subject.lint(test_model)
|
80
|
-
|
81
|
-
expect(result[:problem]).to eq("Test does not have a 'Then' step.")
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
context "with a #{model_type} that does have a verification step" do
|
89
|
-
|
90
|
-
context 'that comes from its background' do
|
91
|
-
|
92
|
-
let(:test_model) do
|
93
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
94
|
-
model.steps = []
|
95
|
-
background_model = CukeModeler::Background.new
|
96
|
-
background_model.steps = [CukeModeler::Step.new('Then a verification step')]
|
97
|
-
model.parent_model.background = background_model
|
98
|
-
|
99
|
-
model
|
100
|
-
end
|
101
|
-
|
102
|
-
it_should_behave_like 'a linter linting a good model'
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
|
-
context 'that is part of itself' do
|
107
|
-
|
108
|
-
let(:test_model) do
|
109
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
110
|
-
model.steps = [CukeModeler::Step.new('Then a verification step')]
|
111
|
-
|
112
|
-
model
|
113
|
-
end
|
114
|
-
|
115
|
-
it_should_behave_like 'a linter linting a good model'
|
116
|
-
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
['scenario', 'outline'].each do |model_type|
|
124
|
-
|
125
|
-
context "with a #{model_type} that has a related background" do
|
126
|
-
|
127
|
-
let(:test_model) do
|
128
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
129
|
-
model.parent_model.background = background_model
|
130
|
-
|
131
|
-
model
|
132
|
-
end
|
133
|
-
|
134
|
-
context 'that has no background steps' do
|
135
|
-
context 'because its steps are empty' do
|
136
|
-
|
137
|
-
let(:background_model) do
|
138
|
-
model = CukeModeler::Background.new
|
139
|
-
model.steps = []
|
140
|
-
|
141
|
-
model
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'can handle it' do
|
145
|
-
expect { subject.lint(test_model) }.to_not raise_error
|
146
|
-
end
|
147
|
-
|
148
|
-
end
|
149
|
-
|
150
|
-
context 'because its steps are nil' do
|
151
|
-
|
152
|
-
let(:background_model) do
|
153
|
-
model = CukeModeler::Background.new
|
154
|
-
model.steps = nil
|
155
|
-
|
156
|
-
model
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'can handle it' do
|
160
|
-
expect { subject.lint(test_model) }.to_not raise_error
|
161
|
-
end
|
162
|
-
|
163
|
-
end
|
164
|
-
|
165
|
-
end
|
166
|
-
|
167
|
-
end
|
168
|
-
|
169
|
-
end
|
170
|
-
|
171
|
-
|
172
|
-
describe 'configuration' do
|
173
|
-
|
174
|
-
let(:test_model) do
|
175
|
-
CukeLinter::ModelFactory.generate_scenario_model(source_text: 'Scenario:
|
176
|
-
Then a step')
|
177
|
-
end
|
178
|
-
|
179
|
-
context 'with configuration' do
|
180
|
-
|
181
|
-
before(:each) do
|
182
|
-
subject.configure(configuration)
|
183
|
-
end
|
184
|
-
|
185
|
-
context "with a configured 'Then' keyword" do
|
186
|
-
|
187
|
-
let(:then_keyword) { 'Foo' }
|
188
|
-
let(:configuration) { { 'Then' => then_keyword } }
|
189
|
-
|
190
|
-
it "uses the configured 'Then' keyword" do
|
191
|
-
test_model.steps.first.keyword = 'Then'
|
192
|
-
|
193
|
-
result = subject.lint(test_model)
|
194
|
-
|
195
|
-
expect(result).to_not be_nil
|
196
|
-
end
|
197
|
-
|
198
|
-
end
|
199
|
-
|
200
|
-
end
|
201
|
-
|
202
|
-
context 'without configuration' do
|
203
|
-
|
204
|
-
context 'because configuration never happened' do
|
205
|
-
|
206
|
-
it "uses the default 'Then' keyword" do
|
207
|
-
test_model.steps.first.keyword = CukeLinter::DEFAULT_THEN_KEYWORD
|
208
|
-
|
209
|
-
result = subject.lint(test_model)
|
210
|
-
|
211
|
-
expect(result).to be_nil
|
212
|
-
end
|
213
|
-
|
214
|
-
end
|
215
|
-
|
216
|
-
context "because configuration did not set a 'Then' keyword" do
|
217
|
-
|
218
|
-
before(:each) do
|
219
|
-
subject.configure(configuration)
|
220
|
-
end
|
221
|
-
|
222
|
-
let(:configuration) { {} }
|
223
|
-
|
224
|
-
it "uses the default 'Then' keyword" do
|
225
|
-
test_model.steps.last.keyword = CukeLinter::DEFAULT_THEN_KEYWORD
|
226
|
-
|
227
|
-
result = subject.lint(test_model)
|
228
|
-
|
229
|
-
expect(result).to be_nil
|
230
|
-
end
|
231
|
-
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
end
|
237
|
-
|
238
|
-
context 'a non-test model' do
|
239
|
-
|
240
|
-
let(:test_model) { CukeModeler::Model.new }
|
241
|
-
|
242
|
-
it_should_behave_like 'a linter linting a good model'
|
243
|
-
|
244
|
-
end
|
245
|
-
end
|
246
|
-
end
|
data/testing/rspec/spec/unit/linters/test_with_setup_step_after_action_step_linter_unit_spec.rb
DELETED
@@ -1,233 +0,0 @@
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
2
|
-
|
3
|
-
|
4
|
-
RSpec.describe CukeLinter::TestWithSetupStepAfterActionStepLinter do
|
5
|
-
|
6
|
-
let(:model_file_path) { 'some_file_path' }
|
7
|
-
|
8
|
-
it_should_behave_like 'a linter at the unit level'
|
9
|
-
it_should_behave_like 'a configurable linter at the unit level'
|
10
|
-
|
11
|
-
|
12
|
-
it 'has a name' do
|
13
|
-
expect(subject.name).to eq('TestWithSetupStepAfterActionStepLinter')
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'linting' do
|
17
|
-
|
18
|
-
['scenario', 'outline'].each do |model_type|
|
19
|
-
|
20
|
-
context "with a #{model_type} that has a setup step after an action step" do
|
21
|
-
|
22
|
-
let(:test_model) do
|
23
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model",
|
24
|
-
parent_file_path: model_file_path)
|
25
|
-
model.steps = [CukeModeler::Step.new('When a step'),
|
26
|
-
CukeModeler::Step.new('Given a step')]
|
27
|
-
|
28
|
-
model
|
29
|
-
end
|
30
|
-
|
31
|
-
it_should_behave_like 'a linter linting a bad model'
|
32
|
-
|
33
|
-
|
34
|
-
it 'records a problem' do
|
35
|
-
result = subject.lint(test_model)
|
36
|
-
|
37
|
-
expect(result[:problem]).to eq("Test has 'Given' step after 'When' step.")
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
context "with a #{model_type} that does not have a setup step after an action step" do
|
43
|
-
|
44
|
-
context 'because it has no steps' do
|
45
|
-
|
46
|
-
context 'because its steps are empty' do
|
47
|
-
|
48
|
-
let(:test_model) do
|
49
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
50
|
-
model.steps = []
|
51
|
-
|
52
|
-
model
|
53
|
-
end
|
54
|
-
|
55
|
-
it_should_behave_like 'a linter linting a good model'
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'because its steps are nil' do
|
60
|
-
|
61
|
-
let(:test_model) do
|
62
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
63
|
-
model.steps = nil
|
64
|
-
|
65
|
-
model
|
66
|
-
end
|
67
|
-
|
68
|
-
it_should_behave_like 'a linter linting a good model'
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
context 'because its setup steps come before its action steps' do
|
75
|
-
|
76
|
-
let(:test_model) do
|
77
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
78
|
-
model.steps = [CukeModeler::Step.new('* a step')]
|
79
|
-
|
80
|
-
model
|
81
|
-
end
|
82
|
-
|
83
|
-
it_should_behave_like 'a linter linting a good model'
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
88
|
-
|
89
|
-
context "with a #{model_type} that has an associated background" do
|
90
|
-
|
91
|
-
let(:test_model) do
|
92
|
-
feature_model = CukeLinter::ModelFactory.generate_feature_model(source_text: 'Feature:
|
93
|
-
Background:
|
94
|
-
Given a step
|
95
|
-
When a step
|
96
|
-
Given a step
|
97
|
-
When a step')
|
98
|
-
|
99
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
100
|
-
model.steps = [CukeModeler::Step.new('Given a step')]
|
101
|
-
|
102
|
-
model.parent_model = feature_model
|
103
|
-
feature_model.tests << model
|
104
|
-
|
105
|
-
model
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'does not consider those steps when linting' do
|
109
|
-
expect(subject.lint(test_model)).to eq(nil)
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
describe 'configuration' do
|
117
|
-
|
118
|
-
let(:test_model) do
|
119
|
-
CukeLinter::ModelFactory.generate_scenario_model(source_text: 'Scenario:
|
120
|
-
When a step
|
121
|
-
Given a step')
|
122
|
-
end
|
123
|
-
|
124
|
-
context 'with configuration' do
|
125
|
-
|
126
|
-
before(:each) do
|
127
|
-
subject.configure(configuration)
|
128
|
-
end
|
129
|
-
|
130
|
-
context "with a configured 'Given' keyword" do
|
131
|
-
|
132
|
-
let(:given_keyword) { 'Foo' }
|
133
|
-
let(:configuration) { { 'Given' => given_keyword } }
|
134
|
-
|
135
|
-
it "uses the configured 'Given' keyword" do
|
136
|
-
test_model.steps.last.keyword = given_keyword
|
137
|
-
|
138
|
-
result = subject.lint(test_model)
|
139
|
-
|
140
|
-
expect(result).to_not be_nil
|
141
|
-
end
|
142
|
-
|
143
|
-
end
|
144
|
-
|
145
|
-
context "with a configured 'When' keyword" do
|
146
|
-
|
147
|
-
let(:when_keyword) { 'Foo' }
|
148
|
-
let(:configuration) { { 'When' => when_keyword } }
|
149
|
-
|
150
|
-
it "uses the configured 'When' keyword" do
|
151
|
-
test_model.steps.first.keyword = when_keyword
|
152
|
-
|
153
|
-
result = subject.lint(test_model)
|
154
|
-
|
155
|
-
expect(result).to_not be_nil
|
156
|
-
end
|
157
|
-
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
context 'without configuration' do
|
163
|
-
|
164
|
-
context 'because configuration never happened' do
|
165
|
-
|
166
|
-
it "uses the default 'Given' keyword" do
|
167
|
-
test_model.steps.last.keyword = CukeLinter::DEFAULT_GIVEN_KEYWORD
|
168
|
-
|
169
|
-
result = subject.lint(test_model)
|
170
|
-
|
171
|
-
expect(result).to_not be_nil
|
172
|
-
end
|
173
|
-
|
174
|
-
it "uses the default 'When' keyword" do
|
175
|
-
test_model.steps.first.keyword = CukeLinter::DEFAULT_WHEN_KEYWORD
|
176
|
-
|
177
|
-
result = subject.lint(test_model)
|
178
|
-
|
179
|
-
expect(result).to_not be_nil
|
180
|
-
end
|
181
|
-
|
182
|
-
end
|
183
|
-
|
184
|
-
context "because configuration did not set a 'Given' keyword" do
|
185
|
-
|
186
|
-
before(:each) do
|
187
|
-
subject.configure(configuration)
|
188
|
-
end
|
189
|
-
|
190
|
-
let(:configuration) { {} }
|
191
|
-
|
192
|
-
it "uses the default 'Given' keyword" do
|
193
|
-
test_model.steps.last.keyword = CukeLinter::DEFAULT_GIVEN_KEYWORD
|
194
|
-
|
195
|
-
result = subject.lint(test_model)
|
196
|
-
|
197
|
-
expect(result).to_not be_nil
|
198
|
-
end
|
199
|
-
|
200
|
-
end
|
201
|
-
|
202
|
-
context "because configuration did not set a 'When' keyword" do
|
203
|
-
|
204
|
-
before(:each) do
|
205
|
-
subject.configure(configuration)
|
206
|
-
end
|
207
|
-
|
208
|
-
let(:configuration) { {} }
|
209
|
-
|
210
|
-
it "uses the default 'When' keyword" do
|
211
|
-
test_model.steps.first.keyword = CukeLinter::DEFAULT_WHEN_KEYWORD
|
212
|
-
|
213
|
-
result = subject.lint(test_model)
|
214
|
-
|
215
|
-
expect(result).to_not be_nil
|
216
|
-
end
|
217
|
-
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
end
|
223
|
-
|
224
|
-
|
225
|
-
context 'a non-test model' do
|
226
|
-
|
227
|
-
let(:test_model) { CukeModeler::Model.new }
|
228
|
-
|
229
|
-
it_should_behave_like 'a linter linting a good model'
|
230
|
-
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|