cuke_linter 0.9.0 → 0.10.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 +4 -4
- data/CHANGELOG.md +17 -1
- data/CONTRIBUTING.md +26 -0
- data/README.md +2 -15
- data/lib/cuke_linter.rb +36 -18
- data/lib/cuke_linter/linters/example_without_name_linter.rb +1 -1
- data/lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb +38 -0
- data/lib/cuke_linter/linters/test_should_use_background_linter.rb +28 -0
- data/lib/cuke_linter/linters/test_with_action_step_as_final_step_linter.rb +23 -0
- data/lib/cuke_linter/linters/test_with_setup_step_after_action_step_linter.rb +31 -0
- data/lib/cuke_linter/linters/test_with_setup_step_after_verification_step_linter.rb +31 -0
- data/lib/cuke_linter/linters/test_with_setup_step_as_final_step_linter.rb +23 -0
- data/lib/cuke_linter/version.rb +1 -1
- data/testing/cucumber/features/default_linters.feature +20 -14
- data/testing/cucumber/features/linters/example_without_name.feature +8 -6
- data/testing/cucumber/features/linters/feature_with_too_many_different_tags.feature +56 -0
- data/testing/cucumber/features/linters/step_with_end_period.feature +1 -1
- data/testing/cucumber/features/linters/test_should_use_background.feature +29 -0
- data/testing/cucumber/features/linters/test_with_action_as_final_step.feature +28 -0
- data/testing/cucumber/features/linters/test_with_setup_step_after_action_step.feature +30 -0
- data/testing/cucumber/features/linters/test_with_setup_step_after_verification_step.feature +30 -0
- data/testing/cucumber/features/linters/test_with_setup_step_as_final_step.feature +28 -0
- data/testing/cucumber/features/linters/test_with_too_many_steps.feature +5 -0
- data/testing/cucumber/step_definitions/setup_steps.rb +28 -0
- data/testing/model_factory.rb +1 -1
- data/testing/rspec/spec/integration/cuke_linter_integration_spec.rb +12 -0
- data/testing/rspec/spec/integration/linters/feature_with_too_many_different_tags_linter_integration_spec.rb +8 -0
- data/testing/rspec/spec/integration/linters/test_should_use_background_linter_integration_spec.rb +8 -0
- data/testing/rspec/spec/integration/linters/test_with_action_step_as_final_step_linter_integration_spec.rb +8 -0
- data/testing/rspec/spec/integration/linters/test_with_setup_step_after_action_step_linter_integration_spec.rb +8 -0
- data/testing/rspec/spec/integration/linters/test_with_setup_step_after_verification_step_linter_integration_spec.rb +8 -0
- data/testing/rspec/spec/integration/linters/test_with_setup_step_as_final_step_linter_integration_spec.rb +8 -0
- data/testing/rspec/spec/unit/linters/background_does_more_than_setup_linter_unit_spec.rb +20 -57
- data/testing/rspec/spec/unit/linters/element_with_too_many_tags_linter_unit_spec.rb +18 -52
- data/testing/rspec/spec/unit/linters/example_without_name_linter_unit_spec.rb +41 -43
- data/testing/rspec/spec/unit/linters/feature_with_too_many_different_tags_linter_unit_spec.rb +293 -0
- data/testing/rspec/spec/unit/linters/feature_without_description_linter_unit_spec.rb +25 -42
- data/testing/rspec/spec/unit/linters/feature_without_name_linter_unit_spec.rb +10 -38
- data/testing/rspec/spec/unit/linters/feature_without_scenarios_linter_unit_spec.rb +32 -52
- data/testing/rspec/spec/unit/linters/linter_unit_spec.rb +27 -10
- data/testing/rspec/spec/unit/linters/linter_unit_specs.rb +26 -12
- data/testing/rspec/spec/unit/linters/outline_with_single_example_row_linter_unit_spec.rb +19 -66
- data/testing/rspec/spec/unit/linters/single_test_background_linter_unit_spec.rb +12 -39
- data/testing/rspec/spec/unit/linters/step_with_end_period_linter_unit_spec.rb +9 -28
- data/testing/rspec/spec/unit/linters/step_with_too_many_characters_linter_unit_spec.rb +19 -45
- data/testing/rspec/spec/unit/linters/test_should_use_background_linter_unit_spec.rb +226 -0
- data/testing/rspec/spec/unit/linters/test_with_action_step_as_final_step_linter_unit_spec.rb +98 -0
- data/testing/rspec/spec/unit/linters/test_with_no_action_step_linter_unit_spec.rb +10 -51
- data/testing/rspec/spec/unit/linters/test_with_no_name_linter_unit_spec.rb +11 -38
- data/testing/rspec/spec/unit/linters/test_with_no_verification_step_linter_unit_spec.rb +16 -54
- data/testing/rspec/spec/unit/linters/test_with_setup_step_after_action_step_linter_unit_spec.rb +124 -0
- data/testing/rspec/spec/unit/linters/test_with_setup_step_after_verification_step_linter_unit_spec.rb +125 -0
- data/testing/rspec/spec/unit/linters/test_with_setup_step_as_final_step_linter_unit_spec.rb +98 -0
- data/testing/rspec/spec/unit/linters/test_with_too_many_steps_linter_unit_spec.rb +9 -49
- metadata +27 -2
@@ -0,0 +1,98 @@
|
|
1
|
+
require_relative '../../../../../environments/rspec_env'
|
2
|
+
|
3
|
+
|
4
|
+
RSpec.describe CukeLinter::TestWithSetupStepAsFinalStepLinter 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('TestWithSetupStepAsFinalStepLinter')
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'linting' do
|
16
|
+
|
17
|
+
['scenario', 'outline'].each do |model_type|
|
18
|
+
|
19
|
+
context "with a #{model_type} that has a setup step as its final step" do
|
20
|
+
|
21
|
+
let(:test_model) do
|
22
|
+
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
23
|
+
model.steps = [CukeModeler::Step.new('When a step'),
|
24
|
+
CukeModeler::Step.new('Given a step')]
|
25
|
+
|
26
|
+
model
|
27
|
+
end
|
28
|
+
|
29
|
+
it_should_behave_like 'a linter linting a bad model'
|
30
|
+
|
31
|
+
|
32
|
+
it 'records a problem' do
|
33
|
+
result = subject.lint(test_model)
|
34
|
+
|
35
|
+
expect(result[:problem]).to eq("Test has 'Given' as the final step.")
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
context "with a #{model_type} that does not have a setup step as its final step" do
|
41
|
+
|
42
|
+
context 'because it has no steps' do
|
43
|
+
|
44
|
+
context 'because its steps are empty' do
|
45
|
+
|
46
|
+
let(:test_model) do
|
47
|
+
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
48
|
+
model.steps = []
|
49
|
+
|
50
|
+
model
|
51
|
+
end
|
52
|
+
|
53
|
+
it_should_behave_like 'a linter linting a good model'
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'because its steps are nil' do
|
58
|
+
|
59
|
+
let(:test_model) do
|
60
|
+
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
61
|
+
model.steps = nil
|
62
|
+
|
63
|
+
model
|
64
|
+
end
|
65
|
+
|
66
|
+
it_should_behave_like 'a linter linting a good model'
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'because its final step is not a setup step' do
|
73
|
+
|
74
|
+
let(:test_model) do
|
75
|
+
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
76
|
+
model.steps = [CukeModeler::Step.new('Then a step')]
|
77
|
+
|
78
|
+
model
|
79
|
+
end
|
80
|
+
|
81
|
+
it_should_behave_like 'a linter linting a good model'
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
context 'a non-test model' do
|
91
|
+
|
92
|
+
let(:test_model) { CukeModeler::Model.new }
|
93
|
+
|
94
|
+
it_should_behave_like 'a linter linting a good model'
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -3,30 +3,7 @@ require_relative '../../../../../environments/rspec_env'
|
|
3
3
|
|
4
4
|
RSpec.describe CukeLinter::TestWithTooManyStepsLinter do
|
5
5
|
|
6
|
-
let(:
|
7
|
-
model = CukeLinter::ModelFactory.generate_scenario_model
|
8
|
-
model.steps = [:step_1]
|
9
|
-
|
10
|
-
model
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:bad_data) do
|
14
|
-
model = CukeLinter::ModelFactory.generate_scenario_model
|
15
|
-
model.steps = [:step_1,
|
16
|
-
:step_2,
|
17
|
-
:step_3,
|
18
|
-
:step_4,
|
19
|
-
:step_5,
|
20
|
-
:step_6,
|
21
|
-
:step_7,
|
22
|
-
:step_8,
|
23
|
-
:step_9,
|
24
|
-
:step_10,
|
25
|
-
:step_11]
|
26
|
-
|
27
|
-
model
|
28
|
-
end
|
29
|
-
|
6
|
+
let(:model_file_path) { 'some_file_path' }
|
30
7
|
|
31
8
|
it_should_behave_like 'a linter at the unit level'
|
32
9
|
it_should_behave_like 'a configurable linter at the unit level'
|
@@ -43,7 +20,7 @@ RSpec.describe CukeLinter::TestWithTooManyStepsLinter do
|
|
43
20
|
context "with a #{model_type} that has too many steps" do
|
44
21
|
|
45
22
|
let(:test_model) do
|
46
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path:
|
23
|
+
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
47
24
|
model.steps = [:step_1,
|
48
25
|
:step_2,
|
49
26
|
:step_3,
|
@@ -59,22 +36,15 @@ RSpec.describe CukeLinter::TestWithTooManyStepsLinter do
|
|
59
36
|
model
|
60
37
|
end
|
61
38
|
|
39
|
+
it_should_behave_like 'a linter linting a bad model'
|
40
|
+
|
41
|
+
|
62
42
|
it 'records a problem' do
|
63
43
|
result = subject.lint(test_model)
|
64
44
|
|
65
45
|
expect(result[:problem]).to match(/^Test has too many steps. \d+ steps found \(max 10\)/)
|
66
46
|
end
|
67
47
|
|
68
|
-
it 'records the location of the problem' do
|
69
|
-
test_model.source_line = 1
|
70
|
-
result = subject.lint(test_model)
|
71
|
-
expect(result[:location]).to eq('path_to_file:1')
|
72
|
-
|
73
|
-
test_model.source_line = 3
|
74
|
-
result = subject.lint(test_model)
|
75
|
-
expect(result[:location]).to eq('path_to_file:3')
|
76
|
-
end
|
77
|
-
|
78
48
|
it 'includes the number of steps found in the problem record' do
|
79
49
|
step_count = test_model.steps.count
|
80
50
|
result = subject.lint(test_model)
|
@@ -98,9 +68,7 @@ RSpec.describe CukeLinter::TestWithTooManyStepsLinter do
|
|
98
68
|
model
|
99
69
|
end
|
100
70
|
|
101
|
-
|
102
|
-
expect(subject.lint(test_model)).to eq(nil)
|
103
|
-
end
|
71
|
+
it_should_behave_like 'a linter linting a good model'
|
104
72
|
|
105
73
|
end
|
106
74
|
|
@@ -115,9 +83,7 @@ RSpec.describe CukeLinter::TestWithTooManyStepsLinter do
|
|
115
83
|
model
|
116
84
|
end
|
117
85
|
|
118
|
-
|
119
|
-
expect(subject.lint(test_model)).to eq(nil)
|
120
|
-
end
|
86
|
+
it_should_behave_like 'a linter linting a good model'
|
121
87
|
|
122
88
|
end
|
123
89
|
|
@@ -130,9 +96,7 @@ RSpec.describe CukeLinter::TestWithTooManyStepsLinter do
|
|
130
96
|
model
|
131
97
|
end
|
132
98
|
|
133
|
-
|
134
|
-
expect(subject.lint(test_model)).to eq(nil)
|
135
|
-
end
|
99
|
+
it_should_behave_like 'a linter linting a good model'
|
136
100
|
|
137
101
|
end
|
138
102
|
|
@@ -221,11 +185,7 @@ RSpec.describe CukeLinter::TestWithTooManyStepsLinter do
|
|
221
185
|
|
222
186
|
let(:test_model) { CukeModeler::Model.new }
|
223
187
|
|
224
|
-
|
225
|
-
result = subject.lint(test_model)
|
226
|
-
|
227
|
-
expect(result).to eq(nil)
|
228
|
-
end
|
188
|
+
it_should_behave_like 'a linter linting a good model'
|
229
189
|
|
230
190
|
end
|
231
191
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuke_linter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cuke_modeler
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- ".simplecov"
|
163
163
|
- ".travis.yml"
|
164
164
|
- CHANGELOG.md
|
165
|
+
- CONTRIBUTING.md
|
165
166
|
- Gemfile
|
166
167
|
- LICENSE.txt
|
167
168
|
- README.md
|
@@ -179,6 +180,7 @@ files:
|
|
179
180
|
- lib/cuke_linter/linters/background_does_more_than_setup_linter.rb
|
180
181
|
- lib/cuke_linter/linters/element_with_too_many_tags_linter.rb
|
181
182
|
- lib/cuke_linter/linters/example_without_name_linter.rb
|
183
|
+
- lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb
|
182
184
|
- lib/cuke_linter/linters/feature_without_description_linter.rb
|
183
185
|
- lib/cuke_linter/linters/feature_without_name_linter.rb
|
184
186
|
- lib/cuke_linter/linters/feature_without_scenarios_linter.rb
|
@@ -187,9 +189,14 @@ files:
|
|
187
189
|
- lib/cuke_linter/linters/single_test_background_linter.rb
|
188
190
|
- lib/cuke_linter/linters/step_with_end_period_linter.rb
|
189
191
|
- lib/cuke_linter/linters/step_with_too_many_characters_linter.rb
|
192
|
+
- lib/cuke_linter/linters/test_should_use_background_linter.rb
|
193
|
+
- lib/cuke_linter/linters/test_with_action_step_as_final_step_linter.rb
|
190
194
|
- lib/cuke_linter/linters/test_with_no_action_step_linter.rb
|
191
195
|
- lib/cuke_linter/linters/test_with_no_name_linter.rb
|
192
196
|
- lib/cuke_linter/linters/test_with_no_verification_step_linter.rb
|
197
|
+
- lib/cuke_linter/linters/test_with_setup_step_after_action_step_linter.rb
|
198
|
+
- lib/cuke_linter/linters/test_with_setup_step_after_verification_step_linter.rb
|
199
|
+
- lib/cuke_linter/linters/test_with_setup_step_as_final_step_linter.rb
|
193
200
|
- lib/cuke_linter/linters/test_with_too_many_steps_linter.rb
|
194
201
|
- lib/cuke_linter/version.rb
|
195
202
|
- testing/cucumber/features/command_line.feature
|
@@ -202,6 +209,7 @@ files:
|
|
202
209
|
- testing/cucumber/features/linters/background_does_more_than_setup.feature
|
203
210
|
- testing/cucumber/features/linters/element_with_too_many_tags.feature
|
204
211
|
- testing/cucumber/features/linters/example_without_name.feature
|
212
|
+
- testing/cucumber/features/linters/feature_with_too_many_different_tags.feature
|
205
213
|
- testing/cucumber/features/linters/feature_without_description.feature
|
206
214
|
- testing/cucumber/features/linters/feature_without_name.feature
|
207
215
|
- testing/cucumber/features/linters/feature_without_scenarios.feature
|
@@ -209,9 +217,14 @@ files:
|
|
209
217
|
- testing/cucumber/features/linters/single_test_background.feature
|
210
218
|
- testing/cucumber/features/linters/step_too_long.feature
|
211
219
|
- testing/cucumber/features/linters/step_with_end_period.feature
|
220
|
+
- testing/cucumber/features/linters/test_should_use_background.feature
|
221
|
+
- testing/cucumber/features/linters/test_with_action_as_final_step.feature
|
212
222
|
- testing/cucumber/features/linters/test_with_no_action_step.feature
|
213
223
|
- testing/cucumber/features/linters/test_with_no_name.feature
|
214
224
|
- testing/cucumber/features/linters/test_with_no_verification_step.feature
|
225
|
+
- testing/cucumber/features/linters/test_with_setup_step_after_action_step.feature
|
226
|
+
- testing/cucumber/features/linters/test_with_setup_step_after_verification_step.feature
|
227
|
+
- testing/cucumber/features/linters/test_with_setup_step_as_final_step.feature
|
215
228
|
- testing/cucumber/features/linters/test_with_too_many_steps.feature
|
216
229
|
- testing/cucumber/step_definitions/action_steps.rb
|
217
230
|
- testing/cucumber/step_definitions/setup_steps.rb
|
@@ -228,6 +241,7 @@ files:
|
|
228
241
|
- testing/rspec/spec/integration/linters/background_does_more_than_setup_linter_integration_spec.rb
|
229
242
|
- testing/rspec/spec/integration/linters/element_with_too_many_tags_linter_integration_spec.rb
|
230
243
|
- testing/rspec/spec/integration/linters/example_without_name_linter_integration_spec.rb
|
244
|
+
- testing/rspec/spec/integration/linters/feature_with_too_many_different_tags_linter_integration_spec.rb
|
231
245
|
- testing/rspec/spec/integration/linters/feature_without_description_linter_integration_spec.rb
|
232
246
|
- testing/rspec/spec/integration/linters/feature_without_name_linter_integration_spec.rb
|
233
247
|
- testing/rspec/spec/integration/linters/feature_without_scenarios_linter_integration_spec.rb
|
@@ -237,9 +251,14 @@ files:
|
|
237
251
|
- testing/rspec/spec/integration/linters/single_test_background_linter_integration_spec.rb
|
238
252
|
- testing/rspec/spec/integration/linters/step_with_end_period_linter_integration_spec.rb
|
239
253
|
- testing/rspec/spec/integration/linters/step_with_too_many_characters_linter_integration_spec.rb
|
254
|
+
- testing/rspec/spec/integration/linters/test_should_use_background_linter_integration_spec.rb
|
255
|
+
- testing/rspec/spec/integration/linters/test_with_action_step_as_final_step_linter_integration_spec.rb
|
240
256
|
- testing/rspec/spec/integration/linters/test_with_no_action_step_integration_spec.rb
|
241
257
|
- testing/rspec/spec/integration/linters/test_with_no_name_integration_spec.rb
|
242
258
|
- testing/rspec/spec/integration/linters/test_with_no_verification_step_integration_spec.rb
|
259
|
+
- testing/rspec/spec/integration/linters/test_with_setup_step_after_action_step_linter_integration_spec.rb
|
260
|
+
- testing/rspec/spec/integration/linters/test_with_setup_step_after_verification_step_linter_integration_spec.rb
|
261
|
+
- testing/rspec/spec/integration/linters/test_with_setup_step_as_final_step_linter_integration_spec.rb
|
243
262
|
- testing/rspec/spec/integration/linters/test_with_too_many_steps_linter_integration_spec.rb
|
244
263
|
- testing/rspec/spec/unit/cuke_linter_unit_spec.rb
|
245
264
|
- testing/rspec/spec/unit/formatters/formatter_unit_specs.rb
|
@@ -248,6 +267,7 @@ files:
|
|
248
267
|
- testing/rspec/spec/unit/linters/configurable_linter_unit_specs.rb
|
249
268
|
- testing/rspec/spec/unit/linters/element_with_too_many_tags_linter_unit_spec.rb
|
250
269
|
- testing/rspec/spec/unit/linters/example_without_name_linter_unit_spec.rb
|
270
|
+
- testing/rspec/spec/unit/linters/feature_with_too_many_different_tags_linter_unit_spec.rb
|
251
271
|
- testing/rspec/spec/unit/linters/feature_without_description_linter_unit_spec.rb
|
252
272
|
- testing/rspec/spec/unit/linters/feature_without_name_linter_unit_spec.rb
|
253
273
|
- testing/rspec/spec/unit/linters/feature_without_scenarios_linter_unit_spec.rb
|
@@ -257,9 +277,14 @@ files:
|
|
257
277
|
- testing/rspec/spec/unit/linters/single_test_background_linter_unit_spec.rb
|
258
278
|
- testing/rspec/spec/unit/linters/step_with_end_period_linter_unit_spec.rb
|
259
279
|
- testing/rspec/spec/unit/linters/step_with_too_many_characters_linter_unit_spec.rb
|
280
|
+
- testing/rspec/spec/unit/linters/test_should_use_background_linter_unit_spec.rb
|
281
|
+
- testing/rspec/spec/unit/linters/test_with_action_step_as_final_step_linter_unit_spec.rb
|
260
282
|
- testing/rspec/spec/unit/linters/test_with_no_action_step_linter_unit_spec.rb
|
261
283
|
- testing/rspec/spec/unit/linters/test_with_no_name_linter_unit_spec.rb
|
262
284
|
- testing/rspec/spec/unit/linters/test_with_no_verification_step_linter_unit_spec.rb
|
285
|
+
- testing/rspec/spec/unit/linters/test_with_setup_step_after_action_step_linter_unit_spec.rb
|
286
|
+
- testing/rspec/spec/unit/linters/test_with_setup_step_after_verification_step_linter_unit_spec.rb
|
287
|
+
- testing/rspec/spec/unit/linters/test_with_setup_step_as_final_step_linter_unit_spec.rb
|
263
288
|
- testing/rspec/spec/unit/linters/test_with_too_many_steps_linter_unit_spec.rb
|
264
289
|
homepage: https://github.com/enkessler/cuke_linter
|
265
290
|
licenses:
|