2 describe 'apt', :type => :class do
5 :disable_keys => false,
6 :always_apt_update => false
12 :disable_keys => true,
13 :always_apt_update => true
16 describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
18 default_params.merge(param_set)
25 let :refresh_only_apt_update do
26 if param_hash[:always_apt_update]
33 it { should include_class("apt::params") }
35 it { should contain_package("python-software-properties") }
38 should contain_file("sources.list").with({
39 'path' => "/etc/apt/sources.list",
40 'ensure' => "present",
48 should create_file("sources.list.d").with({
49 "path" => "/etc/apt/sources.list.d",
50 "ensure" => "directory",
57 should contain_exec("apt_update").with({
58 'command' => "/usr/bin/apt-get update",
59 'subscribe' => ["File[sources.list]", "File[sources.list.d]"],
60 'refreshonly' => refresh_only_apt_update
65 if param_hash[:disable_keys]
66 should contain_exec("make-apt-insecure").with({
67 'command' => '/bin/echo "APT::Get::AllowUnauthenticated 1;" >> /etc/apt/apt.conf.d/99unauth',
68 'creates' => '/etc/apt/apt.conf.d/99unauth'
71 should_not contain_exec("make-apt-insecure").with({
72 'command' => '/bin/echo "APT::Get::AllowUnauthenticated 1;" >> /etc/apt/apt.conf.d/99unauth',
73 'creates' => '/etc/apt/apt.conf.d/99unauth'