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
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
require_relative '../../../../environments/rspec_env'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
RSpec.describe 'the gem' do
|
|
5
|
-
|
|
6
|
-
let(:gemspec) { eval(File.read "#{__dir__}/../../../../cuke_linter.gemspec") }
|
|
7
|
-
|
|
8
|
-
it 'has an executable' do
|
|
9
|
-
expect(gemspec.executables).to include('cuke_linter')
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it 'validates cleanly' do
|
|
13
|
-
mock_ui = Gem::MockGemUi.new
|
|
14
|
-
Gem::DefaultUserInteraction.use_ui(mock_ui) { gemspec.validate }
|
|
15
|
-
|
|
16
|
-
expect(mock_ui.error).to_not match(/warn/i)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
RSpec.describe CukeLinter do
|
|
23
|
-
|
|
24
|
-
it "has a version number" do
|
|
25
|
-
expect(CukeLinter::VERSION).not_to be nil
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "has a default keyword for 'Given'" do
|
|
29
|
-
expect(CukeLinter::DEFAULT_GIVEN_KEYWORD).to eq('Given')
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "has a default keyword for 'When'" do
|
|
33
|
-
expect(CukeLinter::DEFAULT_WHEN_KEYWORD).to eq('When')
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "has a default keyword for 'Then'" do
|
|
37
|
-
expect(CukeLinter::DEFAULT_THEN_KEYWORD).to eq('Then')
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'can lint' do
|
|
41
|
-
expect(CukeLinter).to respond_to(:lint)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it 'lints the (optionally) given model trees and (optionally) file paths using the (optionally) provided set of linters and formats the output with the (optionally) provided formatters' do
|
|
45
|
-
expect(CukeLinter.method(:lint).arity).to eq(-1)
|
|
46
|
-
expect(CukeLinter.method(:lint).parameters).to match_array([[:key, :model_trees],
|
|
47
|
-
[:key, :linters],
|
|
48
|
-
[:key, :formatters],
|
|
49
|
-
[:key, :file_paths]])
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'can register a linter' do
|
|
53
|
-
expect(CukeLinter).to respond_to(:register_linter)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
it 'can unregister a linter' do
|
|
57
|
-
expect(CukeLinter).to respond_to(:unregister_linter)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
it 'registers a linter by name' do
|
|
61
|
-
expect(CukeLinter.method(:register_linter).arity).to eq(1)
|
|
62
|
-
expect(CukeLinter.method(:register_linter).parameters).to match_array([[:keyreq, :linter],
|
|
63
|
-
[:keyreq, :name]])
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it 'unregisters a linter by name' do
|
|
67
|
-
expect(CukeLinter.method(:unregister_linter).arity).to eq(1)
|
|
68
|
-
expect(CukeLinter.method(:unregister_linter).parameters).to match_array([[:req, :name]])
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
it 'knows its currently registered linters' do
|
|
72
|
-
expect(CukeLinter).to respond_to(:registered_linters)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
it 'correctly registers, unregisters, and tracks linters', :linter_registration do
|
|
76
|
-
CukeLinter.clear_registered_linters
|
|
77
|
-
CukeLinter.register_linter(name: 'foo', linter: :linter_1)
|
|
78
|
-
CukeLinter.register_linter(name: 'bar', linter: :linter_2)
|
|
79
|
-
CukeLinter.register_linter(name: 'baz', linter: :linter_3)
|
|
80
|
-
|
|
81
|
-
CukeLinter.unregister_linter('bar')
|
|
82
|
-
|
|
83
|
-
expect(CukeLinter.registered_linters).to eq({ 'foo' => :linter_1,
|
|
84
|
-
'baz' => :linter_3, })
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
it 'can clear all of its currently registered linters', :linter_registration do
|
|
88
|
-
expect(CukeLinter).to respond_to(:clear_registered_linters)
|
|
89
|
-
|
|
90
|
-
CukeLinter.register_linter(name: 'some_linter', linter: :the_linter)
|
|
91
|
-
CukeLinter.clear_registered_linters
|
|
92
|
-
|
|
93
|
-
expect(CukeLinter.registered_linters).to eq({})
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
it 'can reset to its default set of linters' do
|
|
97
|
-
expect(CukeLinter).to respond_to(:reset_linters)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
describe 'configuration' do
|
|
101
|
-
|
|
102
|
-
it 'can load a configuration' do
|
|
103
|
-
expect(CukeLinter).to respond_to(:load_configuration)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
it 'is configured optionally via a file or a directly provided configuration' do
|
|
107
|
-
expect(CukeLinter.method(:load_configuration).arity).to eq(-1)
|
|
108
|
-
expect(CukeLinter.method(:load_configuration).parameters).to match_array([[:key, :config_file_path],
|
|
109
|
-
[:key, :config]])
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
end
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
RSpec.describe CukeLinter::PrettyFormatter do
|
|
5
|
-
|
|
6
|
-
it_should_behave_like 'a formatter at the unit level'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
it 'formats linting data as pretty text' do
|
|
10
|
-
linting_data = [{ linter: 'SomeLinter',
|
|
11
|
-
problem: 'Some problem',
|
|
12
|
-
location: 'path/to/the_file:1' },
|
|
13
|
-
{ linter: 'SomeOtherLinter',
|
|
14
|
-
problem: 'Some other problem',
|
|
15
|
-
location: 'path/to/the_file:1' },
|
|
16
|
-
{ linter: 'YetAnotherLinter',
|
|
17
|
-
problem: 'Yet another problem',
|
|
18
|
-
location: 'path/to/the_file' }]
|
|
19
|
-
|
|
20
|
-
results = subject.format(linting_data)
|
|
21
|
-
|
|
22
|
-
expect(results).to eq(['SomeLinter',
|
|
23
|
-
' Some problem',
|
|
24
|
-
' path/to/the_file:1',
|
|
25
|
-
'SomeOtherLinter',
|
|
26
|
-
' Some other problem',
|
|
27
|
-
' path/to/the_file:1',
|
|
28
|
-
'YetAnotherLinter',
|
|
29
|
-
' Yet another problem',
|
|
30
|
-
' path/to/the_file',
|
|
31
|
-
'',
|
|
32
|
-
'3 issues found'].join("\n"))
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it 'groups data by linter and problem' do
|
|
36
|
-
linting_data = [{ linter: 'SomeLinter',
|
|
37
|
-
problem: 'Some problem',
|
|
38
|
-
location: 'path/to/the_file:1' },
|
|
39
|
-
{ linter: 'SomeOtherLinter',
|
|
40
|
-
problem: 'Some other problem',
|
|
41
|
-
location: 'path/to/the_file:1' },
|
|
42
|
-
{ linter: 'SomeLinter',
|
|
43
|
-
problem: 'Some problem',
|
|
44
|
-
location: 'path/to/the_file:11' }]
|
|
45
|
-
|
|
46
|
-
results = subject.format(linting_data)
|
|
47
|
-
|
|
48
|
-
expect(results).to eq(['SomeLinter',
|
|
49
|
-
' Some problem',
|
|
50
|
-
' path/to/the_file:1',
|
|
51
|
-
' path/to/the_file:11',
|
|
52
|
-
'SomeOtherLinter',
|
|
53
|
-
' Some other problem',
|
|
54
|
-
' path/to/the_file:1',
|
|
55
|
-
'',
|
|
56
|
-
'3 issues found'].join("\n"))
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it 'orders violations within the same problem category by file path' do
|
|
60
|
-
linting_data = [{ linter: 'SomeLinter',
|
|
61
|
-
problem: 'Some problem',
|
|
62
|
-
location: 'path/to/the_file:1' },
|
|
63
|
-
{ linter: 'SomeLinter',
|
|
64
|
-
problem: 'Some problem',
|
|
65
|
-
location: 'path/to/the_file:3' },
|
|
66
|
-
{ linter: 'SomeLinter',
|
|
67
|
-
problem: 'Some problem',
|
|
68
|
-
location: 'path/to/a_different_file:2' }]
|
|
69
|
-
|
|
70
|
-
results = subject.format(linting_data)
|
|
71
|
-
|
|
72
|
-
expect(results).to eq(['SomeLinter',
|
|
73
|
-
' Some problem',
|
|
74
|
-
' path/to/a_different_file:2',
|
|
75
|
-
' path/to/the_file:1',
|
|
76
|
-
' path/to/the_file:3',
|
|
77
|
-
'',
|
|
78
|
-
'3 issues found'].join("\n"))
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
it 'orders violations in the same file by line number' do
|
|
82
|
-
linting_data = [{ linter: 'SomeLinter',
|
|
83
|
-
problem: 'Some problem',
|
|
84
|
-
location: 'path/to/the_file:2' },
|
|
85
|
-
{ linter: 'SomeLinter',
|
|
86
|
-
problem: 'Some problem',
|
|
87
|
-
location: 'path/to/the_file:3' },
|
|
88
|
-
{ linter: 'SomeLinter',
|
|
89
|
-
problem: 'Some problem',
|
|
90
|
-
location: 'path/to/the_file:11' }, # larger number that is alphabetically lower
|
|
91
|
-
{ linter: 'SomeLinter',
|
|
92
|
-
problem: 'Some problem',
|
|
93
|
-
location: 'path/to/the_file:3' }, # duplicate number
|
|
94
|
-
{ linter: 'SomeLinter',
|
|
95
|
-
problem: 'Some problem',
|
|
96
|
-
location: 'path/to/the_file' }, # no number
|
|
97
|
-
{ linter: 'SomeLinter',
|
|
98
|
-
problem: 'Some problem',
|
|
99
|
-
location: 'path/to/the_file:1' }]
|
|
100
|
-
|
|
101
|
-
results = subject.format(linting_data)
|
|
102
|
-
|
|
103
|
-
expect(results).to eq(['SomeLinter',
|
|
104
|
-
' Some problem',
|
|
105
|
-
' path/to/the_file',
|
|
106
|
-
' path/to/the_file:1',
|
|
107
|
-
' path/to/the_file:2',
|
|
108
|
-
' path/to/the_file:3',
|
|
109
|
-
' path/to/the_file:3',
|
|
110
|
-
' path/to/the_file:11',
|
|
111
|
-
'',
|
|
112
|
-
'6 issues found'].join("\n"))
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
end
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
require_relative '../../../../../environments/rspec_env'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
RSpec.describe CukeLinter::BackgroundDoesMoreThanSetupLinter 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('BackgroundDoesMoreThanSetupLinter')
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe 'linting' do
|
|
17
|
-
|
|
18
|
-
context 'a background with action steps' do
|
|
19
|
-
|
|
20
|
-
let(:test_model) do
|
|
21
|
-
CukeLinter::ModelFactory.generate_background_model(parent_file_path: model_file_path,
|
|
22
|
-
source_text: 'Background:
|
|
23
|
-
When something')
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it_should_behave_like 'a linter linting a bad model'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
it 'records a problem' do
|
|
30
|
-
result = subject.lint(test_model)
|
|
31
|
-
|
|
32
|
-
expect(result[:problem]).to eq('Background has non-setup steps')
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
context 'a background with verification steps' do
|
|
38
|
-
|
|
39
|
-
let(:test_model) do
|
|
40
|
-
CukeLinter::ModelFactory.generate_background_model(parent_file_path: model_file_path,
|
|
41
|
-
source_text: 'Background:
|
|
42
|
-
Then something')
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it_should_behave_like 'a linter linting a bad model'
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
it 'records a problem' do
|
|
49
|
-
result = subject.lint(test_model)
|
|
50
|
-
|
|
51
|
-
expect(result[:problem]).to eq('Background has non-setup steps')
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context 'a background with only setup steps' do
|
|
57
|
-
|
|
58
|
-
let(:test_model) do
|
|
59
|
-
gherkin = 'Background:
|
|
60
|
-
Given something
|
|
61
|
-
* (plus something)'
|
|
62
|
-
|
|
63
|
-
CukeLinter::ModelFactory.generate_background_model(source_text: gherkin)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it_should_behave_like 'a linter linting a good model'
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
describe 'configuration' do
|
|
72
|
-
|
|
73
|
-
let(:test_model) do
|
|
74
|
-
CukeLinter::ModelFactory.generate_background_model
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
context 'with configuration' do
|
|
78
|
-
|
|
79
|
-
before(:each) do
|
|
80
|
-
subject.configure(configuration)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
context "with a configured 'When' keyword" do
|
|
84
|
-
|
|
85
|
-
let(:when_keyword) { 'Foo' }
|
|
86
|
-
let(:configuration) { { 'When' => when_keyword } }
|
|
87
|
-
|
|
88
|
-
it "uses the configured 'When' keyword" do
|
|
89
|
-
test_model.steps.first.keyword = when_keyword
|
|
90
|
-
|
|
91
|
-
result = subject.lint(test_model)
|
|
92
|
-
|
|
93
|
-
expect(result).to_not be_nil
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
context "with a configured 'Then' keyword" do
|
|
99
|
-
|
|
100
|
-
let(:then_keyword) { 'Foo' }
|
|
101
|
-
let(:configuration) { { 'Then' => then_keyword } }
|
|
102
|
-
|
|
103
|
-
it "uses the configured 'Then' keyword" do
|
|
104
|
-
test_model.steps.first.keyword = then_keyword
|
|
105
|
-
|
|
106
|
-
result = subject.lint(test_model)
|
|
107
|
-
|
|
108
|
-
expect(result).to_not be_nil
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
context 'without configuration' do
|
|
116
|
-
|
|
117
|
-
context 'because configuration never happened' do
|
|
118
|
-
|
|
119
|
-
it "uses the default 'When' keyword" do
|
|
120
|
-
test_model.steps.first.keyword = CukeLinter::DEFAULT_WHEN_KEYWORD
|
|
121
|
-
|
|
122
|
-
result = subject.lint(test_model)
|
|
123
|
-
|
|
124
|
-
expect(result).to_not be_nil
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
it "uses the default 'Then' keyword" do
|
|
128
|
-
test_model.steps.first.keyword = CukeLinter::DEFAULT_THEN_KEYWORD
|
|
129
|
-
|
|
130
|
-
result = subject.lint(test_model)
|
|
131
|
-
|
|
132
|
-
expect(result).to_not be_nil
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
context "because configuration did not set a 'When' keyword" do
|
|
138
|
-
|
|
139
|
-
before(:each) do
|
|
140
|
-
subject.configure(configuration)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
let(:configuration) { {} }
|
|
144
|
-
|
|
145
|
-
it "uses the default 'When' keyword" do
|
|
146
|
-
test_model.steps.first.keyword = CukeLinter::DEFAULT_WHEN_KEYWORD
|
|
147
|
-
|
|
148
|
-
result = subject.lint(test_model)
|
|
149
|
-
|
|
150
|
-
expect(result).to_not be_nil
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
context "because configuration did not set a 'Then' keyword" do
|
|
156
|
-
|
|
157
|
-
before(:each) do
|
|
158
|
-
subject.configure(configuration)
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
let(:configuration) { {} }
|
|
162
|
-
|
|
163
|
-
it "uses the default 'Then' keyword" do
|
|
164
|
-
test_model.steps.first.keyword = CukeLinter::DEFAULT_THEN_KEYWORD
|
|
165
|
-
|
|
166
|
-
result = subject.lint(test_model)
|
|
167
|
-
|
|
168
|
-
expect(result).to_not be_nil
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
context 'a non-background model' do
|
|
179
|
-
|
|
180
|
-
let(:test_model) { CukeModeler::Model.new }
|
|
181
|
-
|
|
182
|
-
it_should_behave_like 'a linter linting a good model'
|
|
183
|
-
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
end
|