Merge pull request #226 from mark0n/master
[puppet-modules/puppetlabs-apt.git] / spec / defines / conf_spec.rb
1 require 'spec_helper'
2 describe 'apt::conf', :type => :define do
3   let(:facts) { { :lsbdistid => 'Debian' } }
4   let :title do
5     'norecommends'
6   end
7
8   describe "when creating an apt preference" do
9     let :params do
10       {
11         :priority => '00',
12         :content  => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n"
13       }
14     end
15
16     let :filename do
17       "/etc/apt/apt.conf.d/00norecommends"
18     end
19
20     it { should contain_apt__conf('norecommends').with({
21          'priority' => '00',
22          'content'  => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n"
23       })
24     }
25
26     it { should contain_file(filename).with({
27           'ensure'    => 'present',
28           'content'   => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n",
29           'owner'     => 'root',
30           'group'     => 'root',
31           'mode'      => '0644',
32         })
33       }
34   end
35
36   describe "when removing an apt preference" do
37     let :params do
38       {
39         :ensure   => 'absent',
40         :priority => '00',
41         :content  => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n"
42       }
43     end
44
45     let :filename do
46       "/etc/apt/apt.conf.d/00norecommends"
47     end
48
49     it { should contain_file(filename).with({
50         'ensure'    => 'absent',
51         'content'   => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n",
52         'owner'     => 'root',
53         'group'     => 'root',
54         'mode'      => '0644',
55       })
56     }
57   end
58 end