Merge pull request #353 from Smartesting/add-support-for-linuxmint-operatingsystem
[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 linux mint debian edition" do
75
76     let :facts do
77       {
78         'lsbdistcodename' => 'debian',
79         'lsbdistid'       => 'LinuxMint',
80       }
81     end
82
83     it { should contain_apt__source('backports').with({
84         'location'   => 'http://ftp.debian.org/debian/',
85         'release'    => 'wheezy-backports',
86         'repos'      => 'main contrib non-free',
87         'key'        => '46925553',
88         'key_server' => 'pgp.mit.edu',
89         'pin'        => 200,
90       })
91     }
92   end
93
94   describe "when turning on backports for linux mint 17 (ubuntu-based)" do
95
96     let :facts do
97       {
98         'lsbdistcodename' => 'qiana',
99         'lsbdistid'       => 'LinuxMint',
100       }
101     end
102
103     it { should contain_apt__source('backports').with({
104         'location'   => 'http://us.archive.ubuntu.com/ubuntu',
105         'release'    => 'trusty-backports',
106         'repos'      => 'main universe multiverse restricted',
107         'key'        => '437D05B5',
108         'key_server' => 'pgp.mit.edu',
109         'pin'        => 200,
110       })
111     }
112   end
113
114   describe "when turning on backports for debian squeeze but using your own mirror" do
115
116     let :facts do
117       {
118         'lsbdistcodename' => 'Squeeze',
119         'lsbdistid'       => 'Debian'
120       }
121     end
122
123     let :location do
124       'http://mirrors.example.com/debian-backports'
125     end
126
127     let :params do
128       { 'location' => location }
129     end
130
131     it { should contain_apt__source('backports').with({
132         'location'   => location,
133         'release'    => 'squeeze-backports',
134         'repos'      => 'main contrib non-free',
135         'key'        => '46925553',
136         'key_server' => 'pgp.mit.edu',
137         'pin'        => 200,
138       })
139     }
140   end
141 end