X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fdefines%2Fpin_spec.rb;h=50890fcf6b8be39d4fa8991dbe8285be2e2bd561;hb=bd3b3fbe990bfa824ebed3504c0c82175d7c7ec9;hp=1421d68fbdefc96c05b968a71e57e3ed197e30bd;hpb=e588ab622b042855b214c2e25bc6fe4a2b4fb650;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/defines/pin_spec.rb b/spec/defines/pin_spec.rb index 1421d68..50890fc 100644 --- a/spec/defines/pin_spec.rb +++ b/spec/defines/pin_spec.rb @@ -3,31 +3,27 @@ describe 'apt::pin', :type => :define do let :pre_condition do 'class { "apt": }' end - let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } } + let(:facts) { { + :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }}, + :lsbdistid => 'Debian', + :osfamily => 'Debian', + :lsbdistcodename => 'wheezy', + :puppetversion => Puppet.version, + } } let(:title) { 'my_pin' } context 'defaults' do it { is_expected.to contain_apt__setting("pref-my_pin").with_content(/Explanation: : my_pin\nPackage: \*\nPin: release a=my_pin\nPin-Priority: 0\n/)} - it { is_expected.to contain_apt__setting("pref-my_pin").with({ - 'setting_type' => 'pref', - 'base_name' => 'my_pin', - }) - } end context 'set version' do let :params do { 'packages' => 'vim', - 'version' => '1', + 'version' => "1", } end it { is_expected.to contain_apt__setting("pref-my_pin").with_content(/Explanation: : my_pin\nPackage: vim\nPin: version 1\nPin-Priority: 0\n/)} - it { is_expected.to contain_apt__setting("pref-my_pin").with({ - 'setting_type' => 'pref', - 'base_name' => 'my_pin', - }) - } end context 'set origin' do @@ -38,11 +34,6 @@ describe 'apt::pin', :type => :define do } end it { is_expected.to contain_apt__setting("pref-my_pin").with_content(/Explanation: : my_pin\nPackage: vim\nPin: origin test\nPin-Priority: 0\n/)} - it { is_expected.to contain_apt__setting("pref-my_pin").with({ - 'setting_type' => 'pref', - 'base_name' => 'my_pin', - }) - } end context 'not defaults' do @@ -61,8 +52,6 @@ describe 'apt::pin', :type => :define do end it { is_expected.to contain_apt__setting("pref-my_pin").with_content(/Explanation: foo\nPackage: \*\nPin: release a=1, n=bar, v=2, c=baz, o=foobar, l=foobaz\nPin-Priority: 10\n/) } it { is_expected.to contain_apt__setting("pref-my_pin").with({ - 'setting_type' => 'pref', - 'base_name' => 'my_pin', 'priority' => 99, }) } @@ -94,8 +83,8 @@ describe 'apt::pin', :type => :define do end it do expect { - is_expected.to compile - }.to raise_error(Puppet::Error, /Only integers are allowed/) + subject.call + }.to raise_error(Puppet::Error, /expects an Integer value, got String/) end end @@ -107,7 +96,7 @@ describe 'apt::pin', :type => :define do end it do expect { - is_expected.to compile + subject.call }.to raise_error(Puppet::Error, /parameter version cannot be used in general form/) end end @@ -121,7 +110,7 @@ describe 'apt::pin', :type => :define do end it do expect { - is_expected.to compile + subject.call }.to raise_error(Puppet::Error, /parameters release and origin are mutually exclusive/) end end @@ -136,7 +125,7 @@ describe 'apt::pin', :type => :define do end it do expect { - is_expected.to compile + subject.call }.to raise_error(Puppet::Error, /parameters release, origin, and version are mutually exclusive/) end end @@ -151,7 +140,7 @@ describe 'apt::pin', :type => :define do end it do expect { - is_expected.to compile + subject.call }.to raise_error(Puppet::Error, /parameters release, origin, and version are mutually exclusive/) end end