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,124 +0,0 @@
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
2
|
-
|
3
|
-
|
4
|
-
RSpec.describe CukeLinter::FeatureFileWithMismatchedNameLinter 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('FeatureFileWithMismatchedNameLinter')
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'linting' do
|
16
|
-
|
17
|
-
let(:test_model) do
|
18
|
-
feature_model = CukeLinter::ModelFactory.generate_feature_model(parent_file_path: model_file_path,
|
19
|
-
source_text: "Feature: #{model_feature_name}")
|
20
|
-
|
21
|
-
feature_model.parent_model
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
context "with a feature file model that has mismatched feature name" do
|
26
|
-
|
27
|
-
let(:model_file_path) { 'foo.feature' }
|
28
|
-
let(:model_feature_name) { 'Bar' }
|
29
|
-
|
30
|
-
it_should_behave_like 'a linter linting a bad model'
|
31
|
-
|
32
|
-
it 'records a problem' do
|
33
|
-
result = subject.lint(test_model)
|
34
|
-
|
35
|
-
expect(result[:problem]).to eq('Feature file name does not match feature name.')
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
context "with a feature file model that does not have a mismatched feature name" do
|
41
|
-
|
42
|
-
context 'with a file name that has caps' do
|
43
|
-
let(:model_file_path) { 'Name With Caps.feature' }
|
44
|
-
let(:model_feature_name) { 'name with caps' }
|
45
|
-
|
46
|
-
it_should_behave_like 'a linter linting a good model'
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'with a feature name that has caps' do
|
50
|
-
let(:model_file_path) { 'name with caps.feature' }
|
51
|
-
let(:model_feature_name) { 'Name With Caps' }
|
52
|
-
|
53
|
-
it_should_behave_like 'a linter linting a good model'
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'with a file name that has underscores' do
|
57
|
-
let(:model_file_path) { 'name_with_underscores.feature' }
|
58
|
-
let(:model_feature_name) { 'name with underscores' }
|
59
|
-
|
60
|
-
it_should_behave_like 'a linter linting a good model'
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'with a feature name that has underscores' do
|
64
|
-
let(:model_file_path) { 'name with underscores.feature' }
|
65
|
-
let(:model_feature_name) { 'name_with_underscores' }
|
66
|
-
|
67
|
-
it_should_behave_like 'a linter linting a good model'
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'with a file name that has spaces' do
|
71
|
-
let(:model_file_path) { 'name with spaces.feature' }
|
72
|
-
let(:model_feature_name) { 'namewithspaces' }
|
73
|
-
|
74
|
-
it_should_behave_like 'a linter linting a good model'
|
75
|
-
end
|
76
|
-
|
77
|
-
context 'with a feature name that has spaces' do
|
78
|
-
let(:model_file_path) { 'namewithspaces.feature' }
|
79
|
-
let(:model_feature_name) { 'name with spaces' }
|
80
|
-
|
81
|
-
it_should_behave_like 'a linter linting a good model'
|
82
|
-
end
|
83
|
-
|
84
|
-
context 'with a file name that has hyphens' do
|
85
|
-
let(:model_file_path) { 'name-with-hyphens.feature' }
|
86
|
-
let(:model_feature_name) { 'namewithhyphens' }
|
87
|
-
|
88
|
-
it_should_behave_like 'a linter linting a good model'
|
89
|
-
end
|
90
|
-
|
91
|
-
context 'with a feature name that has hyphens' do
|
92
|
-
let(:model_file_path) { 'namewithhyphens.feature' }
|
93
|
-
let(:model_feature_name) { 'name-with-hyphens' }
|
94
|
-
|
95
|
-
it_should_behave_like 'a linter linting a good model'
|
96
|
-
end
|
97
|
-
|
98
|
-
context 'with a file name that has mixed ignored characters' do
|
99
|
-
let(:model_file_path) { '_namewith lotsOf-stuff.feature' }
|
100
|
-
let(:model_feature_name) { 'namewithlotsofstuff' }
|
101
|
-
|
102
|
-
it_should_behave_like 'a linter linting a good model'
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'with a feature name that has mixed ignored characters' do
|
106
|
-
let(:model_file_path) { 'namewithlotsofstuff.feature' }
|
107
|
-
let(:model_feature_name) { '_namewith lotsOf-stuff' }
|
108
|
-
|
109
|
-
it_should_behave_like 'a linter linting a good model'
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
context 'a non-feature-file model' do
|
115
|
-
|
116
|
-
let(:test_model) { CukeModeler::Model.new }
|
117
|
-
|
118
|
-
it_should_behave_like 'a linter linting a good model'
|
119
|
-
|
120
|
-
end
|
121
|
-
|
122
|
-
end
|
123
|
-
|
124
|
-
end
|
data/testing/rspec/spec/unit/linters/feature_with_too_many_different_tags_linter_unit_spec.rb
DELETED
@@ -1,293 +0,0 @@
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
2
|
-
|
3
|
-
|
4
|
-
RSpec.describe CukeLinter::FeatureWithTooManyDifferentTagsLinter 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('FeatureWithTooManyDifferentTagsLinter')
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'linting' do
|
17
|
-
|
18
|
-
context 'with a feature that contains too many different tags' do
|
19
|
-
|
20
|
-
let(:test_model) do
|
21
|
-
model = CukeLinter::ModelFactory.generate_feature_model(parent_file_path: model_file_path)
|
22
|
-
model.tags = [CukeModeler::Tag.new('@1'),
|
23
|
-
CukeModeler::Tag.new('@2'),
|
24
|
-
CukeModeler::Tag.new('@3'),
|
25
|
-
CukeModeler::Tag.new('@4'),
|
26
|
-
CukeModeler::Tag.new('@5'),
|
27
|
-
CukeModeler::Tag.new('@6'),
|
28
|
-
CukeModeler::Tag.new('@7'),
|
29
|
-
CukeModeler::Tag.new('@8'),
|
30
|
-
CukeModeler::Tag.new('@9'),
|
31
|
-
CukeModeler::Tag.new('@10'),
|
32
|
-
CukeModeler::Tag.new('@11')]
|
33
|
-
|
34
|
-
model
|
35
|
-
end
|
36
|
-
|
37
|
-
it_should_behave_like 'a linter linting a bad model'
|
38
|
-
|
39
|
-
|
40
|
-
it 'records a problem' do
|
41
|
-
result = subject.lint(test_model)
|
42
|
-
|
43
|
-
expect(result[:problem]).to match(/^Feature contains too many different tags. \d+ tags found \(max 10\)\.$/)
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'includes the number of different tags found in the problem record' do
|
47
|
-
unique_tag_count = test_model.tags.count
|
48
|
-
result = subject.lint(test_model)
|
49
|
-
expect(result[:problem]).to eq("Feature contains too many different tags. #{unique_tag_count} tags found (max 10).")
|
50
|
-
|
51
|
-
test_model.tags << CukeModeler::Tag.new('@had_better_be_unique')
|
52
|
-
result = subject.lint(test_model)
|
53
|
-
expect(result[:problem]).to eq("Feature contains too many different tags. #{unique_tag_count + 1} tags found (max 10).")
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'only counts unique tags' do
|
57
|
-
model = CukeLinter::ModelFactory.generate_feature_model
|
58
|
-
model.tags = []
|
59
|
-
100.times { model.tags << CukeModeler::Tag.new('@A') }
|
60
|
-
|
61
|
-
result = subject.lint(model)
|
62
|
-
|
63
|
-
expect(result).to eq(nil)
|
64
|
-
end
|
65
|
-
|
66
|
-
context 'with child models' do
|
67
|
-
|
68
|
-
let(:test_model) do
|
69
|
-
model = CukeLinter::ModelFactory.generate_feature_model
|
70
|
-
model.tags = [CukeModeler::Tag.new('@1'),
|
71
|
-
CukeModeler::Tag.new('@2'),
|
72
|
-
CukeModeler::Tag.new('@3'),
|
73
|
-
CukeModeler::Tag.new('@4'),
|
74
|
-
CukeModeler::Tag.new('@5'),
|
75
|
-
CukeModeler::Tag.new('@6'),
|
76
|
-
CukeModeler::Tag.new('@7'),
|
77
|
-
CukeModeler::Tag.new('@8'),
|
78
|
-
CukeModeler::Tag.new('@9'),
|
79
|
-
CukeModeler::Tag.new('@10'),
|
80
|
-
CukeModeler::Tag.new('@11')]
|
81
|
-
|
82
|
-
# Not all model types are a test but the models dont care and it's good enough for the test
|
83
|
-
model.tests = [child_model]
|
84
|
-
|
85
|
-
model
|
86
|
-
end
|
87
|
-
|
88
|
-
# Descriptive variable name, just in case what kinds of elements are taggable ever changes
|
89
|
-
taggable_elements = ['feature', 'scenario', 'outline', 'example']
|
90
|
-
|
91
|
-
taggable_elements.each do |model_type|
|
92
|
-
|
93
|
-
context 'that have tags' do
|
94
|
-
|
95
|
-
let(:child_model) do
|
96
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
97
|
-
model.tags = [CukeModeler::Tag.new('@12'),
|
98
|
-
CukeModeler::Tag.new('@13'),
|
99
|
-
CukeModeler::Tag.new('@14')]
|
100
|
-
|
101
|
-
model
|
102
|
-
end
|
103
|
-
|
104
|
-
it "considers tags from a #{model_type}" do
|
105
|
-
result = subject.lint(test_model)
|
106
|
-
expect(result[:problem]).to eq('Feature contains too many different tags. 14 tags found (max 10).')
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
context 'that do not have tags' do
|
112
|
-
|
113
|
-
context 'because their tags are empty' do
|
114
|
-
|
115
|
-
let(:child_model) do
|
116
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
117
|
-
model.tags = []
|
118
|
-
|
119
|
-
model
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'can handle the child model without problem' do
|
123
|
-
expect { subject.lint(test_model) }.to_not raise_error
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
133
|
-
|
134
|
-
end
|
135
|
-
|
136
|
-
|
137
|
-
context 'with a feature that does not contain too many different tags' do
|
138
|
-
|
139
|
-
context 'because it contains 10 different tags' do
|
140
|
-
|
141
|
-
let(:test_model) do
|
142
|
-
model = CukeLinter::ModelFactory.generate_feature_model
|
143
|
-
model.tags = [CukeModeler::Tag.new('@1'),
|
144
|
-
CukeModeler::Tag.new('@2'),
|
145
|
-
CukeModeler::Tag.new('@3'),
|
146
|
-
CukeModeler::Tag.new('@4'),
|
147
|
-
CukeModeler::Tag.new('@5'),
|
148
|
-
CukeModeler::Tag.new('@6'),
|
149
|
-
CukeModeler::Tag.new('@7'),
|
150
|
-
CukeModeler::Tag.new('@8'),
|
151
|
-
CukeModeler::Tag.new('@9'),
|
152
|
-
CukeModeler::Tag.new('@10')]
|
153
|
-
|
154
|
-
model
|
155
|
-
end
|
156
|
-
|
157
|
-
it_should_behave_like 'a linter linting a good model'
|
158
|
-
|
159
|
-
end
|
160
|
-
|
161
|
-
context 'because it contains fewer than 10 different tags' do
|
162
|
-
|
163
|
-
let(:test_model) do
|
164
|
-
model = CukeLinter::ModelFactory.generate_feature_model
|
165
|
-
model.tags = [CukeModeler::Tag.new('@1')]
|
166
|
-
|
167
|
-
model
|
168
|
-
end
|
169
|
-
|
170
|
-
it_should_behave_like 'a linter linting a good model'
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
context 'because it contains no tags' do
|
175
|
-
|
176
|
-
context 'because its tags are empty' do
|
177
|
-
|
178
|
-
let(:test_model) do
|
179
|
-
model = CukeLinter::ModelFactory.generate_feature_model
|
180
|
-
model.tags = []
|
181
|
-
|
182
|
-
model
|
183
|
-
end
|
184
|
-
|
185
|
-
it_should_behave_like 'a linter linting a good model'
|
186
|
-
|
187
|
-
end
|
188
|
-
|
189
|
-
context 'because its tags are nil' do
|
190
|
-
|
191
|
-
# NOTE: Not handling the case of the model's tags being nil because the model methods used in the
|
192
|
-
# linter's implementation will themselves not work when the tags are nil.
|
193
|
-
|
194
|
-
end
|
195
|
-
|
196
|
-
end
|
197
|
-
|
198
|
-
end
|
199
|
-
|
200
|
-
|
201
|
-
describe 'configuration' do
|
202
|
-
|
203
|
-
let(:default_tag_threshold) { 10 }
|
204
|
-
|
205
|
-
|
206
|
-
describe 'tag threshold configuration' do
|
207
|
-
|
208
|
-
context 'with no configuration' do
|
209
|
-
|
210
|
-
context 'because configuration never happened' do
|
211
|
-
|
212
|
-
let(:unconfigured_test_model) do
|
213
|
-
model = CukeLinter::ModelFactory.generate_feature_model
|
214
|
-
model.tags = []
|
215
|
-
(default_tag_threshold + 1).times { |count| model.tags << CukeModeler::Tag.new("@#{count}") }
|
216
|
-
|
217
|
-
model
|
218
|
-
end
|
219
|
-
|
220
|
-
it 'defaults to a tag threshold of 10 tags' do
|
221
|
-
result = subject.lint(unconfigured_test_model)
|
222
|
-
|
223
|
-
expect(result[:problem]).to eq("Feature contains too many different tags. #{unconfigured_test_model.tags.count} tags found (max 10).")
|
224
|
-
end
|
225
|
-
|
226
|
-
end
|
227
|
-
|
228
|
-
context 'because configuration did not set a tag threshold' do
|
229
|
-
|
230
|
-
let(:configuration) { {} }
|
231
|
-
let(:test_model) do
|
232
|
-
model = CukeLinter::ModelFactory.generate_feature_model
|
233
|
-
model.tags = []
|
234
|
-
(default_tag_threshold + 1).times { |count| model.tags << CukeModeler::Tag.new("@#{count}") }
|
235
|
-
|
236
|
-
model
|
237
|
-
end
|
238
|
-
|
239
|
-
before(:each) do
|
240
|
-
subject.configure(configuration)
|
241
|
-
end
|
242
|
-
|
243
|
-
it 'defaults to a tag threshold of 10 tags' do
|
244
|
-
result = subject.lint(test_model)
|
245
|
-
|
246
|
-
expect(result[:problem]).to eq("Feature contains too many different tags. #{test_model.tags.count} tags found (max 10).")
|
247
|
-
end
|
248
|
-
|
249
|
-
end
|
250
|
-
|
251
|
-
end
|
252
|
-
|
253
|
-
context 'with configuration' do
|
254
|
-
|
255
|
-
let(:tag_threshold) { 3 }
|
256
|
-
let(:configuration) { { 'TagCountThreshold' => tag_threshold } }
|
257
|
-
|
258
|
-
before(:each) do
|
259
|
-
subject.configure(configuration)
|
260
|
-
end
|
261
|
-
|
262
|
-
let(:test_model) do
|
263
|
-
model = CukeLinter::ModelFactory.generate_feature_model
|
264
|
-
model.tags = []
|
265
|
-
(tag_threshold + 1).times { |count| model.tags << CukeModeler::Tag.new("@#{count}") }
|
266
|
-
|
267
|
-
model
|
268
|
-
end
|
269
|
-
|
270
|
-
it 'the tag threshold used is the configured value' do
|
271
|
-
result = subject.lint(test_model)
|
272
|
-
|
273
|
-
expect(result[:problem]).to eq("Feature contains too many different tags. #{test_model.tags.count} tags found (max #{tag_threshold}).")
|
274
|
-
end
|
275
|
-
|
276
|
-
end
|
277
|
-
|
278
|
-
end
|
279
|
-
|
280
|
-
end
|
281
|
-
|
282
|
-
|
283
|
-
context 'a non-feature model' do
|
284
|
-
|
285
|
-
let(:test_model) { CukeModeler::Model.new }
|
286
|
-
|
287
|
-
it_should_behave_like 'a linter linting a good model'
|
288
|
-
|
289
|
-
end
|
290
|
-
|
291
|
-
end
|
292
|
-
|
293
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
2
|
-
|
3
|
-
|
4
|
-
RSpec.describe CukeLinter::FeatureWithoutDescriptionLinter 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('FeatureWithoutDescriptionLinter')
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'linting' do
|
16
|
-
|
17
|
-
context 'a feature with no description' do
|
18
|
-
|
19
|
-
context 'because the description is empty' do
|
20
|
-
|
21
|
-
let(:test_model) do
|
22
|
-
model = CukeLinter::ModelFactory.generate_feature_model(parent_file_path: model_file_path)
|
23
|
-
model.description = ''
|
24
|
-
|
25
|
-
model
|
26
|
-
end
|
27
|
-
|
28
|
-
it_should_behave_like 'a linter linting a bad model'
|
29
|
-
|
30
|
-
|
31
|
-
it 'records a problem' do
|
32
|
-
result = subject.lint(test_model)
|
33
|
-
|
34
|
-
expect(result[:problem]).to eq('Feature has no description')
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'because the description is nil' do
|
40
|
-
|
41
|
-
let(:test_model) do
|
42
|
-
model = CukeLinter::ModelFactory.generate_feature_model(parent_file_path: model_file_path)
|
43
|
-
model.description = nil
|
44
|
-
|
45
|
-
model
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'records a problem' do
|
49
|
-
result = subject.lint(test_model)
|
50
|
-
|
51
|
-
expect(result[:problem]).to eq('Feature has no description')
|
52
|
-
end
|
53
|
-
|
54
|
-
it_should_behave_like 'a linter linting a bad model'
|
55
|
-
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'a feature with a description' do
|
60
|
-
|
61
|
-
let(:test_model) do
|
62
|
-
model_source = "Feature:\n This feature has a description"
|
63
|
-
CukeLinter::ModelFactory.generate_feature_model(source_text: model_source,
|
64
|
-
parent_file_path: 'path_to_file')
|
65
|
-
end
|
66
|
-
|
67
|
-
it_should_behave_like 'a linter linting a good model'
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'a non-feature model' do
|
72
|
-
|
73
|
-
let(:test_model) { CukeModeler::Model.new }
|
74
|
-
|
75
|
-
it_should_behave_like 'a linter linting a good model'
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
end
|