X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fclasses%2Fapt_backports_spec.rb;h=f2172d92a99396031c349062a70725e4eed2cbea;hb=e014fc04ed8358e4f7c2e87f7434df9817a4c7bb;hp=efaa9cc955ad965fff8eb64daca730d0129cae4a;hpb=48152d4a89f17a06ddae5ac5dba774bed8a8a887;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/classes/apt_backports_spec.rb b/spec/classes/apt_backports_spec.rb index efaa9cc..f2172d9 100644 --- a/spec/classes/apt_backports_spec.rb +++ b/spec/classes/apt_backports_spec.rb @@ -7,6 +7,7 @@ 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', @@ -14,38 +15,22 @@ describe 'apt::backports', :type => :class do } end it { is_expected.to contain_apt__source('backports').with({ - :location => 'http://ftp.debian.org/debian/', + :location => 'http://deb.debian.org/debian', :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553', :repos => 'main contrib non-free', :release => 'wheezy-backports', - :pin => 200, - }) - } - end - context 'defaults on squeeze' do - let(:facts) do - { - :lsbdistid => 'Debian', - :osfamily => 'Debian', - :lsbdistcodename => 'squeeze', - :puppetversion => Puppet.version, - } - end - it { is_expected.to contain_apt__source('backports').with({ - :location => 'http://backports.debian.org/debian-backports', - :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553', - :repos => 'main contrib non-free', - :release => 'squeeze-backports', - :pin => 200, + :pin => { 'priority' => 200, 'release' => 'wheezy-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', + :lsbdistrelease => '14.04', :puppetversion => Puppet.version, } end @@ -54,16 +39,18 @@ 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', + :lsbdistrelease => '14.04', :puppetversion => Puppet.version, } end @@ -81,16 +68,18 @@ 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', + :lsbdistrelease => '14.04', :puppetversion => Puppet.version, } end @@ -114,6 +103,7 @@ 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', @@ -134,7 +124,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,9 +188,11 @@ 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', + :lsbdistrelease => '14.04', :puppetversion => Puppet.version, } end @@ -213,7 +205,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 +217,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 +229,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 +241,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 +253,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