Skip to content
Snippets Groups Projects
Select Git revision
  • d714bc8dbdbbce2065e36a026f324baf79eefc89
  • master default protected
  • php84
  • ll-api-test
  • 6.x
  • release_6.2.0
  • modif_maintenance_phtml
  • 6.0.x
  • detached2
  • detached
  • php82
  • feature_SearchAndSelectFilter
  • 5.x
  • 4.x
  • 7.2.1
  • 7.2.0
  • 6.2.0
  • 7.1.0
  • 7.0.0
  • 1.1.1
  • 6.1.7
  • 6.1.6
  • 6.1.5
  • 6.0.16
  • 6.0.15
  • 6.1.4
  • 6.0.14
  • 6.1.3
  • 6.0.13
  • 6.1.2
  • 6.0.12
  • 6.1.1
  • 6.1.0
  • 6.0.11
34 results

doctrine-module-em.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    postfix_hash_spec.rb 3.07 KiB
    require 'spec_helper'
    
    describe 'postfix::hash' do
      let (:title) { '/tmp/foo' }
    
      let :pre_condition do
        "class { '::postfix': }"
      end
    
      on_supported_os.each do |os, facts|
        context "on #{os}" do
          let(:facts) do
            facts
          end
    
          context 'when passing wrong type for ensure' do
            let (:params) { {
              :ensure => ['present'],
            } }
            it 'should fail' do
              expect {
                is_expected.to contain_file('/tmp/foo')
              }.to raise_error
            end
          end
    
          context 'when passing wrong value for ensure' do
            let (:params) { {
              :ensure => 'running',
            } }
            it 'should fail' do
              expect {
                is_expected.to contain_file('/tmp/foo')
              }.to raise_error(Puppet::Error, /got 'running'/)
            end
          end
    
          context 'when passing wrong value for title' do
            let (:title) { 'foo' }
            it 'should fail' do
              expect {
                is_expected.to contain_file('/tmp/foo')
              }.to raise_error(Puppet::Error, /got 'foo'/)
            end
          end
    
          context 'when passing both source and content' do
            let (:params) { {
              :source  => '/tmp/bar',
              :content => 'bar',
            } }
    
            it 'should fail' do
              expect {
                is_expected.to contain_file('/tmp/foo')
              }.to raise_error(Puppet::Error, /You must provide either 'source' or 'content'/)
            end
          end
    
          context 'when passing source' do
            let (:params) { {
              :source  => '/tmp/bar',
            } }
    
            it { is_expected.to contain_file('postfix map /tmp/foo').with(
              :ensure => 'present',
              :source => '/tmp/bar'
            ).without(:content)
            }
            it { is_expected.to contain_file('postfix map /tmp/foo.db').with_ensure('present') }
            it { is_expected.to contain_exec('generate /tmp/foo.db') }
    
          end
    
          context 'when passing content' do
            let (:params) { {
              :content => 'bar',
            } }
    
            it { is_expected.to contain_file('postfix map /tmp/foo').with(
              :ensure  => 'present',
              :content => 'bar'
            ).without(:source)
            }
            it { is_expected.to contain_file('postfix map /tmp/foo.db').with_ensure('present') }
            it { is_expected.to contain_exec('generate /tmp/foo.db') }
          end
    
          context 'when not passing source or content' do
            it { is_expected.to contain_file('postfix map /tmp/foo').with(
              :ensure  => 'present'
            ).without(:source).without(:content)
            }
            it { is_expected.to contain_file('postfix map /tmp/foo.db').with_ensure('present') }
            it { is_expected.to contain_exec('generate /tmp/foo.db') }
          end
    
          context 'when ensuring absence' do
            let (:params) { {
              :ensure => 'absent',
            } }
    
            it { is_expected.to contain_file('postfix map /tmp/foo').with_ensure('absent') }
            it { is_expected.to contain_file('postfix map /tmp/foo.db').with_ensure('absent') }
            it { is_expected.to contain_exec('generate /tmp/foo.db') }
          end
        end
      end
    end