/
access_file_spec.rb
78 lines (69 loc) · 2.14 KB
/
access_file_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
require 'spec_helper'
describe 'sendmail::access::file' do
let(:pre_condition) { 'include sendmail::service' }
on_supported_os.each do |os, facts|
context "on #{os} with default parameters" do
let(:facts) { facts }
it {
case facts[:osfamily]
when 'Debian'
is_expected.to contain_class('sendmail::access::file')
is_expected.to contain_file('/etc/mail/access')
.with_ensure('file')
.with_owner('smmta')
.with_group('smmsp')
.with_mode('0640')
.without_content
.without_source
.that_notifies('Class[sendmail::makeall]')
when 'RedHat'
is_expected.to contain_class('sendmail::access::file')
is_expected.to contain_file('/etc/mail/access')
.with_ensure('file')
.with_owner('root')
.with_group('root')
.with_mode('0640')
.without_content
.without_source
.that_notifies('Class[sendmail::makeall]')
when 'FreeBSD'
is_expected.to contain_class('sendmail::access::file')
is_expected.to contain_file('/etc/mail/access')
.with_ensure('file')
.with_owner('root')
.with_group('wheel')
.with_mode('0640')
.without_content
.without_source
.that_notifies('Class[sendmail::makeall]')
end
}
end
context "on #{os} with content => foo" do
let(:facts) { facts }
let(:params) do
{ content: 'foo' }
end
it {
is_expected.to contain_file('/etc/mail/access')
.with_ensure('file')
.with_content('foo')
.without_source
.that_notifies('Class[sendmail::makeall]')
}
end
context "on #{os} with source => foo" do
let(:facts) { facts }
let(:params) do
{ source: 'foo' }
end
it {
is_expected.to contain_file('/etc/mail/access')
.with_ensure('file')
.without_content
.with_source('foo')
.that_notifies('Class[sendmail::makeall]')
}
end
end
end