X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fpostgresql%2Fspec%2Funit%2Fclasses%2Fclient_spec.rb;h=3f2e58f4b1436d92db6e658e6d66e6002535de9d;hb=a69999e580f8b3abd12446c2d6ad59e517651813;hp=6da32b3a0566887a8afd30004fcf0ba51d739c42;hpb=e7b6b352165009c385c52fcfe5a1055690dbfa4b;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/postgresql/spec/unit/classes/client_spec.rb b/3rdparty/modules/postgresql/spec/unit/classes/client_spec.rb index 6da32b3a0..3f2e58f4b 100644 --- a/3rdparty/modules/postgresql/spec/unit/classes/client_spec.rb +++ b/3rdparty/modules/postgresql/spec/unit/classes/client_spec.rb @@ -3,9 +3,56 @@ require 'spec_helper' describe 'postgresql::client', :type => :class do let :facts do { - :postgres_default_version => '8.4', :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemrelease => '6.0', } end - it { should include_class("postgresql::client") } + + describe 'with parameters' do + let :params do + { + :validcon_script_path => '/opt/bin/my-validate-con.sh', + :package_ensure => 'absent', + :package_name => 'mypackage', + :file_ensure => 'file' + } + end + + it 'should modify package' do + is_expected.to contain_package("postgresql-client").with({ + :ensure => 'absent', + :name => 'mypackage', + :tag => 'postgresql', + }) + end + + it 'should have specified validate connexion' do + should contain_file('/opt/bin/my-validate-con.sh').with({ + :ensure => 'file', + :owner => 0, + :group => 0, + :mode => '0755' + }) + end + end + + describe 'with no parameters' do + it 'should create package with postgresql tag' do + is_expected.to contain_package('postgresql-client').with({ + :tag => 'postgresql', + }) + end + end + + describe 'with client package name explicitly set undef' do + let :params do + { + :package_name => 'UNSET' + } + end + it 'should not manage postgresql-client package' do + is_expected.not_to contain_package('postgresql-client') + end + end end