Skip to content
Snippets Groups Projects
Select Git revision
  • d3267b2d26b44d738afb911b6cece6ad456f5c38
  • master default
  • php8.2-docker-services
  • 6.x
  • laminas
  • bertrand.gauthier-master-patch-70311
  • bertrand.gauthier-master-patch-87168
  • laminas_migration
  • sqlite
  • 4.0.0
  • 3.2.1
  • 3.2.0
  • 3.1.0
  • 3.0.0
  • 1.0.1
  • 1.0.0
16 results

docker-build-app.sh

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    postfix_hash_spec.rb 2.92 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 value for ensure' do
            let(:params) do
              {
                ensure: 'running',
              }
            end
    
            it 'fails' do
              expect do
                is_expected.to contain_file('/tmp/foo')
              end.to raise_error(Puppet::Error, %r{got 'running'})
            end
          end
    
          context 'when passing wrong value for title' do
            let(:title) { 'foo' }
    
            it 'fails' do
              expect do
                is_expected.to contain_file('/tmp/foo')
              end.to raise_error(Puppet::Error, %r{, got })
            end
          end
    
          context 'when passing both source and content' do
            let(:params) do
              {
                source: '/tmp/bar',
                content: 'bar',
              }
            end
    
            it 'fails' do
              expect do
                is_expected.to contain_file('/tmp/foo')
              end.to raise_error(Puppet::Error, %r{You must provide either 'source' or 'content'})
            end
          end
    
          context 'when passing source' do
            let(:params) do
              {
                source: '/tmp/bar',
              }
            end
    
            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) do
              {
                content: 'bar',
              }
            end
    
            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) do
              {
                ensure: 'absent',
              }
            end
    
            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