source: src/puppetcode/environments/test/modules/apt/spec/defines/conf_spec.rb@ 9160ba0

0.5 app-cordova debian/bullseye debian/jessie
Last change on this file since 9160ba0 was 1c22429, checked in by Joachim Langenbach <joachim.langenbach@…>, 10 years ago
  • gnuboat_epd adds the apt repository from gnuboat to install epd-fuse package
  • Property mode set to 100644
File size: 2.0 KB
Line 
1require 'spec_helper'
2describe 'apt::conf', :type => :define do
3 let :pre_condition do
4 'class { "apt": }'
5 end
6 let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version, } }
7 let :title do
8 'norecommends'
9 end
10
11 describe "when creating an apt preference" do
12 let :default_params do
13 {
14 :priority => '00',
15 :content => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n"
16 }
17 end
18 let :params do
19 default_params
20 end
21
22 let :filename do
23 "/etc/apt/apt.conf.d/00norecommends"
24 end
25
26 it { is_expected.to contain_file(filename).with({
27 'ensure' => 'present',
28 'content' => /Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;/,
29 'owner' => 'root',
30 'group' => 'root',
31 'mode' => '0644',
32 })
33 }
34
35 context "with notify_update = true (default)" do
36 let :params do
37 default_params
38 end
39 it { is_expected.to contain_apt__setting("conf-#{title}").with_notify_update(true) }
40 end
41
42 context "with notify_update = false" do
43 let :params do
44 default_params.merge({
45 :notify_update => false
46 })
47 end
48 it { is_expected.to contain_apt__setting("conf-#{title}").with_notify_update(false) }
49 end
50 end
51
52 describe "when creating a preference without content" do
53 let :params do
54 {
55 :priority => '00',
56 }
57 end
58
59 it 'fails' do
60 expect { subject.call } .to raise_error(/pass in content/)
61 end
62 end
63
64 describe "when removing an apt preference" do
65 let :params do
66 {
67 :ensure => 'absent',
68 :priority => '00',
69 }
70 end
71
72 let :filename do
73 "/etc/apt/apt.conf.d/00norecommends"
74 end
75
76 it { is_expected.to contain_file(filename).with({
77 'ensure' => 'absent',
78 'owner' => 'root',
79 'group' => 'root',
80 'mode' => '0644',
81 })
82 }
83 end
84end
Note: See TracBrowser for help on using the repository browser.