(MODULES-1200) Fix inconsistent header across files
[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_file(filename).with({
21           'ensure'    => 'present',
22           'content'   => /Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;/,
23           'owner'     => 'root',
24           'group'     => 'root',
25           'mode'      => '0644',
26         })
27       }
28   end
29
30   describe "when removing an apt preference" do
31     let :params do
32       {
33         :ensure   => 'absent',
34         :priority => '00',
35         :content  => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n"
36       }
37     end
38
39     let :filename do
40       "/etc/apt/apt.conf.d/00norecommends"
41     end
42
43     it { should contain_file(filename).with({
44         'ensure'    => 'absent',
45         'content'   => /Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;/,
46         'owner'     => 'root',
47         'group'     => 'root',
48         'mode'      => '0644',
49       })
50     }
51   end
52 end