X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Facceptance%2Fbackports_spec.rb;h=78f21fd588a86ea13e343bc0709b08a69925fe21;hb=33584fd238103657b5e99a796d132a53b44cf97f;hp=ffb14ce62854b99719087368463e22348f630f55;hpb=c2f0ed219e23ccc3faaf2512082240102921e4a9;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/acceptance/backports_spec.rb b/spec/acceptance/backports_spec.rb index ffb14ce..78f21fd 100644 --- a/spec/acceptance/backports_spec.rb +++ b/spec/acceptance/backports_spec.rb @@ -1,6 +1,14 @@ require 'spec_helper_acceptance' -describe 'apt::backports class' do +codename = fact('lsbdistcodename') +case fact('operatingsystem') +when 'Ubuntu' + repos = 'main universe multiverse restricted' +when 'Debian' + repos = 'main contrib non-free' +end + +describe 'apt::backports class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do context 'defaults' do it 'should work with no errors' do pp = <<-EOS @@ -14,7 +22,7 @@ describe 'apt::backports class' do context 'release' do it 'should work with no errors' do pp = <<-EOS - class { 'apt::backports': release => 'precise' } + class { 'apt::backports': release => '#{codename}' } EOS apply_manifest(pp, :catch_failures => true) @@ -22,7 +30,7 @@ describe 'apt::backports class' do describe file('/etc/apt/sources.list.d/backports.list') do it { should be_file } - it { should contain 'precise-backports main universe multiverse restricted' } + it { should contain "#{codename}-backports #{repos}" } end end @@ -37,7 +45,21 @@ describe 'apt::backports class' do describe file('/etc/apt/sources.list.d/backports.list') do it { should be_file } - it { should contain 'deb http://localhost/ubuntu precise-backports main universe multiverse restricted' } + it { should contain "deb http://localhost/ubuntu precise-backports #{repos}" } + end + end + + context 'pin_priority' do + it 'should work with no errors' do + pp = <<-EOS + class { 'apt::backports': pin_priority => 500, } + EOS + + apply_manifest(pp, :catch_failures => true) + end + describe file('/etc/apt/preferences.d/backports.pref') do + it { should be_file } + it { should contain "Pin-Priority: 500" } end end