- let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => Puppet.version} }
-
- context 'defaults' do
- it { is_expected.to contain_file('sources.list').that_notifies('Class[Apt::Update]').only_with({
- :ensure => 'file',
- :path => '/etc/apt/sources.list',
- :owner => 'root',
- :group => 'root',
- :mode => '0644',
- :notify => 'Class[Apt::Update]',
- })}
-
- it { is_expected.to contain_file('sources.list.d').that_notifies('Class[Apt::Update]').only_with({
- :ensure => 'directory',
- :path => '/etc/apt/sources.list.d',
- :owner => 'root',
- :group => 'root',
- :mode => '0644',
- :purge => false,
- :recurse => false,
- :notify => 'Class[Apt::Update]',
- })}
-
- it { is_expected.to contain_file('preferences').that_notifies('Class[Apt::Update]').only_with({
- :ensure => 'file',
- :path => '/etc/apt/preferences',
- :owner => 'root',
- :group => 'root',
- :mode => '0644',
- :notify => 'Class[Apt::Update]',
- })}
-
- it { is_expected.to contain_file('preferences.d').that_notifies('Class[Apt::Update]').only_with({
- :ensure => 'directory',
- :path => '/etc/apt/preferences.d',
- :owner => 'root',
- :group => 'root',
- :mode => '0644',
- :purge => false,
- :recurse => false,
- :notify => 'Class[Apt::Update]',
- })}
-
- it 'should lay down /etc/apt/apt.conf.d/15update-stamp' do
- is_expected.to contain_file('/etc/apt/apt.conf.d/15update-stamp').with({
- :group => 'root',
- :mode => '0644',
- :owner => 'root',
- }).with_content(/APT::Update::Post-Invoke-Success \{"touch \/var\/lib\/apt\/periodic\/update-success-stamp 2>\/dev\/null \|\| true";\};/)
+ let(:facts) do
+ {
+ os: { family: 'Debian', name: 'Debian', release: { major: '8', full: '8.0' } },
+ lsbdistid: 'Debian',
+ osfamily: 'Debian',
+ lsbdistcodename: 'wheezy',
+ puppetversion: Puppet.version,
+ }
+ end
+
+ context 'with defaults' do
+ it {
+ is_expected.to contain_file('sources.list').that_notifies('Class[Apt::Update]').only_with(sources_list)
+ }
+
+ it {
+ is_expected.to contain_file('sources.list.d').that_notifies('Class[Apt::Update]').only_with(sources_list_d)
+ }
+
+ it {
+ is_expected.to contain_file('preferences').that_notifies('Class[Apt::Update]').only_with(preferences)
+ }
+
+ it {
+ is_expected.to contain_file('preferences.d').that_notifies('Class[Apt::Update]').only_with(preferences_d)
+ }
+
+ it { is_expected.to contain_file('/etc/apt/auth.conf').with_ensure('absent') }
+
+ it 'lays down /etc/apt/apt.conf.d/15update-stamp' do
+ is_expected.to contain_file('/etc/apt/apt.conf.d/15update-stamp').with(group: 'root',
+ mode: '0644',
+ owner: 'root').with_content(
+ %r{APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};},
+ )