Skip to content

Instantly share code, notes, and snippets.

@domcleal
Created March 29, 2017 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domcleal/240a83257a7926b7b6b0e17b3b79a716 to your computer and use it in GitHub Desktop.
Save domcleal/240a83257a7926b7b6b0e17b3b79a716 to your computer and use it in GitHub Desktop.
require 'spec_helper'
PuppetLint.new_check(:case_spec) do
def check
resource_indexes.each do |resource|
notify :error,
message: 'No resources should be in the manifest',
line: resource[:tokens][0].line,
column: resource[:tokens][0].column,
token: resource[:tokens][0]
end
end
end
describe 'case_spec' do
context 'with a case statement' do
let(:code) { "
case $::osfamily {
'RedHat': {
$datadir = $::operatingsystem ? {
'Amazon' => pick($datadir, '/var/lib/pgsql${package_version}/data'),
default => pick($datadir, '/var/lib/pgsql/data'),
}
}
}"
}
it 'should not detect any problems' do
expect(problems).to have(0).problems
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment