postfix_spec.rb 1.79 KB
Newer Older
1
2
3
4
5
6
7
require 'spec_helper'

describe 'postfix' do
  context 'when on Debian' do
    let (:facts) { {
      :operatingsystem => 'Debian',
      :osfamily        => 'Debian',
Raphaël Pinson's avatar
Raphaël Pinson committed
8
      :fqdn            => 'fqdn.example.com',
9
10
11
    } }

    it { should contain_package('postfix') }
Raphaël Pinson's avatar
Raphaël Pinson committed
12
    it { should contain_package('mailx') }
Raphaël Pinson's avatar
Raphaël Pinson committed
13

Raphaël Pinson's avatar
Raphaël Pinson committed
14
15
    it { should contain_file('/etc/mailname').with_content("fqdn.example.com\n") }
    it { should contain_file('/etc/aliases').with_content("# file managed by puppet\n") }
Raphaël Pinson's avatar
Raphaël Pinson committed
16
17
    it { should contain_exec('newaliases').with_refreshonly('true') }
    it { should contain_file('/etc/postfix/master.cf') }
Raphaël Pinson's avatar
Raphaël Pinson committed
18
19
20
21
22
    it { should contain_file('/etc/postfix/main.cf' ) }

    it { should contain_postfix__config('myorigin') }
    it { should contain_postfix__config('alias_maps') }
    it { should contain_postfix__config('inet_interfaces') }
23
24
25
26
27
28
  end

  context 'when on RedHat' do
    let (:facts) { {
      :operatingsystem => 'RedHat',
      :osfamily        => 'RedHat',
Raphaël Pinson's avatar
Raphaël Pinson committed
29
      :fqdn            => 'fqdn.example.com',
30
31
32
    } }

    it { should contain_package('postfix') }
Raphaël Pinson's avatar
Raphaël Pinson committed
33
    it { should contain_package('mailx') }
Raphaël Pinson's avatar
Raphaël Pinson committed
34

Raphaël Pinson's avatar
Raphaël Pinson committed
35
36
    it { should contain_file('/etc/mailname').with_content("fqdn.example.com\n") }
    it { should contain_file('/etc/aliases').with_content("# file managed by puppet\n") }
Raphaël Pinson's avatar
Raphaël Pinson committed
37
38
    it { should contain_exec('newaliases').with_refreshonly('true') }
    it { should contain_file('/etc/postfix/master.cf') }
Raphaël Pinson's avatar
Raphaël Pinson committed
39
40
41
42
43
44
45
46
    it { should contain_file('/etc/postfix/main.cf' ) }

    it { should contain_postfix__config('myorigin') }
    it { should contain_postfix__config('alias_maps') }
    it { should contain_postfix__config('inet_interfaces') }
    it { should contain_postfix__config('sendmail_path') }
    it { should contain_postfix__config('newaliases_path') }
    it { should contain_postfix__config('mailq_path') }
47
48
  end
end