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.
- 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
data/testing/rspec/spec/unit/linters/test_with_action_step_as_final_step_linter_unit_spec.rb
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
RSpec.describe CukeLinter::TestWithActionStepAsFinalStepLinter 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('TestWithActionStepAsFinalStepLinter')
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe 'linting' do
|
|
17
|
-
|
|
18
|
-
['scenario', 'outline'].each do |model_type|
|
|
19
|
-
|
|
20
|
-
context "with a #{model_type} that has an action step as its final step" do
|
|
21
|
-
|
|
22
|
-
let(:test_model) do
|
|
23
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
|
24
|
-
model.steps = [CukeModeler::Step.new('Given a step'),
|
|
25
|
-
CukeModeler::Step.new('When a step')]
|
|
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 has 'When' as the final step.")
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
context "with a #{model_type} that does not have an action step as its final step" do
|
|
42
|
-
|
|
43
|
-
context 'because it has no steps' do
|
|
44
|
-
|
|
45
|
-
context 'because its steps are empty' do
|
|
46
|
-
|
|
47
|
-
let(:test_model) do
|
|
48
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
|
49
|
-
model.steps = []
|
|
50
|
-
|
|
51
|
-
model
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
it_should_behave_like 'a linter linting a good model'
|
|
55
|
-
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
context 'because its steps are nil' do
|
|
59
|
-
|
|
60
|
-
let(:test_model) do
|
|
61
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
|
62
|
-
model.steps = nil
|
|
63
|
-
|
|
64
|
-
model
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it_should_behave_like 'a linter linting a good model'
|
|
68
|
-
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
context 'because its final step is not an action step' do
|
|
74
|
-
|
|
75
|
-
let(:test_model) do
|
|
76
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
|
77
|
-
model.steps = [CukeModeler::Step.new('Then a step')]
|
|
78
|
-
|
|
79
|
-
model
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it_should_behave_like 'a linter linting a good model'
|
|
83
|
-
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
describe 'configuration' do
|
|
91
|
-
|
|
92
|
-
let(:test_model) do
|
|
93
|
-
CukeLinter::ModelFactory.generate_scenario_model(source_text: 'Scenario:
|
|
94
|
-
* a step')
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
context 'with configuration' do
|
|
98
|
-
|
|
99
|
-
before(:each) do
|
|
100
|
-
subject.configure(configuration)
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
context "with a configured 'When' keyword" do
|
|
104
|
-
|
|
105
|
-
let(:when_keyword) { 'Foo' }
|
|
106
|
-
let(:configuration) { { 'When' => when_keyword } }
|
|
107
|
-
|
|
108
|
-
it "uses the configured 'When' keyword" do
|
|
109
|
-
test_model.steps.last.keyword = when_keyword
|
|
110
|
-
|
|
111
|
-
result = subject.lint(test_model)
|
|
112
|
-
|
|
113
|
-
expect(result).to_not be_nil
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
context 'without configuration' do
|
|
121
|
-
|
|
122
|
-
context 'because configuration never happened' do
|
|
123
|
-
|
|
124
|
-
it "uses the default 'When' keyword" do
|
|
125
|
-
test_model.steps.last.keyword = CukeLinter::DEFAULT_WHEN_KEYWORD
|
|
126
|
-
|
|
127
|
-
result = subject.lint(test_model)
|
|
128
|
-
|
|
129
|
-
expect(result).to_not be_nil
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
context "because configuration did not set a 'When' keyword" do
|
|
135
|
-
|
|
136
|
-
before(:each) do
|
|
137
|
-
subject.configure(configuration)
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
let(:configuration) { {} }
|
|
141
|
-
|
|
142
|
-
it "uses the default 'When' keyword" do
|
|
143
|
-
test_model.steps.last.keyword = CukeLinter::DEFAULT_WHEN_KEYWORD
|
|
144
|
-
|
|
145
|
-
result = subject.lint(test_model)
|
|
146
|
-
|
|
147
|
-
expect(result).to_not be_nil
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
context 'a non-test model' do
|
|
158
|
-
|
|
159
|
-
let(:test_model) { CukeModeler::Model.new }
|
|
160
|
-
|
|
161
|
-
it_should_behave_like 'a linter linting a good model'
|
|
162
|
-
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
RSpec.describe CukeLinter::TestWithBadNameLinter 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('TestWithBadNameLinter')
|
|
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 bad name" do
|
|
20
|
-
|
|
21
|
-
context 'because its name contains a bad word' do
|
|
22
|
-
|
|
23
|
-
['test', 'check', 'verify'].each do |bad_word|
|
|
24
|
-
|
|
25
|
-
let(:test_model) do
|
|
26
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
|
27
|
-
model.name = "#{bad_word} bad names are reported"
|
|
28
|
-
|
|
29
|
-
model
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it_should_behave_like 'a linter linting a bad model'
|
|
33
|
-
|
|
34
|
-
it 'records a problem' do
|
|
35
|
-
result = subject.lint(test_model)
|
|
36
|
-
|
|
37
|
-
expect(result[:problem]).to eq('"Test", "Verify" and "Check" should not be used in scenario names.')
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
context 'because bad words are case insensitive' do
|
|
43
|
-
|
|
44
|
-
['Test', 'TEST'].each do |bad_word|
|
|
45
|
-
|
|
46
|
-
let(:test_model) do
|
|
47
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
|
48
|
-
model.name = "#{bad_word} bad names are reported"
|
|
49
|
-
|
|
50
|
-
model
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it_should_behave_like 'a linter linting a bad model'
|
|
54
|
-
|
|
55
|
-
it 'records a problem' do
|
|
56
|
-
result = subject.lint(test_model)
|
|
57
|
-
|
|
58
|
-
expect(result[:problem]).to eq('"Test", "Verify" and "Check" should not be used in scenario names.')
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
context 'a non-test model' do
|
|
68
|
-
|
|
69
|
-
let(:test_model) { CukeModeler::Model.new }
|
|
70
|
-
|
|
71
|
-
it_should_behave_like 'a linter linting a good model'
|
|
72
|
-
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
end
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
RSpec.describe CukeLinter::TestWithNoActionStepLinter 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('TestWithNoActionStepLinter')
|
|
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 action 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 'records a problem' do
|
|
34
|
-
result = subject.lint(test_model)
|
|
35
|
-
|
|
36
|
-
expect(result[:problem]).to eq("Test does not have a 'When' step.")
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it_should_behave_like 'a linter linting a bad model'
|
|
40
|
-
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context 'because its steps are nil' do
|
|
44
|
-
|
|
45
|
-
let(:test_model) do
|
|
46
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
|
47
|
-
model.steps = nil
|
|
48
|
-
|
|
49
|
-
model
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'records a problem' do
|
|
53
|
-
result = subject.lint(test_model)
|
|
54
|
-
|
|
55
|
-
expect(result[:problem]).to eq("Test does not have a 'When' step.")
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it_should_behave_like 'a linter linting a bad model'
|
|
59
|
-
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
context 'because none of its steps is an action step' do
|
|
65
|
-
|
|
66
|
-
let(:test_model) do
|
|
67
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model", parent_file_path: model_file_path)
|
|
68
|
-
model.steps = [CukeModeler::Step.new('* not an action step')]
|
|
69
|
-
|
|
70
|
-
model
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it 'records a problem' do
|
|
74
|
-
result = subject.lint(test_model)
|
|
75
|
-
|
|
76
|
-
expect(result[:problem]).to eq("Test does not have a 'When' step.")
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
it_should_behave_like 'a linter linting a bad model'
|
|
80
|
-
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
context "with a #{model_type} that does have an action step" do
|
|
86
|
-
|
|
87
|
-
context 'that comes from its background' do
|
|
88
|
-
|
|
89
|
-
let(:test_model) do
|
|
90
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
|
91
|
-
model.steps = []
|
|
92
|
-
background_model = CukeModeler::Background.new
|
|
93
|
-
background_model.steps = [CukeModeler::Step.new('When an action step')]
|
|
94
|
-
model.parent_model.background = background_model
|
|
95
|
-
|
|
96
|
-
model
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
it_should_behave_like 'a linter linting a good model'
|
|
100
|
-
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
context 'that is part of itself' do
|
|
104
|
-
|
|
105
|
-
let(:test_model) do
|
|
106
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
|
107
|
-
model.steps = [CukeModeler::Step.new('When an action step')]
|
|
108
|
-
|
|
109
|
-
model
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
it_should_behave_like 'a linter linting a good model'
|
|
113
|
-
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
['scenario', 'outline'].each do |model_type|
|
|
121
|
-
|
|
122
|
-
context "with a #{model_type} that has a related background" do
|
|
123
|
-
|
|
124
|
-
let(:test_model) do
|
|
125
|
-
model = CukeLinter::ModelFactory.send("generate_#{model_type}_model")
|
|
126
|
-
model.parent_model.background = background_model
|
|
127
|
-
|
|
128
|
-
model
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
context 'that has no background steps' do
|
|
132
|
-
context 'because its steps are empty' do
|
|
133
|
-
|
|
134
|
-
let(:background_model) do
|
|
135
|
-
model = CukeModeler::Background.new
|
|
136
|
-
model.steps = []
|
|
137
|
-
|
|
138
|
-
model
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
it 'can handle it' do
|
|
142
|
-
expect { subject.lint(test_model) }.to_not raise_error
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
context 'because its steps are nil' do
|
|
148
|
-
|
|
149
|
-
let(:background_model) do
|
|
150
|
-
model = CukeModeler::Background.new
|
|
151
|
-
model.steps = nil
|
|
152
|
-
|
|
153
|
-
model
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
it 'can handle it' do
|
|
157
|
-
expect { subject.lint(test_model) }.to_not raise_error
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
describe 'configuration' do
|
|
170
|
-
|
|
171
|
-
let(:test_model) do
|
|
172
|
-
CukeLinter::ModelFactory.generate_scenario_model(source_text: 'Scenario:
|
|
173
|
-
When a step')
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
context 'with configuration' do
|
|
177
|
-
|
|
178
|
-
before(:each) do
|
|
179
|
-
subject.configure(configuration)
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
context "with a configured 'When' keyword" do
|
|
183
|
-
|
|
184
|
-
let(:when_keyword) { 'Foo' }
|
|
185
|
-
let(:configuration) { { 'When' => when_keyword } }
|
|
186
|
-
|
|
187
|
-
it "uses the configured 'When' keyword" do
|
|
188
|
-
test_model.steps.first.keyword = 'When'
|
|
189
|
-
|
|
190
|
-
result = subject.lint(test_model)
|
|
191
|
-
|
|
192
|
-
expect(result).to_not be_nil
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
context 'without configuration' do
|
|
200
|
-
|
|
201
|
-
context 'because configuration never happened' do
|
|
202
|
-
|
|
203
|
-
it "uses the default 'When' keyword" do
|
|
204
|
-
test_model.steps.first.keyword = CukeLinter::DEFAULT_WHEN_KEYWORD
|
|
205
|
-
|
|
206
|
-
result = subject.lint(test_model)
|
|
207
|
-
|
|
208
|
-
expect(result).to be_nil
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
context "because configuration did not set a 'When' keyword" do
|
|
214
|
-
|
|
215
|
-
before(:each) do
|
|
216
|
-
subject.configure(configuration)
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
let(:configuration) { {} }
|
|
220
|
-
|
|
221
|
-
it "uses the default 'When' keyword" do
|
|
222
|
-
test_model.steps.last.keyword = CukeLinter::DEFAULT_WHEN_KEYWORD
|
|
223
|
-
|
|
224
|
-
result = subject.lint(test_model)
|
|
225
|
-
|
|
226
|
-
expect(result).to be_nil
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
context 'a non-test model' do
|
|
237
|
-
|
|
238
|
-
let(:test_model) { CukeModeler::Model.new }
|
|
239
|
-
|
|
240
|
-
it_should_behave_like 'a linter linting a good model'
|
|
241
|
-
|
|
242
|
-
end
|
|
243
|
-
end
|
|
244
|
-
end
|