Debian Codegraph @

spec/classes/hourly_spec.rb

raw symbols SCIP
1 require 'spec_helper'
2
3 describe 'logrotate::hourly' do
4 context 'with default values' do
5 it do
6 should contain_file('/etc/logrotate.d/hourly').with({
7 'ensure' => 'directory',
8 'owner' => 'root',
9 'group' => 'root',
10 'mode' => '0755',
11 })
12 end
13
14 it do
15 should contain_file('/etc/cron.hourly/logrotate').with({
16 'ensure' => 'present',
17 'owner' => 'root',
18 'group' => 'root',
19 'mode' => '0555',
20 'source' => 'puppet:///modules/logrotate/etc/cron.hourly/logrotate',
21 'require' => [
22 'File[/etc/logrotate.d/hourly]',
23 'Package[logrotate]',
24 ],
25 })
26 end
27 end
28
29 context 'with ensure => absent' do
30 let(:params) { {:ensure => 'absent'} }
31
32 it { should contain_file('/etc/logrotate.d/hourly').with_ensure('absent') }
33 it { should contain_file('/etc/cron.hourly/logrotate').with_ensure('absent') }
34 end
35
36 context 'with ensure => foo' do
37 let(:params) { {:ensure => 'foo'} }
38
39 it do
40 expect {
41 should contain_file('/etc/logrotate.d/hourly')
42 }.to raise_error(Puppet::Error, /Invalid ensure value 'foo'/)
43 end
44 end
45 end