Improve apt::force tests and ensure cleanup happens consistently.
[puppet-modules/puppetlabs-apt.git] / spec / acceptance / backports_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'apt::backports class' do
4   context 'defaults' do
5     it 'should work with no errors' do
6       pp = <<-EOS
7       class { 'apt::backports': }
8       EOS
9
10       apply_manifest(pp, :catch_failures => true)
11     end
12   end
13
14   context 'release' do
15     it 'should work with no errors' do
16       pp = <<-EOS
17       class { 'apt::backports': release => 'precise' }
18       EOS
19
20       apply_manifest(pp, :catch_failures => true)
21     end
22
23     describe file('/etc/apt/sources.list.d/backports.list') do
24       it { should be_file }
25       it { should contain 'precise-backports main universe multiverse restricted' }
26     end
27   end
28
29   context 'location' do
30     it 'should work with no errors' do
31       pp = <<-EOS
32       class { 'apt::backports': release => 'precise', location => 'http://localhost/ubuntu' }
33       EOS
34
35       apply_manifest(pp, :catch_failures => true)
36     end
37
38     describe file('/etc/apt/sources.list.d/backports.list') do
39       it { should be_file }
40       it { should contain 'deb http://localhost/ubuntu precise-backports main universe multiverse restricted' }
41     end
42   end
43
44   context 'reset' do
45     it 'deletes backport files' do
46       shell('rm -rf /etc/apt/sources.list.d/backports.list')
47       shell('rm -rf /etc/apt/preferences.d/backports.pref')
48     end
49   end
50
51 end