puppet-lint 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +74 -0
- data/.rubocop_todo.yml +89 -0
- data/.travis.yml +11 -9
- data/CHANGELOG.md +54 -0
- data/Gemfile +3 -0
- data/Rakefile +14 -3
- data/appveyor.yml +1 -4
- data/bin/puppet-lint +1 -1
- data/lib/puppet-lint.rb +25 -21
- data/lib/puppet-lint/bin.rb +15 -19
- data/lib/puppet-lint/checkplugin.rb +24 -17
- data/lib/puppet-lint/checks.rb +42 -31
- data/lib/puppet-lint/configuration.rb +11 -8
- data/lib/puppet-lint/data.rb +236 -164
- data/lib/puppet-lint/lexer.rb +225 -203
- data/lib/puppet-lint/lexer/token.rb +34 -18
- data/lib/puppet-lint/optparser.rb +33 -30
- data/lib/puppet-lint/plugins.rb +42 -38
- data/lib/puppet-lint/plugins/check_classes/arrow_on_right_operand_line.rb +26 -28
- data/lib/puppet-lint/plugins/check_classes/autoloader_layout.rb +21 -20
- data/lib/puppet-lint/plugins/check_classes/class_inherits_from_params_class.rb +8 -9
- data/lib/puppet-lint/plugins/check_classes/code_on_top_scope.rb +9 -8
- data/lib/puppet-lint/plugins/check_classes/inherits_across_namespaces.rb +12 -11
- data/lib/puppet-lint/plugins/check_classes/names_containing_dash.rb +13 -12
- data/lib/puppet-lint/plugins/check_classes/names_containing_uppercase.rb +14 -13
- data/lib/puppet-lint/plugins/check_classes/nested_classes_or_defines.rb +9 -10
- data/lib/puppet-lint/plugins/check_classes/parameter_order.rb +40 -31
- data/lib/puppet-lint/plugins/check_classes/right_to_left_relationship.rb +3 -2
- data/lib/puppet-lint/plugins/check_classes/variable_scope.rb +21 -24
- data/lib/puppet-lint/plugins/check_comments/slash_comments.rb +3 -2
- data/lib/puppet-lint/plugins/check_comments/star_comments.rb +6 -5
- data/lib/puppet-lint/plugins/check_conditionals/case_without_default.rb +21 -20
- data/lib/puppet-lint/plugins/check_conditionals/selector_inside_resource.rb +10 -13
- data/lib/puppet-lint/plugins/check_documentation/documentation.rb +26 -17
- data/lib/puppet-lint/plugins/check_nodes/unquoted_node_name.rb +11 -11
- data/lib/puppet-lint/plugins/check_resources/duplicate_params.rb +4 -3
- data/lib/puppet-lint/plugins/check_resources/ensure_first_param.rb +17 -18
- data/lib/puppet-lint/plugins/check_resources/ensure_not_symlink_target.rb +17 -16
- data/lib/puppet-lint/plugins/check_resources/file_mode.rb +22 -23
- data/lib/puppet-lint/plugins/check_resources/unquoted_file_mode.rb +14 -13
- data/lib/puppet-lint/plugins/check_resources/unquoted_resource_title.rb +9 -8
- data/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb +8 -8
- data/lib/puppet-lint/plugins/check_strings/only_variable_string.rb +29 -42
- data/lib/puppet-lint/plugins/check_strings/puppet_url_without_modules.rb +5 -4
- data/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb +3 -2
- data/lib/puppet-lint/plugins/check_strings/single_quote_string_with_variables.rb +4 -3
- data/lib/puppet-lint/plugins/check_strings/variables_not_enclosed.rb +3 -2
- data/lib/puppet-lint/plugins/check_variables/variable_contains_dash.rb +9 -8
- data/lib/puppet-lint/plugins/check_variables/variable_is_lowercase.rb +9 -8
- data/lib/puppet-lint/plugins/check_whitespace/140chars.rb +9 -9
- data/lib/puppet-lint/plugins/check_whitespace/2sp_soft_tabs.rb +4 -3
- data/lib/puppet-lint/plugins/check_whitespace/80chars.rb +10 -10
- data/lib/puppet-lint/plugins/check_whitespace/arrow_alignment.rb +23 -22
- data/lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb +3 -2
- data/lib/puppet-lint/plugins/check_whitespace/trailing_whitespace.rb +3 -2
- data/lib/puppet-lint/tasks/puppet-lint.rb +3 -3
- data/lib/puppet-lint/version.rb +1 -1
- data/puppet-lint.gemspec +4 -4
- data/spec/puppet-lint/bin_spec.rb +268 -140
- data/spec/puppet-lint/checks_spec.rb +229 -0
- data/spec/puppet-lint/configuration_spec.rb +10 -9
- data/spec/puppet-lint/data_spec.rb +84 -0
- data/spec/puppet-lint/ignore_overrides_spec.rb +71 -40
- data/spec/puppet-lint/lexer/token_spec.rb +1 -1
- data/spec/puppet-lint/lexer_spec.rb +306 -73
- data/spec/puppet-lint/plugins/check_classes/arrow_on_right_operand_line_spec.rb +12 -6
- data/spec/puppet-lint/plugins/check_classes/autoloader_layout_spec.rb +10 -10
- data/spec/puppet-lint/plugins/check_classes/class_inherits_from_params_class_spec.rb +15 -11
- data/spec/puppet-lint/plugins/check_classes/code_on_top_scope_spec.rb +26 -21
- data/spec/puppet-lint/plugins/check_classes/inherits_across_namespaces_spec.rb +3 -3
- data/spec/puppet-lint/plugins/check_classes/name_contains_uppercase_spec.rb +4 -5
- data/spec/puppet-lint/plugins/check_classes/names_containing_dash_spec.rb +13 -0
- data/spec/puppet-lint/plugins/check_classes/nested_classes_or_defines_spec.rb +33 -25
- data/spec/puppet-lint/plugins/check_classes/parameter_order_spec.rb +80 -55
- data/spec/puppet-lint/plugins/check_classes/right_to_left_relationship_spec.rb +2 -2
- data/spec/puppet-lint/plugins/check_classes/variable_scope_spec.rb +165 -130
- data/spec/puppet-lint/plugins/check_comments/slash_comments_spec.rb +2 -2
- data/spec/puppet-lint/plugins/check_comments/star_comments_spec.rb +53 -35
- data/spec/puppet-lint/plugins/check_conditionals/case_without_default_spec.rb +59 -49
- data/spec/puppet-lint/plugins/check_conditionals/selector_inside_resource_spec.rb +18 -14
- data/spec/puppet-lint/plugins/check_documentation/documentation_spec.rb +14 -10
- data/spec/puppet-lint/plugins/check_nodes/unquoted_node_name_spec.rb +7 -7
- data/spec/puppet-lint/plugins/check_resources/duplicate_params_spec.rb +54 -44
- data/spec/puppet-lint/plugins/check_resources/ensure_first_param_spec.rb +114 -89
- data/spec/puppet-lint/plugins/check_resources/ensure_not_symlink_target_spec.rb +41 -30
- data/spec/puppet-lint/plugins/check_resources/file_mode_spec.rb +46 -40
- data/spec/puppet-lint/plugins/check_resources/unquoted_file_mode_spec.rb +46 -40
- data/spec/puppet-lint/plugins/check_resources/unquoted_resource_title_spec.rb +95 -71
- data/spec/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb +28 -24
- data/spec/puppet-lint/plugins/check_strings/only_variable_string_spec.rb +11 -9
- data/spec/puppet-lint/plugins/check_strings/puppet_url_without_modules_spec.rb +1 -2
- data/spec/puppet-lint/plugins/check_strings/single_quote_string_with_variables_spec.rb +18 -14
- data/spec/puppet-lint/plugins/check_variables/variable_contains_dash_spec.rb +1 -1
- data/spec/puppet-lint/plugins/check_variables/variable_is_lowercase_spec.rb +1 -1
- data/spec/puppet-lint/plugins/check_whitespace/140chars_spec.rb +22 -15
- data/spec/puppet-lint/plugins/check_whitespace/2sp_soft_tabs_spec.rb +8 -6
- data/spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb +23 -29
- data/spec/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb +588 -494
- data/spec/puppet-lint/plugins/check_whitespace/hard_tabs_spec.rb +1 -1
- data/spec/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb +27 -19
- data/spec/puppet-lint_spec.rb +2 -12
- data/spec/spec_helper.rb +35 -30
- metadata +6 -5
- data/lib/puppet-lint/monkeypatches.rb +0 -2
- data/lib/puppet-lint/monkeypatches/string_percent.rb +0 -52
- data/lib/puppet-lint/monkeypatches/string_prepend.rb +0 -13
@@ -4,33 +4,37 @@ describe 'duplicate_params' do
|
|
4
4
|
let(:msg) { 'duplicate parameter found in resource' }
|
5
5
|
|
6
6
|
context 'resource with duplicate parameters' do
|
7
|
-
let(:code)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
let(:code) do
|
8
|
+
<<-END
|
9
|
+
file { '/tmp/foo':
|
10
|
+
ensure => present,
|
11
|
+
foo => bar,
|
12
|
+
baz => gronk,
|
13
|
+
foo => meh,
|
14
|
+
}
|
15
|
+
END
|
16
|
+
end
|
15
17
|
|
16
18
|
it 'should only detect a single problem' do
|
17
19
|
expect(problems).to have(1).problem
|
18
20
|
end
|
19
21
|
|
20
22
|
it 'should create an error' do
|
21
|
-
expect(problems).to contain_error(msg).on_line(
|
23
|
+
expect(problems).to contain_error(msg).on_line(5).in_column(11)
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
27
|
context 'bug #145: resource with a hash and no duplicate parameters' do
|
26
|
-
let(:code)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
let(:code) do
|
29
|
+
<<-END
|
30
|
+
class {'fooname':
|
31
|
+
hashes => [
|
32
|
+
{ foo => 'bar01',},
|
33
|
+
{ foo => 'bar02', },
|
34
|
+
],
|
35
|
+
}
|
36
|
+
END
|
37
|
+
end
|
34
38
|
|
35
39
|
it 'should not detect any errors' do
|
36
40
|
expect(problems).to have(0).problems
|
@@ -38,52 +42,58 @@ describe 'duplicate_params' do
|
|
38
42
|
end
|
39
43
|
|
40
44
|
context 'bug #145: resource with a hash and duplicate parameters in subhash' do
|
41
|
-
let(:code)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
foo => '
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
let(:code) do
|
46
|
+
<<-END
|
47
|
+
class {'fooname':
|
48
|
+
hashes => [
|
49
|
+
{ foo => 'bar01',
|
50
|
+
foo => 'bar02', },
|
51
|
+
],
|
52
|
+
}
|
53
|
+
END
|
54
|
+
end
|
49
55
|
|
50
56
|
it 'should only detect a single error' do
|
51
57
|
expect(problems).to have(1).problem
|
52
58
|
end
|
53
59
|
|
54
60
|
it 'should create an error' do
|
55
|
-
expect(problems).to contain_error(msg).on_line(
|
61
|
+
expect(problems).to contain_error(msg).on_line(4).in_column(15)
|
56
62
|
end
|
57
63
|
end
|
58
64
|
|
59
65
|
context 'bug #145: resource with a hash and duplicate parameters in parent type' do
|
60
|
-
let(:code)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
let(:code) do
|
67
|
+
<<-END
|
68
|
+
class {'fooname':
|
69
|
+
hashes => [
|
70
|
+
{ foo => 'bar01', },
|
71
|
+
{ foo => 'bar02', },
|
72
|
+
],
|
73
|
+
something => { hash => 'mini', },
|
74
|
+
hashes => 'dupe',
|
75
|
+
}
|
76
|
+
END
|
77
|
+
end
|
70
78
|
|
71
79
|
it 'should only detect a single problem' do
|
72
80
|
expect(problems).to have(1).problem
|
73
81
|
end
|
74
82
|
|
75
83
|
it 'should create an error' do
|
76
|
-
expect(problems).to contain_error(msg).on_line(
|
84
|
+
expect(problems).to contain_error(msg).on_line(7).in_column(11)
|
77
85
|
end
|
78
86
|
end
|
79
87
|
|
80
88
|
describe 'bug #145: more hash tests and no duplicate parameters' do
|
81
|
-
let(:code)
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
89
|
+
let(:code) do
|
90
|
+
<<-END
|
91
|
+
class test {
|
92
|
+
$foo = { param => 'value', }
|
93
|
+
$bar = { param => 'bar', }
|
94
|
+
}
|
95
|
+
END
|
96
|
+
end
|
87
97
|
|
88
98
|
it 'should not detect any problems' do
|
89
99
|
expect(problems).to have(0).problems
|
@@ -91,7 +101,7 @@ describe 'duplicate_params' do
|
|
91
101
|
end
|
92
102
|
|
93
103
|
context 'colon as last token in file' do
|
94
|
-
let(:code) {
|
104
|
+
let(:code) { '}:' }
|
95
105
|
|
96
106
|
it 'should not detect any problems' do
|
97
107
|
expect(problems).to have(0).problems
|
@@ -13,11 +13,13 @@ describe 'ensure_first_param' do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
context 'ensure as only attr in a multi line resource' do
|
16
|
-
let(:code)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
let(:code) do
|
17
|
+
<<-END
|
18
|
+
file { 'foo':
|
19
|
+
ensure => present,
|
20
|
+
}
|
21
|
+
END
|
22
|
+
end
|
21
23
|
|
22
24
|
it 'should not detect any problems' do
|
23
25
|
expect(problems).to have(0).problems
|
@@ -25,29 +27,33 @@ describe 'ensure_first_param' do
|
|
25
27
|
end
|
26
28
|
|
27
29
|
context 'ensure as second attr in a multi line resource' do
|
28
|
-
let(:code)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
let(:code) do
|
31
|
+
<<-END
|
32
|
+
file { 'foo':
|
33
|
+
mode => '0000',
|
34
|
+
ensure => present,
|
35
|
+
}
|
36
|
+
END
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should only detect a single problem' do
|
36
40
|
expect(problems).to have(1).problem
|
37
41
|
end
|
38
42
|
|
39
43
|
it 'should create a warning' do
|
40
|
-
expect(problems).to contain_warning(msg).on_line(
|
44
|
+
expect(problems).to contain_warning(msg).on_line(3).in_column(13)
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
44
48
|
context 'ensure as first attr in a multi line resource' do
|
45
|
-
let(:code)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
let(:code) do
|
50
|
+
<<-END
|
51
|
+
file { 'foo':
|
52
|
+
ensure => present,
|
53
|
+
mode => '0000',
|
54
|
+
}
|
55
|
+
END
|
56
|
+
end
|
51
57
|
|
52
58
|
it 'should not detect any problems' do
|
53
59
|
expect(problems).to have(0).problems
|
@@ -55,18 +61,20 @@ describe 'ensure_first_param' do
|
|
55
61
|
end
|
56
62
|
|
57
63
|
context 'ensure as a hash key in classes does not need to be first' do
|
58
|
-
let(:code)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
}
|
64
|
+
let(:code) do
|
65
|
+
<<-END
|
66
|
+
class thing {
|
67
|
+
class { 'thang':
|
68
|
+
stuff => {
|
69
|
+
'stuffing' => {
|
70
|
+
ensure => 'present',
|
71
|
+
blah => 'bleah',
|
72
|
+
}
|
73
|
+
},
|
67
74
|
}
|
68
|
-
|
69
|
-
|
75
|
+
}
|
76
|
+
END
|
77
|
+
end
|
70
78
|
|
71
79
|
it 'should not detect any problems' do
|
72
80
|
expect(problems).to have(0).problems
|
@@ -92,11 +100,13 @@ describe 'ensure_first_param' do
|
|
92
100
|
end
|
93
101
|
|
94
102
|
context 'ensure as only attr in a multi line resource' do
|
95
|
-
let(:code)
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
103
|
+
let(:code) do
|
104
|
+
<<-END
|
105
|
+
file { 'foo':
|
106
|
+
ensure => present,
|
107
|
+
}
|
108
|
+
END
|
109
|
+
end
|
100
110
|
|
101
111
|
it 'should not detect any problems' do
|
102
112
|
expect(problems).to have(0).problems
|
@@ -104,37 +114,46 @@ describe 'ensure_first_param' do
|
|
104
114
|
end
|
105
115
|
|
106
116
|
context 'ensure as second attr in a multi line resource' do
|
107
|
-
let(:code)
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
117
|
+
let(:code) do
|
118
|
+
<<-END
|
119
|
+
file { 'foo':
|
120
|
+
mode => '0000',
|
121
|
+
ensure => present,
|
122
|
+
}
|
123
|
+
END
|
124
|
+
end
|
125
|
+
|
126
|
+
let(:fixed) do
|
127
|
+
<<-END
|
128
|
+
file { 'foo':
|
129
|
+
ensure => present,
|
130
|
+
mode => '0000',
|
131
|
+
}
|
132
|
+
END
|
133
|
+
end
|
113
134
|
|
114
135
|
it 'should only detect a single problem' do
|
115
136
|
expect(problems).to have(1).problem
|
116
137
|
end
|
117
138
|
|
118
139
|
it 'should create a warning' do
|
119
|
-
expect(problems).to contain_fixed(msg).on_line(
|
140
|
+
expect(problems).to contain_fixed(msg).on_line(3).in_column(13)
|
120
141
|
end
|
121
142
|
|
122
143
|
it 'should make ensure the first attr' do
|
123
|
-
expect(manifest).to eq(
|
124
|
-
file { 'foo':
|
125
|
-
ensure => present,
|
126
|
-
mode => '0000',
|
127
|
-
}")
|
144
|
+
expect(manifest).to eq(fixed)
|
128
145
|
end
|
129
146
|
end
|
130
147
|
|
131
148
|
context 'ensure as first attr in a multi line resource' do
|
132
|
-
let(:code)
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
149
|
+
let(:code) do
|
150
|
+
<<-END
|
151
|
+
file { 'foo':
|
152
|
+
ensure => present,
|
153
|
+
mode => '0000',
|
154
|
+
}
|
155
|
+
END
|
156
|
+
end
|
138
157
|
|
139
158
|
it 'should not detect any problems' do
|
140
159
|
expect(problems).to have(0).problems
|
@@ -142,18 +161,20 @@ describe 'ensure_first_param' do
|
|
142
161
|
end
|
143
162
|
|
144
163
|
context 'ensure as a hash key in classes does not need to be first' do
|
145
|
-
let(:code)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
}
|
164
|
+
let(:code) do
|
165
|
+
<<-END
|
166
|
+
class thing {
|
167
|
+
class { 'thang':
|
168
|
+
stuff => {
|
169
|
+
'stuffing' => {
|
170
|
+
ensure => 'present',
|
171
|
+
blah => 'bleah',
|
172
|
+
}
|
173
|
+
},
|
154
174
|
}
|
155
|
-
|
156
|
-
|
175
|
+
}
|
176
|
+
END
|
177
|
+
end
|
157
178
|
|
158
179
|
it 'should not detect any problems' do
|
159
180
|
expect(problems).to have(0).problems
|
@@ -161,38 +182,42 @@ describe 'ensure_first_param' do
|
|
161
182
|
end
|
162
183
|
|
163
184
|
context 'ensure is a selector' do
|
164
|
-
let(:code)
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
185
|
+
let(:code) do
|
186
|
+
<<-END
|
187
|
+
file { 'foo':
|
188
|
+
mode => '0640',
|
189
|
+
ensure => $::operatingsystem ? {
|
190
|
+
'redhat' => absent,
|
191
|
+
default => $::phase_of_the_moon ? {
|
192
|
+
'full' => absent,
|
193
|
+
default => present,
|
194
|
+
},
|
172
195
|
},
|
173
|
-
}
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
let(:fixed)
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
196
|
+
}
|
197
|
+
END
|
198
|
+
end
|
199
|
+
|
200
|
+
let(:fixed) do
|
201
|
+
<<-END
|
202
|
+
file { 'foo':
|
203
|
+
ensure => $::operatingsystem ? {
|
204
|
+
'redhat' => absent,
|
205
|
+
default => $::phase_of_the_moon ? {
|
206
|
+
'full' => absent,
|
207
|
+
default => present,
|
208
|
+
},
|
184
209
|
},
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
210
|
+
mode => '0640',
|
211
|
+
}
|
212
|
+
END
|
213
|
+
end
|
189
214
|
|
190
215
|
it 'should detect a problem' do
|
191
216
|
expect(problems).to have(1).problem
|
192
217
|
end
|
193
218
|
|
194
219
|
it 'should fix the problem' do
|
195
|
-
expect(problems).to contain_fixed(msg).on_line(
|
220
|
+
expect(problems).to contain_fixed(msg).on_line(3).in_column(13)
|
196
221
|
end
|
197
222
|
|
198
223
|
it 'should move the whole ensure parameter to the top' do
|
@@ -5,12 +5,14 @@ describe 'ensure_not_symlink_target' do
|
|
5
5
|
|
6
6
|
context 'with fix disabled' do
|
7
7
|
context 'file resource creating a symlink with seperate target attr' do
|
8
|
-
let(:code)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
let(:code) do
|
9
|
+
<<-END
|
10
|
+
file { 'foo':
|
11
|
+
ensure => link,
|
12
|
+
target => '/foo/bar',
|
13
|
+
}
|
14
|
+
END
|
15
|
+
end
|
14
16
|
|
15
17
|
it 'should not detect any problems' do
|
16
18
|
expect(problems).to have(0).problems
|
@@ -18,18 +20,20 @@ describe 'ensure_not_symlink_target' do
|
|
18
20
|
end
|
19
21
|
|
20
22
|
context 'file resource creating a symlink with target specified in ensure' do
|
21
|
-
let(:code)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
let(:code) do
|
24
|
+
<<-END
|
25
|
+
file { 'foo':
|
26
|
+
ensure => '/foo/bar',
|
27
|
+
}
|
28
|
+
END
|
29
|
+
end
|
26
30
|
|
27
31
|
it 'should only detect a single problem' do
|
28
32
|
expect(problems).to have(1).problem
|
29
33
|
end
|
30
34
|
|
31
35
|
it 'should create a warning' do
|
32
|
-
expect(problems).to contain_warning(msg).on_line(
|
36
|
+
expect(problems).to contain_warning(msg).on_line(2).in_column(23)
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -44,12 +48,14 @@ describe 'ensure_not_symlink_target' do
|
|
44
48
|
end
|
45
49
|
|
46
50
|
context 'file resource creating a symlink with seperate target attr' do
|
47
|
-
let(:code)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
let(:code) do
|
52
|
+
<<-END
|
53
|
+
file { 'foo':
|
54
|
+
ensure => link,
|
55
|
+
target => '/foo/bar',
|
56
|
+
}
|
57
|
+
END
|
58
|
+
end
|
53
59
|
|
54
60
|
it 'should not detect any problems' do
|
55
61
|
expect(problems).to have(0).problems
|
@@ -61,24 +67,29 @@ describe 'ensure_not_symlink_target' do
|
|
61
67
|
end
|
62
68
|
|
63
69
|
context 'file resource creating a symlink with target specified in ensure' do
|
64
|
-
let(:code)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
let(:code) do
|
71
|
+
<<-END
|
72
|
+
file { 'foo':
|
73
|
+
ensure => '/foo/bar',
|
74
|
+
}
|
75
|
+
END
|
76
|
+
end
|
77
|
+
|
78
|
+
let(:fixed) do
|
79
|
+
<<-END
|
80
|
+
file { 'foo':
|
81
|
+
ensure => symlink,
|
82
|
+
target => '/foo/bar',
|
83
|
+
}
|
84
|
+
END
|
85
|
+
end
|
75
86
|
|
76
87
|
it 'should only detect a single problem' do
|
77
88
|
expect(problems).to have(1).problem
|
78
89
|
end
|
79
90
|
|
80
91
|
it 'should fix the problem' do
|
81
|
-
expect(problems).to contain_fixed(msg).on_line(
|
92
|
+
expect(problems).to contain_fixed(msg).on_line(2).in_column(23)
|
82
93
|
end
|
83
94
|
|
84
95
|
it 'should create a new target param' do
|