validate_re($setting_type, ['conf', 'pref', 'list'])
validate_re($ensure, ['file', 'present', 'absent'])
+ validate_string($base_name)
unless is_integer($priority) {
- fail('apt::setting priority must be an integer')
+ # need this to allow zero-padded priority.
+ validate_re($priority, '^\d+$', 'apt::setting priority must be an integer or a zero-padded integer.')
}
if $source {
describe 'with priority=100' do
let(:params) { default_params.merge({ :priority => 100 }) }
- it { should contain_file('/etc/apt/apt.conf.d/100teddybear') }
+ it { is_expected.to contain_file('/etc/apt/apt.conf.d/100teddybear') }
end
+ describe 'with base_name=puppy' do
+ let(:params) { default_params.merge({ :base_name => 'puppy' }) }
+ it { should contain_file('/etc/apt/apt.conf.d/50puppy') }
+ end
+
+ describe 'with base_name=true' do
+ let(:params) { default_params.merge({ :base_name => true }) }
+ it do
+ expect { should compile }.to raise_error(Puppet::Error, /not a string/)
+ end
+ end
+
describe 'with ensure=absent' do
let(:params) { default_params.merge({ :ensure => 'absent' }) }
- it { should contain_file('/etc/apt/apt.conf.d/50teddybear').with({
+ it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').with({
:ensure => 'absent',
})}
end