- describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do
-
- it {
- if [:present, 'present', :absent, 'absent'].include? param_hash[:ensure]
- should contain_apt__params
- end
- }
-
- it {
- if [:present, 'present'].include? param_hash[:ensure]
- should_not contain_exec("apt::key #{param_hash[:key]} absent")
- should contain_anchor("apt::key #{param_hash[:key]} present")
- should contain_exec(digest).with({
- "path" => "/bin:/usr/bin",
- "unless" => "/usr/bin/apt-key list | /bin/grep '#{param_hash[:key]}'"
- })
- elsif [:absent, 'absent'].include? param_hash[:ensure]
- should_not contain_anchor("apt::key #{param_hash[:key]} present")
- should contain_exec("apt::key #{param_hash[:key]} absent").with({
- "path" => "/bin:/usr/bin",
- "onlyif" => "apt-key list | grep '#{param_hash[:key]}'",
- "command" => "apt-key del '#{param_hash[:key]}'"
- })
- else
- expect { should raise_error(Puppet::Error) }
- end
- }
-
- it {
- if [:present, 'present'].include? param_hash[:ensure]
- if param_hash[:key_content]
- should contain_exec(digest).with({
- "command" => "echo '#{param_hash[:key_content]}' | /usr/bin/apt-key add -"
- })
- elsif param_hash[:key_source]
- should contain_exec(digest).with({
- "command" => "wget -q '#{param_hash[:key_source]}' -O- | apt-key add -"
- })
- elsif param_hash[:key_server]
- should contain_exec(digest).with({
- "command" => "apt-key adv --keyserver '#{param_hash[:key_server]}' --recv-keys '#{param_hash[:key]}'"
- })
- end
- end
- }