Commit 80d4fbbe authored by Mickaël Canévet's avatar Mickaël Canévet
Browse files

Fix unit tests

parent b61e5a9b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2,9 +2,15 @@ require 'spec_helper'

describe 'postfix::augeas' do
  let (:facts) { {
    :augeasversion   => '1.2.0',
    :lsbdistcodename => 'wheezy',
    :operatingsystem => 'Debian',
    :osfamily        => 'Debian',
    :rubyversion     => '1.9.3',
  } }
  let :pre_condition do
    "include ::augeas"
  end

  it { should contain_augeas__lens('postfix_transport').with(
    :ensure      => 'present',
+8 −1
Original line number Diff line number Diff line
@@ -2,9 +2,16 @@ require 'spec_helper'

describe 'postfix::mta' do
  let (:facts) { {
    :needs_postfix_class_with_params => true,
    :lsbdistcodename => 'wheezy',
    :osfamily        => 'Debian',
  } }
  let :pre_condition do
    "class { 'postfix':
      mydestination => 'bar',
      mynetworks    => 'baz',
      relayhost     => 'foo',
    }"
  end

  it { should contain_postfix__config('mydestination').with_value('bar') }
  it { should contain_postfix__config('mynetworks').with_value('baz') }
+11 −1
Original line number Diff line number Diff line
@@ -3,9 +3,19 @@ require 'spec_helper'
describe 'postfix::satellite' do
  let (:node) { 'foo.example.com' }
  let (:facts) { {
    :augeasversion   => '1.2.0',
    :lsbdistcodename => 'wheezy',
    :osfamily        => 'Debian',
    :needs_postfix_class_with_params => true,
    :rubyversion     => '1.9.3',
  } }
  let :pre_condition do
    " class { 'augeas': }
    class { 'postfix':
      relayhost     => 'foo',
      mydestination => 'bar',
      mynetworks    => 'baz',
    }"
  end
  it { should contain_class('postfix::mta') }
  it { should contain_postfix__virtual('@foo.example.com').with(
    :ensure      => 'present',
+9 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ describe 'postfix' do
  context 'when using defaults' do
    context 'when on Debian' do
      let (:facts) { {
        :lsbdistcodename => 'wheezy',
        :operatingsystem => 'Debian',
        :osfamily        => 'Debian',
        :fqdn            => 'fqdn.example.com',
@@ -35,6 +36,7 @@ describe 'postfix' do

    context 'when on RedHat' do
      let (:facts) { {
        :lsbmajdistrelease => '7',
        :operatingsystem   => 'RedHat',
        :osfamily          => 'RedHat',
        :fqdn              => 'fqdn.example.com',
@@ -72,6 +74,7 @@ describe 'postfix' do
    context 'when on Debian' do
      context "when setting smtp_listen to 'all'" do
        let (:facts) { {
          :lsbdistcodename => 'wheezy',
          :operatingsystem => 'Debian',
          :osfamily        => 'Debian',
          :fqdn            => 'fqdn.example.com',
@@ -139,8 +142,11 @@ describe 'postfix' do
    end
    context 'when on RedHat' do
      let (:facts) { {
        :augeasversion   => '1.2.0',
        :lsbdistcodename => 'wheezy',
        :operatingsystem => 'Debian',
        :osfamily        => 'Debian',
        :rubyversion     => '1.9.7',
        :fqdn            => 'fqdn.example.com',
      } }
      context 'when specifying inet_interfaces' do
@@ -246,6 +252,9 @@ describe 'postfix' do
      end
      context 'when specifying satellite' do
        let (:params) { { :satellite => true, :mydestination => '1.2.3.4', :relayhost => '2.3.4.5' } }
        let :pre_condition do
          "class { 'augeas': }"
        end
        it 'should configure all local email to be forwarded to $root_mail_recipient delivered through $relayhost' do
          should contain_postfix__config('mydestination').with_value('1.2.3.4')
          should contain_postfix__config('mynetworks').with_value('127.0.0.0/8')
+4 −1
Original line number Diff line number Diff line
@@ -3,9 +3,12 @@ require 'spec_helper'
describe 'postfix::config' do
  let (:title) { 'foo' }
  let (:facts) { {
    :lsbdistcodename => 'wheezy',
    :osfamily        => 'Debian',
    :needs_postfix_class => true,
  } }
  let :pre_condition do
    "class { 'postfix': }"
  end

  context 'when not passing value' do
    it 'should fail' do
Loading