Skip to content
Snippets Groups Projects
Select Git revision
  • fde2cfee02625af1fc94b37ac5ce085ffe67fcf3
  • master default protected
  • b24
  • ll-workflow
  • alc-scindage-donnees-pj
  • FJ_LL_Tbl_Contrat
  • alc-docker-node
  • ll-apiplatform
  • php84
  • ll-rgpd
  • b23
  • alc-filtre-type-intervenant
  • ll-sans-mdb5
  • formules-ancienne-infra
  • ll-formules
  • alc-intervenant-dmep
  • ll-suppr-v_vol-s
  • b20
  • ll-postgresql
  • b23.0.1
  • b22
  • 24.8
  • 24.7
  • 24.6
  • 24.5
  • 24.4
  • 24.3
  • 24.2
  • 24.1
  • 24.0
  • 23.15
  • 24.0-beta19
  • 24.0-beta18
  • 24.0-beta17
  • 24.0-beta16
  • 24.0-beta15
  • 24.0-beta14
  • 24.0-beta13
  • 23.14
  • 24.0-beta12
  • 24.0-beta11
41 results

ContratService.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