newer pg module
[mirror/dsa-puppet.git] / 3rdparty / modules / postgresql / spec / unit / classes / globals_spec.rb
1 require 'spec_helper'
2
3 describe 'postgresql::globals', type: :class do
4   context 'on a debian 6' do
5     let (:facts) do
6       {
7         :os => {
8           :family               => 'Debian',
9           :name                 => 'Debian',
10           :release => {
11             :full => '6.0'
12           }
13         },
14         :osfamily               => 'Debian',
15         :operatingsystem        => 'Debian',
16         :operatingsystemrelease => '6.0',
17         :lsbdistid              => 'Debian',
18         :lsbdistcodename        => 'squeeze'
19       }
20     end
21
22     describe 'with no parameters' do
23       it 'should work' do
24         is_expected.to contain_class('postgresql::globals')
25       end
26     end
27
28     describe 'manage_package_repo => true' do
29       let(:params) do
30         {
31           manage_package_repo: true
32         }
33       end
34       it 'should pull in class postgresql::repo' do
35         is_expected.to contain_class('postgresql::repo')
36       end
37     end
38   end
39
40   context 'on redhat family systems' do
41     let (:facts) do
42       {
43         osfamily: 'RedHat',
44         operatingsystem: 'RedHat',
45         operatingsystemrelease: '7.1'
46       }
47     end
48     describe 'with no parameters' do
49       it 'should work' do
50         is_expected.to contain_class('postgresql::globals')
51       end
52     end
53
54     describe 'manage_package_repo on RHEL => true' do
55       let(:params) do
56         {
57           manage_package_repo: true,
58           repo_proxy: 'http://proxy-server:8080'
59         }
60       end
61
62       it 'should pull in class postgresql::repo' do
63         is_expected.to contain_class('postgresql::repo')
64       end
65
66       it do
67         should contain_yumrepo('yum.postgresql.org').with(
68           'enabled' => '1',
69           'proxy'   => 'http://proxy-server:8080'
70           )
71       end
72     end
73
74     describe 'repo_baseurl on RHEL => mirror.localrepo.com' do
75       let(:params) do
76         {
77           manage_package_repo: true,
78           repo_baseurl: 'http://mirror.localrepo.com'
79         }
80       end
81
82       it 'should pull in class postgresql::repo' do
83         is_expected.to contain_class('postgresql::repo')
84       end
85
86       it do
87         should contain_yumrepo('yum.postgresql.org').with(
88           'enabled' => '1',
89           'baseurl' => 'http://mirror.localrepo.com'
90         )
91       end
92     end
93   end
94 end