(#11966) Only invoke apt-get update once.
[puppet-modules/puppetlabs-apt.git] / spec / classes / apt_spec.rb
index 000793d092783a3740be5cca53e4518bd2fe819a..4d44bcc78c726f528c324921882e5362e186de4e 100644 (file)
@@ -72,7 +72,8 @@ describe 'apt', :type => :class do
             'owner'   => "root",
             'group'   => "root",
             'purge'   => true,
-            'recurse' => true
+            'recurse' => true,
+            'notify'  => 'Exec[apt update]'
           })
         else
           should create_file("sources.list.d").with({
@@ -81,15 +82,15 @@ describe 'apt', :type => :class do
             'owner'   => "root",
             'group'   => "root",
             'purge'   => false,
-            'recurse' => false
+            'recurse' => false,
+            'notify'  => 'Exec[apt update]'
           })
         end
       }
 
       it {
-        should contain_exec("apt_update").with({
+        should contain_exec("apt update").with({
           'command'     => "/usr/bin/apt-get update",
-          'subscribe'   => ["File[sources.list]", "File[sources.list.d]"],
           'refreshonly' => refresh_only_apt_update
         })
       }
@@ -117,7 +118,8 @@ describe 'apt', :type => :class do
           if param_hash[:proxy_host]
             should contain_file('configure-apt-proxy').with(
               'path'    => '/etc/apt/apt.conf.d/proxy',
-              'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";"
+              'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";",
+              'notify'  => "Exec[apt update]"
             )
           else
             should_not contain_file('configure_apt_proxy')