cuke_linter 0.13.0 → 1.0.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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -1
  3. data/README.md +4 -4
  4. data/cuke_linter.gemspec +3 -3
  5. data/lib/cuke_linter.rb +5 -3
  6. data/lib/cuke_linter/version.rb +1 -1
  7. metadata +2 -86
  8. data/.gitignore +0 -19
  9. data/.simplecov +0 -8
  10. data/.travis.yml +0 -33
  11. data/CONTRIBUTING.md +0 -26
  12. data/Gemfile +0 -6
  13. data/Rakefile +0 -63
  14. data/appveyor.yml +0 -43
  15. data/bin/console +0 -14
  16. data/bin/setup +0 -8
  17. data/environments/common_env.rb +0 -12
  18. data/environments/cucumber_env.rb +0 -22
  19. data/environments/rspec_env.rb +0 -50
  20. data/testing/cucumber/step_definitions/action_steps.rb +0 -84
  21. data/testing/cucumber/step_definitions/setup_steps.rb +0 -258
  22. data/testing/cucumber/step_definitions/verification_steps.rb +0 -94
  23. data/testing/file_helper.rb +0 -41
  24. data/testing/formatter_factory.rb +0 -15
  25. data/testing/gemfiles/cuke_modeler1.gemfile +0 -8
  26. data/testing/gemfiles/cuke_modeler2.gemfile +0 -8
  27. data/testing/linter_factory.rb +0 -60
  28. data/testing/model_factory.rb +0 -109
  29. data/testing/rspec/spec/integration/cli_integration_spec.rb +0 -556
  30. data/testing/rspec/spec/integration/configuration_spec.rb +0 -811
  31. data/testing/rspec/spec/integration/cuke_linter_integration_spec.rb +0 -243
  32. data/testing/rspec/spec/integration/formatters/formatter_integration_specs.rb +0 -5
  33. data/testing/rspec/spec/integration/formatters/pretty_formatter_integration_spec.rb +0 -8
  34. data/testing/rspec/spec/integration/linters/background_does_more_than_setup_linter_integration_spec.rb +0 -8
  35. data/testing/rspec/spec/integration/linters/element_with_common_tags_linter_integration_spec.rb +0 -8
  36. data/testing/rspec/spec/integration/linters/element_with_duplicate_tags_linter_integration_spec.rb +0 -8
  37. data/testing/rspec/spec/integration/linters/element_with_too_many_tags_linter_integration_spec.rb +0 -8
  38. data/testing/rspec/spec/integration/linters/example_without_name_linter_integration_spec.rb +0 -8
  39. data/testing/rspec/spec/integration/linters/feature_file_with_invalid_name_integration_spec.rb +0 -8
  40. data/testing/rspec/spec/integration/linters/feature_file_with_mismatched_name_integration_spec.rb +0 -8
  41. data/testing/rspec/spec/integration/linters/feature_with_too_many_different_tags_linter_integration_spec.rb +0 -8
  42. data/testing/rspec/spec/integration/linters/feature_without_description_linter_integration_spec.rb +0 -8
  43. data/testing/rspec/spec/integration/linters/feature_without_name_linter_integration_spec.rb +0 -8
  44. data/testing/rspec/spec/integration/linters/feature_without_scenarios_linter_integration_spec.rb +0 -8
  45. data/testing/rspec/spec/integration/linters/linter_integration_spec.rb +0 -8
  46. data/testing/rspec/spec/integration/linters/linter_integration_specs.rb +0 -7
  47. data/testing/rspec/spec/integration/linters/outline_with_single_example_row_linter_integration_spec.rb +0 -8
  48. data/testing/rspec/spec/integration/linters/single_test_background_linter_integration_spec.rb +0 -8
  49. data/testing/rspec/spec/integration/linters/step_with_end_period_linter_integration_spec.rb +0 -8
  50. data/testing/rspec/spec/integration/linters/step_with_too_many_characters_linter_integration_spec.rb +0 -8
  51. data/testing/rspec/spec/integration/linters/test_should_use_background_linter_integration_spec.rb +0 -8
  52. data/testing/rspec/spec/integration/linters/test_with_action_step_as_final_step_linter_integration_spec.rb +0 -8
  53. data/testing/rspec/spec/integration/linters/test_with_bad_name_integration_spec.rb +0 -8
  54. data/testing/rspec/spec/integration/linters/test_with_no_action_step_integration_spec.rb +0 -8
  55. data/testing/rspec/spec/integration/linters/test_with_no_name_integration_spec.rb +0 -8
  56. data/testing/rspec/spec/integration/linters/test_with_no_verification_step_integration_spec.rb +0 -8
  57. data/testing/rspec/spec/integration/linters/test_with_setup_step_after_action_step_linter_integration_spec.rb +0 -8
  58. data/testing/rspec/spec/integration/linters/test_with_setup_step_after_verification_step_linter_integration_spec.rb +0 -8
  59. data/testing/rspec/spec/integration/linters/test_with_setup_step_as_final_step_linter_integration_spec.rb +0 -8
  60. data/testing/rspec/spec/integration/linters/test_with_too_many_steps_linter_integration_spec.rb +0 -8
  61. data/testing/rspec/spec/unit/cuke_linter_unit_spec.rb +0 -114
  62. data/testing/rspec/spec/unit/formatters/formatter_unit_specs.rb +0 -11
  63. data/testing/rspec/spec/unit/formatters/pretty_formatter_unit_spec.rb +0 -115
  64. data/testing/rspec/spec/unit/linters/background_does_more_than_setup_linter_unit_spec.rb +0 -186
  65. data/testing/rspec/spec/unit/linters/configurable_linter_unit_specs.rb +0 -11
  66. data/testing/rspec/spec/unit/linters/element_with_common_tags_linter_unit_spec.rb +0 -248
  67. data/testing/rspec/spec/unit/linters/element_with_duplicate_tags_linter_unit_spec.rb +0 -203
  68. data/testing/rspec/spec/unit/linters/element_with_too_many_tags_linter_unit_spec.rb +0 -296
  69. data/testing/rspec/spec/unit/linters/example_without_name_linter_unit_spec.rb +0 -81
  70. data/testing/rspec/spec/unit/linters/feature_file_with_invalid_name_linter_unit_spec.rb +0 -106
  71. data/testing/rspec/spec/unit/linters/feature_file_with_mismatched_name_linter_unit_spec.rb +0 -124
  72. data/testing/rspec/spec/unit/linters/feature_with_too_many_different_tags_linter_unit_spec.rb +0 -293
  73. data/testing/rspec/spec/unit/linters/feature_without_description_linter_unit_spec.rb +0 -80
  74. data/testing/rspec/spec/unit/linters/feature_without_name_linter_unit_spec.rb +0 -84
  75. data/testing/rspec/spec/unit/linters/feature_without_scenarios_linter_unit_spec.rb +0 -102
  76. data/testing/rspec/spec/unit/linters/linter_unit_spec.rb +0 -197
  77. data/testing/rspec/spec/unit/linters/linter_unit_specs.rb +0 -57
  78. data/testing/rspec/spec/unit/linters/outline_with_single_example_row_linter_unit_spec.rb +0 -184
  79. data/testing/rspec/spec/unit/linters/single_test_background_linter_unit_spec.rb +0 -89
  80. data/testing/rspec/spec/unit/linters/step_with_end_period_linter_unit_spec.rb +0 -54
  81. data/testing/rspec/spec/unit/linters/step_with_too_many_characters_linter_unit_spec.rb +0 -155
  82. data/testing/rspec/spec/unit/linters/test_should_use_background_linter_unit_spec.rb +0 -464
  83. data/testing/rspec/spec/unit/linters/test_with_action_step_as_final_step_linter_unit_spec.rb +0 -165
  84. data/testing/rspec/spec/unit/linters/test_with_bad_name_linter_unit_spec.rb +0 -81
  85. data/testing/rspec/spec/unit/linters/test_with_no_action_step_linter_unit_spec.rb +0 -244
  86. data/testing/rspec/spec/unit/linters/test_with_no_name_linter_unit_spec.rb +0 -88
  87. data/testing/rspec/spec/unit/linters/test_with_no_verification_step_linter_unit_spec.rb +0 -246
  88. data/testing/rspec/spec/unit/linters/test_with_setup_step_after_action_step_linter_unit_spec.rb +0 -233
  89. data/testing/rspec/spec/unit/linters/test_with_setup_step_after_verification_step_linter_unit_spec.rb +0 -233
  90. data/testing/rspec/spec/unit/linters/test_with_setup_step_as_final_step_linter_unit_spec.rb +0 -164
  91. 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
@@ -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