+ it {
+ is_expected.to contain_file('sources.list').with(content: nil)
+ }
+
+ it {
+ is_expected.to contain_file('sources.list.d').with(purge: false,
+ recurse: false)
+ }
+
+ it {
+ is_expected.to contain_file('preferences').with(ensure: 'file')
+ }
+
+ it {
+ is_expected.to contain_file('preferences.d').with(purge: false,
+ recurse: false)
+ }
+
+ it {
+ is_expected.to contain_exec('apt_update').with(refreshonly: false,
+ timeout: 1,
+ tries: 3)
+ }
+ end
+
+ context 'with sources defined on valid osfamily' do
+ let :facts do
+ { os: { family: 'Debian', name: 'Ubuntu', release: { major: '12', full: '12.04' } },
+ osfamily: 'Debian',
+ lsbdistcodename: 'precise',
+ lsbdistid: 'Ubuntu',
+ lsbdistrelease: '12.04',
+ puppetversion: Puppet.version }
+ end
+ let(:params) do
+ { sources: {
+ 'debian_unstable' => {
+ 'location' => 'http://debian.mirror.iweb.ca/debian/',
+ 'release' => 'unstable',
+ 'repos' => 'main contrib non-free',
+ 'key' => { 'id' => '150C8614919D8446E01E83AF9AA38DCD55BE302B', 'server' => 'subkeys.pgp.net' },
+ 'pin' => '-10',
+ 'include' => { 'src' => true },
+ },
+ 'puppetlabs' => {
+ 'location' => 'http://apt.puppetlabs.com',
+ 'repos' => 'main',
+ 'key' => { 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', 'server' => 'pgp.mit.edu' },
+ },
+ } }
+ end
+
+ it {
+ is_expected.to contain_apt__setting('list-debian_unstable').with(ensure: 'present')
+ }
+
+ it { is_expected.to contain_file('/etc/apt/sources.list.d/debian_unstable.list').with_content(/^deb http:\/\/debian.mirror.iweb.ca\/debian\/ unstable main contrib non-free$/) }
+ it { is_expected.to contain_file('/etc/apt/sources.list.d/debian_unstable.list').with_content(/^deb-src http:\/\/debian.mirror.iweb.ca\/debian\/ unstable main contrib non-free$/) }
+
+ it {
+ is_expected.to contain_apt__setting('list-puppetlabs').with(ensure: 'present')
+ }
+
+ it { is_expected.to contain_file('/etc/apt/sources.list.d/puppetlabs.list').with_content(/^deb http:\/\/apt.puppetlabs.com precise main$/) }
+ end
+
+ context 'with confs defined on valid osfamily' do
+ let :facts do
+ {
+ os: { family: 'Debian', name: 'Ubuntu', release: { major: '12', full: '12.04.5' } },
+ osfamily: 'Debian',
+ lsbdistcodename: 'precise',
+ lsbdistid: 'Debian',
+ puppetversion: Puppet.version,