Merge pull request #239 from hunner/fix_builddep
[puppet-modules/puppetlabs-apt.git] / spec / acceptance / conf_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'apt::conf define' do
4   context 'defaults' do
5     it 'should work with no errors' do
6       pp = <<-EOS
7       apt::conf { 'test':
8         content => 'test',
9       }
10       EOS
11
12       apply_manifest(pp, :catch_failures => true)
13     end
14
15     describe file('/etc/apt/apt.conf.d/50test') do
16       it { should be_file }
17       it { should contain 'test' }
18     end
19   end
20
21   context 'ensure' do
22     context 'absent' do
23       it 'should work with no errors' do
24         pp = <<-EOS
25         apt::conf { 'test':
26           ensure  => absent,
27           content => 'test',
28         }
29         EOS
30
31         apply_manifest(pp, :catch_failures => true)
32       end
33
34       describe file('/etc/apt/apt.conf.d/50test') do
35         it { should_not be_file }
36       end
37     end
38   end
39
40   context 'priority' do
41     context '99' do
42       it 'should work with no errors' do
43         pp = <<-EOS
44         apt::conf { 'test':
45           ensure   => present,
46           content  => 'test',
47           priority => '99',
48         }
49         EOS
50
51         apply_manifest(pp, :catch_failures => true)
52       end
53
54       describe file('/etc/apt/apt.conf.d/99test') do
55         it { should be_file }
56         it { should contain 'test' }
57       end
58     end
59   end
60
61   context 'cleanup' do
62     it 'deletes 99test' do
63       shell ('rm -rf /etc/apt/apt.conf.d/99test')
64     end
65   end
66 end