X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fdefines%2Fkey_spec.rb;h=1f878c3e8c65fafc5f78200e1c93da282bed0e2d;hb=6cb399a281d9f07ee29508cbc2ec4c8cabfe3fa7;hp=6725dc8f25e9533268a53639c3e7d8b1ad70eab7;hpb=cf7271d7e60aca6ea265bda55fd99b80b1845186;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/defines/key_spec.rb b/spec/defines/key_spec.rb index 6725dc8..1f878c3 100644 --- a/spec/defines/key_spec.rb +++ b/spec/defines/key_spec.rb @@ -5,9 +5,15 @@ describe 'apt::key' do 'class { "apt": }' end - let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy' } } + let(:facts) { { + :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }}, + :lsbdistid => 'Debian', + :osfamily => 'Debian', + :lsbdistcodename => 'wheezy', + :puppetversion => Puppet.version, + } } - GPG_KEY_ID = '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30' + GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F' let :title do GPG_KEY_ID @@ -245,7 +251,7 @@ describe 'apt::key' do :content => [], } end it 'fails' do - expect { subject.call }.to raise_error(/is not a string/) + expect { subject.call }.to raise_error(/expects a String value/) end end @@ -263,18 +269,20 @@ describe 'apt::key' do :options => {}, } end it 'fails' do - expect { subject.call }.to raise_error(/is not a string/) + expect { subject.call }.to raise_error(/expects a String value/) end end context 'invalid ensure' do - let :params do - { - :ensure => 'foo', - } - end - it 'fails' do - expect { subject.call }.to raise_error(/does not match/) + %w(foo aabsent absenta apresent presenta).each do |param| + let :params do + { + :ensure => param, + } + end + it 'fails' do + expect { subject.call }.to raise_error(/for Enum\['absent', 'present'\], got/) + end end end