X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fclasses%2Fapt_backports_spec.rb;h=1dfbf3759d61868aa53c75e10f24950b9d6d63d6;hb=7ddd7fd53f0292535928afbf9d90257702a1aff5;hp=200d6f1333ed8fb50809249b4bbe82c2cb7a9c76;hpb=55a17ac5916110ad996e85af05a18fbdf21a90d5;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/classes/apt_backports_spec.rb b/spec/classes/apt_backports_spec.rb index 200d6f1..1dfbf37 100644 --- a/spec/classes/apt_backports_spec.rb +++ b/spec/classes/apt_backports_spec.rb @@ -7,46 +7,50 @@ describe 'apt::backports', :type => :class do context 'defaults on deb' do let(:facts) do { + :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }}, :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end it { is_expected.to contain_apt__source('backports').with({ - :location => 'http://ftp.debian.org/debian/', + :location => 'http://httpredir.debian.org/debian', :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553', :repos => 'main contrib non-free', :release => 'wheezy-backports', - :pin => 200, + :pin => { 'priority' => 200, 'release' => 'wheezy-backports' }, }) } end context 'defaults on squeeze' do let(:facts) do { + :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '6', :full => '6.0' }}, :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'squeeze', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end it { is_expected.to contain_apt__source('backports').with({ - :location => 'http://backports.debian.org/debian-backports', + :location => 'http://httpredir.debian.org/debian-backports', :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553', :repos => 'main contrib non-free', :release => 'squeeze-backports', - :pin => 200, + :pin => { 'priority' => 200, 'release' => 'squeeze-backports' }, }) } end context 'defaults on ubuntu' do let(:facts) do { + :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }}, :lsbdistid => 'Ubuntu', :osfamily => 'Debian', :lsbdistcodename => 'trusty', - :puppetversion => '3.5.0', + :lsbdistrelease => '14.04', + :puppetversion => Puppet.version, } end it { is_expected.to contain_apt__source('backports').with({ @@ -54,17 +58,19 @@ describe 'apt::backports', :type => :class do :key => '630239CC130E1A7FD81A27B140976EAF437D05B5', :repos => 'main universe multiverse restricted', :release => 'trusty-backports', - :pin => 200, + :pin => { 'priority' => 200, 'release' => 'trusty-backports' }, }) } end context 'set everything' do let(:facts) do { + :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }}, :lsbdistid => 'Ubuntu', :osfamily => 'Debian', :lsbdistcodename => 'trusty', - :puppetversion => '3.5.0', + :lsbdistrelease => '14.04', + :puppetversion => Puppet.version, } end let(:params) do @@ -81,17 +87,19 @@ describe 'apt::backports', :type => :class do :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553', :repos => 'main', :release => 'vivid', - :pin => 90, + :pin => { 'priority' => 90, 'release' => 'vivid' }, }) } end context 'set things with hashes' do let(:facts) do { + :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }}, :lsbdistid => 'Ubuntu', :osfamily => 'Debian', :lsbdistcodename => 'trusty', - :puppetversion => '3.5.0', + :lsbdistrelease => '14.04', + :puppetversion => Puppet.version, } end let(:params) do @@ -114,10 +122,11 @@ describe 'apt::backports', :type => :class do describe 'mint tests' do let(:facts) do { + :os => { :family => 'Debian', :name => 'Linuxmint', :release => { :major => '17', :full => '17' }}, :lsbdistid => 'linuxmint', :osfamily => 'Debian', :lsbdistcodename => 'qiana', - :puppetversion => '3.5.0', + :puppetversion => Puppet.version, } end context 'sets all the needed things' do @@ -134,7 +143,7 @@ describe 'apt::backports', :type => :class do :key => '630239CC130E1A7FD81A27B140976EAF437D05B5', :repos => 'main universe multiverse restricted', :release => 'trusty-backports', - :pin => 200, + :pin => { 'priority' => 200, 'release' => 'trusty-backports' }, }) } end @@ -198,10 +207,12 @@ describe 'apt::backports', :type => :class do describe 'validation' do let(:facts) do { + :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }}, :lsbdistid => 'Ubuntu', :osfamily => 'Debian', :lsbdistcodename => 'trusty', - :puppetversion => '3.5.0', + :lsbdistrelease => '14.04', + :puppetversion => Puppet.version, } end context 'invalid location' do @@ -213,7 +224,7 @@ describe 'apt::backports', :type => :class do it do expect { subject.call - }.to raise_error(Puppet::Error, /is not a string/) + }.to raise_error(Puppet::Error, /expects a/) end end context 'invalid release' do @@ -225,7 +236,7 @@ describe 'apt::backports', :type => :class do it do expect { subject.call - }.to raise_error(Puppet::Error, /is not a string/) + }.to raise_error(Puppet::Error, /expects a/) end end context 'invalid repos' do @@ -237,7 +248,7 @@ describe 'apt::backports', :type => :class do it do expect { subject.call - }.to raise_error(Puppet::Error, /is not a string/) + }.to raise_error(Puppet::Error, /expects a/) end end context 'invalid key' do @@ -249,7 +260,7 @@ describe 'apt::backports', :type => :class do it do expect { subject.call - }.to raise_error(Puppet::Error, /is not a string/) + }.to raise_error(Puppet::Error, /expects a/) end end context 'invalid pin' do @@ -261,7 +272,7 @@ describe 'apt::backports', :type => :class do it do expect { subject.call - }.to raise_error(Puppet::Error, /pin must be either a string, number or hash/) + }.to raise_error(Puppet::Error, /expects a/) end end end