Pin rspec gems
[puppet-modules/puppetlabs-apt.git] / spec / classes / backports_spec.rb
1 require 'spec_helper'
2 describe 'apt::backports', :type => :class do
3
4   describe 'when asigning a custom priority to backports' do
5     let :facts do
6       {
7         'lsbdistcodename' => 'Karmic',
8         'lsbdistid'       => 'Ubuntu',
9         'osfamily'        => 'Debian'
10       }
11     end
12
13     context 'integer priority' do
14       let :params do { :pin_priority => 500 } end
15
16       it { should contain_apt__source('backports').with({
17           'location'   => 'http://old-releases.ubuntu.com/ubuntu',
18           'release'    => 'karmic-backports',
19           'repos'      => 'main universe multiverse restricted',
20           'key'        => '437D05B5',
21           'key_server' => 'pgp.mit.edu',
22           'pin'        => 500,
23         })
24       }
25     end
26
27     context 'invalid priority' do
28       let :params do { :pin_priority => 'banana' } end
29       it 'should fail' do
30         expect { subject }.to raise_error(/must be an integer/)
31       end
32     end
33   end
34
35   describe 'when turning on backports for ubuntu karmic' do
36
37     let :facts do
38       {
39         'lsbdistcodename' => 'Karmic',
40         'lsbdistid'       => 'Ubuntu',
41         'osfamily'        => 'Debian'
42       }
43     end
44
45     it { should contain_apt__source('backports').with({
46         'location'   => 'http://old-releases.ubuntu.com/ubuntu',
47         'release'    => 'karmic-backports',
48         'repos'      => 'main universe multiverse restricted',
49         'key'        => '437D05B5',
50         'key_server' => 'pgp.mit.edu',
51         'pin'        => 200,
52       })
53     }
54   end
55
56   describe "when turning on backports for debian squeeze" do
57
58     let :facts do
59       {
60         'lsbdistcodename' => 'Squeeze',
61         'lsbdistid'       => 'Debian',
62         'osfamily'        => 'Debian'
63       }
64     end
65
66     it { should contain_apt__source('backports').with({
67         'location'   => 'http://backports.debian.org/debian-backports',
68         'release'    => 'squeeze-backports',
69         'repos'      => 'main contrib non-free',
70         'key'        => '46925553',
71         'key_server' => 'pgp.mit.edu',
72         'pin'        => 200,
73       })
74     }
75   end
76
77   describe "when turning on backports for linux mint debian edition" do
78
79     let :facts do
80       {
81         'lsbdistcodename' => 'debian',
82         'lsbdistid'       => 'LinuxMint',
83         'osfamily'        => 'Debian'
84       }
85     end
86
87     it { should contain_apt__source('backports').with({
88         'location'   => 'http://ftp.debian.org/debian/',
89         'release'    => 'wheezy-backports',
90         'repos'      => 'main contrib non-free',
91         'key'        => '46925553',
92         'key_server' => 'pgp.mit.edu',
93         'pin'        => 200,
94       })
95     }
96   end
97
98   describe "when turning on backports for linux mint 17 (ubuntu-based)" do
99
100     let :facts do
101       {
102         'lsbdistcodename' => 'qiana',
103         'lsbdistid'       => 'LinuxMint',
104         'osfamily'        => 'Debian'
105       }
106     end
107
108     it { should contain_apt__source('backports').with({
109         'location'   => 'http://us.archive.ubuntu.com/ubuntu',
110         'release'    => 'trusty-backports',
111         'repos'      => 'main universe multiverse restricted',
112         'key'        => '437D05B5',
113         'key_server' => 'pgp.mit.edu',
114         'pin'        => 200,
115       })
116     }
117   end
118
119   describe "when turning on backports for debian squeeze but using your own mirror" do
120
121     let :facts do
122       {
123         'lsbdistcodename' => 'Squeeze',
124         'lsbdistid'       => 'Debian',
125         'osfamily'        => 'Debian'
126       }
127     end
128
129     let :location do
130       'http://mirrors.example.com/debian-backports'
131     end
132
133     let :params do
134       { 'location' => location }
135     end
136
137     it { should contain_apt__source('backports').with({
138         'location'   => location,
139         'release'    => 'squeeze-backports',
140         'repos'      => 'main contrib non-free',
141         'key'        => '46925553',
142         'key_server' => 'pgp.mit.edu',
143         'pin'        => 200,
144       })
145     }
146   end
147 end