X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fpostgresql%2Fspec%2Funit%2Fclasses%2Flib%2Fdevel_spec.rb;fp=3rdparty%2Fmodules%2Fpostgresql%2Fspec%2Funit%2Fclasses%2Flib%2Fdevel_spec.rb;h=ca0ebb3b8089f186738e2a6216ad5414eda57835;hb=a69999e580f8b3abd12446c2d6ad59e517651813;hp=0000000000000000000000000000000000000000;hpb=e7b6b352165009c385c52fcfe5a1055690dbfa4b;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/postgresql/spec/unit/classes/lib/devel_spec.rb b/3rdparty/modules/postgresql/spec/unit/classes/lib/devel_spec.rb new file mode 100644 index 000000000..ca0ebb3b8 --- /dev/null +++ b/3rdparty/modules/postgresql/spec/unit/classes/lib/devel_spec.rb @@ -0,0 +1,73 @@ +require 'spec_helper' + +describe 'postgresql::lib::devel', :type => :class do + let :facts do + { + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemrelease => '6.0', + } + end + it { is_expected.to contain_class("postgresql::lib::devel") } + + describe 'link pg_config to /usr/bin' do + it { should_not contain_file('/usr/bin/pg_config') \ + .with_ensure('link') \ + .with_target('/usr/lib/postgresql/8.4/bin/pg_config') + } + end + + describe 'disable link_pg_config' do + let(:params) {{ + :link_pg_config => false, + }} + it { should_not contain_file('/usr/bin/pg_config') } + end + + describe 'should not link pg_config on RedHat with default version' do + let(:facts) {{ + :osfamily => 'RedHat', + :operatingsystem => 'CentOS', + :operatingsystemrelease => '6.3', + :operatingsystemmajrelease => '6', + }} + it { should_not contain_file('/usr/bin/pg_config') } + end + + describe 'link pg_config on RedHat with non-default version' do + let(:facts) {{ + :osfamily => 'RedHat', + :operatingsystem => 'CentOS', + :operatingsystemrelease => '6.3', + :operatingsystemmajrelease => '6', + }} + let :pre_condition do + "class { '::postgresql::globals': version => '9.3' }" + end + + it { should contain_file('/usr/bin/pg_config') \ + .with_ensure('link') \ + .with_target('/usr/pgsql-9.3/bin/pg_config') + } + end + + describe 'on Gentoo' do + let :facts do + { + :osfamily => 'Gentoo', + :operatingsystem => 'Gentoo', + } + end + let :params do + { + :link_pg_config => false, + } + end + + it 'should fail to compile' do + expect { + is_expected.to compile + }.to raise_error(/is not supported/) + end + end +end