newer pg module
[mirror/dsa-puppet.git] / 3rdparty / modules / postgresql / spec / unit / classes / client_spec.rb
1 require 'spec_helper'
2
3 describe 'postgresql::client', :type => :class do
4   let :facts do
5     {
6       :osfamily => 'Debian',
7       :operatingsystem => 'Debian',
8       :operatingsystemrelease => '6.0',
9     }
10   end
11
12   describe 'with parameters' do
13     let :params do
14       {
15         :validcon_script_path  => '/opt/bin/my-validate-con.sh',
16         :package_ensure => 'absent',
17         :package_name   => 'mypackage',
18         :file_ensure    => 'file'
19       }
20     end
21
22     it 'should modify package' do
23       is_expected.to contain_package("postgresql-client").with({
24         :ensure => 'absent',
25         :name => 'mypackage',
26         :tag => 'postgresql',
27       })
28     end
29
30     it 'should have specified validate connexion' do
31       should contain_file('/opt/bin/my-validate-con.sh').with({
32         :ensure => 'file',
33         :owner  => 0,
34         :group  => 0,
35         :mode   => '0755'
36       })
37     end
38   end
39
40   describe 'with no parameters' do
41     it 'should create package with postgresql tag' do
42       is_expected.to contain_package('postgresql-client').with({
43         :tag => 'postgresql',
44       })
45     end
46   end
47
48   describe 'with client package name explicitly set undef' do
49     let :params do
50       {
51         :package_name => 'UNSET'
52       }
53     end
54     it 'should not manage postgresql-client package' do
55       is_expected.not_to contain_package('postgresql-client')
56     end
57   end
58 end