Merge branch '1.4.x' into 14x-merge
[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       }
10     end
11
12     context 'integer priority' do
13       let :params do { :pin_priority => 500 } end
14
15       it { should contain_apt__source('backports').with({
16           'location'   => 'http://old-releases.ubuntu.com/ubuntu',
17           'release'    => 'karmic-backports',
18           'repos'      => 'main universe multiverse restricted',
19           'key'        => '437D05B5',
20           'key_server' => 'pgp.mit.edu',
21           'pin'        => 500,
22         })
23       }
24     end
25
26     context 'invalid priority' do
27       let :params do { :pin_priority => 'banana' } end
28       it 'should fail' do
29         expect { subject }.to raise_error(/must be an integer/)
30       end
31     end
32   end
33
34   describe 'when turning on backports for ubuntu karmic' do
35
36     let :facts do
37       {
38         'lsbdistcodename' => 'Karmic',
39         'lsbdistid'       => 'Ubuntu'
40       }
41     end
42
43     it { should contain_apt__source('backports').with({
44         'location'   => 'http://old-releases.ubuntu.com/ubuntu',
45         'release'    => 'karmic-backports',
46         'repos'      => 'main universe multiverse restricted',
47         'key'        => '437D05B5',
48         'key_server' => 'pgp.mit.edu',
49         'pin'        => 200,
50       })
51     }
52   end
53
54   describe "when turning on backports for debian squeeze" do
55
56     let :facts do
57       {
58         'lsbdistcodename' => 'Squeeze',
59         'lsbdistid'       => 'Debian',
60       }
61     end
62
63     it { should contain_apt__source('backports').with({
64         'location'   => 'http://backports.debian.org/debian-backports',
65         'release'    => 'squeeze-backports',
66         'repos'      => 'main contrib non-free',
67         'key'        => '46925553',
68         'key_server' => 'pgp.mit.edu',
69         'pin'        => 200,
70       })
71     }
72   end
73
74   describe "when turning on backports for debian squeeze but using your own mirror" do
75
76     let :facts do
77       {
78         'lsbdistcodename' => 'Squeeze',
79         'lsbdistid'       => 'Debian'
80       }
81     end
82
83     let :location do
84       'http://mirrors.example.com/debian-backports'
85     end
86
87     let :params do
88       { 'location' => location }
89     end
90
91     it { should contain_apt__source('backports').with({
92         'location'   => location,
93         'release'    => 'squeeze-backports',
94         'repos'      => 'main contrib non-free',
95         'key'        => '46925553',
96         'key_server' => 'pgp.mit.edu',
97         'pin'        => 200,
98       })
99     }
100   end
101 end