Skip to content

Commit 4c96ff3

Browse files
committed
Add more checks for onlyif / unless
These commands are supposed to be supported, but they are not tested, so add tests to demonstrate that they work as intended.
1 parent 3514c93 commit 4c96ff3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spec/puppet-lint/plugins/check_unsafe_interpolations_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,23 @@ class foo {
3333
3434
exec { 'bar':
3535
command => "echo ${foo} ${bar}",
36+
onlyif => "${baz}",
37+
unless => "${bazz}",
3638
}
3739
3840
}
3941
PUPPET
4042
end
4143

4244
it 'detects multiple unsafe exec command arguments' do
43-
expect(problems).to have(2).problems
45+
expect(problems).to have(4).problems
4446
end
4547

4648
it 'creates two warnings' do
4749
expect(problems).to contain_warning(msg)
4850
expect(problems).to contain_warning("unsafe interpolation of variable 'bar' in exec command")
51+
expect(problems).to contain_warning("unsafe interpolation of variable 'baz' in exec command")
52+
expect(problems).to contain_warning("unsafe interpolation of variable 'bazz' in exec command")
4953
end
5054
end
5155

0 commit comments

Comments
 (0)