Created
March 29, 2017 08:53
-
-
Save domcleal/240a83257a7926b7b6b0e17b3b79a716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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