(MODULES-3307) - Auto update expired keys
[puppet-modules/puppetlabs-apt.git] / spec / unit / puppet / type / apt_key_spec.rb
index a25d8271e31886ac67c990295ae4189598130ef0..5b205e9924b3d749944b973a8c91cdd31a8d901e 100644 (file)
@@ -28,6 +28,10 @@ describe Puppet::Type.type(:apt_key) do
     it 'content is not set' do
       expect(resource[:content]).to eq nil
     end
+
+    it 'refresh is not set' do
+      expect(resource[:refresh]).to eq nil
+    end
   end
 
   context 'with a lowercase 32bit key id' do
@@ -138,6 +142,15 @@ describe Puppet::Type.type(:apt_key) do
       }.to raise_error(%r{content and source are mutually exclusive})
     end
 
+    it 'raises an error if refresh => true and ensure => absent' do
+      expect {
+        Puppet::Type.type(:apt_key).new(id:       'EF8D349F',
+                                        source:   'http://apt.puppetlabs.com/pubkey.gpg',
+                                        ensure:   :absent,
+                                        refresh:  :true)
+      }.to raise_error(%r{ensure => absent and refresh => true are mutually exclusive})
+    end
+
     it 'raises an error if a weird length key is used' do
       expect {
         Puppet::Type.type(:apt_key).new(id: 'FEF8D349F',