From f5149b33907496dea05678faaf7afd563a2cd07b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= <raphael.pinson@camptocamp.com> Date: Mon, 20 May 2013 14:39:41 +0200 Subject: [PATCH] Override parameters --- spec/classes/postfix_spec.rb | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/spec/classes/postfix_spec.rb b/spec/classes/postfix_spec.rb index 7645aa7..27fb19b 100644 --- a/spec/classes/postfix_spec.rb +++ b/spec/classes/postfix_spec.rb @@ -67,4 +67,54 @@ describe 'postfix' do ) } end end + + context 'when setting parameters' do + context 'when on Debian' do + context "when setting smtp_listen to 'all'" do + let (:facts) { { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :fqdn => 'fqdn.example.com', + } } + + let (:params) { { + :smtp_listen => 'all', + :root_mail_recipient => 'foo', + :use_amavisd => 'yes', + :use_dovecot_lda => 'yes', + :use_schleuder => 'yes', + :use_sympa => 'yes', + :mail_user => 'bar', + :myorigin => 'localhost', + :inet_interfaces => 'localhost2', + } } + + it { should contain_package('postfix') } + it { should contain_package('mailx') } + + it { should contain_file('/etc/mailname').without('seltype').with_content("fqdn.example.com\n") } + it { should contain_file('/etc/aliases').without('seltype').with_content("# file managed by puppet\n") } + it { should contain_exec('newaliases').with_refreshonly('true') } + it { + should contain_file('/etc/postfix/master.cf').without('seltype').with_content( + /smtp inet n - - - - smtpd/ + ) } + it { should contain_file('/etc/postfix/main.cf').without('seltype') } + + it { should contain_postfix__config('myorigin') } + it { should contain_postfix__config('alias_maps') } + it { should contain_postfix__config('inet_interfaces') } + + it { should contain_mailalias('root') } + + it { + should contain_service('postfix').with( + :ensure => 'running', + :enable => 'true', + :hasstatus => 'true', + :restart => '/etc/init.d/postfix reload' + ) } + end + end + end end -- GitLab