Merge pull request #208 from flypenguin/mods

fix: permitting $backup to be boolean false
This commit is contained in:
Joshua Hoblitt 2014-08-18 08:41:04 -07:00
commit cc1e654e60
2 changed files with 13 additions and 3 deletions

View file

@ -75,7 +75,9 @@ define concat(
fail('$warn is not a string or boolean')
}
validate_bool($force)
validate_string($backup)
if ! is_bool($backup) and ! is_string($backup) {
fail('$backup must be string or bool!')
}
validate_bool($replace)
validate_re($order, '^alpha$|^numeric$')
validate_bool($ensure_newline)

View file

@ -307,10 +307,18 @@ describe 'concat', :type => :define do
end
context 'false' do
it_behaves_like 'concat', '/etc/foo.bar', { :backup => false }
end
context 'true' do
it_behaves_like 'concat', '/etc/foo.bar', { :backup => true }
end
context 'true' do
let(:title) { '/etc/foo.bar' }
let(:params) {{ :backup => false }}
let(:params) {{ :backup => [] }}
it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /is not a string/)
expect { should }.to raise_error(Puppet::Error, /backup must be string or bool/)
end
end
end # backup =>