Add the FrozenStrings magic comment
[puppet-modules/puppetlabs-apt.git] / spec / defines / key_spec.rb
index cf596e996b901f71a37e59541be32998886367d8..14ea231230f87ff7e704206f85259c8da7f43ab4 100644 (file)
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'spec_helper'
 
 GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F'.freeze
@@ -15,7 +17,8 @@ def default_apt_key_example(title)
     source: nil,
     server: 'keyserver.ubuntu.com',
     content: nil,
-    options: nil }
+    options: nil,
+    refresh: false }
 end
 
 def bunch_things_apt_key_example(title, params)
@@ -47,7 +50,6 @@ describe 'apt::key' do
       lsbdistid: 'Debian',
       osfamily: 'Debian',
       lsbdistcodename: 'jessie',
-      puppetversion: Puppet.version,
     }
   end
 
@@ -379,4 +381,30 @@ describe 'apt::key' do
       end
     end
   end
+
+  describe 'defaults' do
+    context 'when setting keyserver on the apt class' do
+      let :pre_condition do
+        'class { "apt":
+          keyserver => "keyserver.example.com",
+        }'
+      end
+
+      it 'uses default keyserver' do
+        is_expected.to contain_apt_key(title).with_server('keyserver.example.com')
+      end
+    end
+
+    context 'when setting key_options on the apt class' do
+      let :pre_condition do
+        'class { "apt":
+          key_options => "http-proxy=http://proxy.example.com:8080",
+        }'
+      end
+
+      it 'uses default keyserver' do
+        is_expected.to contain_apt_key(title).with_options('http-proxy=http://proxy.example.com:8080')
+      end
+    end
+  end
 end