Merge branch '1.4.x' into 14x-merge
[puppet-modules/puppetlabs-apt.git] / spec / classes / apt_spec.rb
index 0da7d32db03088751687508d60e594e4f2843619..a21e0443e2df715b221e712d9457607d26117611 100644 (file)
@@ -1,6 +1,6 @@
 require 'spec_helper'
 describe 'apt', :type => :class do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   let :default_params do
     {
       :disable_keys => :undef,
@@ -93,22 +93,11 @@ describe 'apt', :type => :class do
       it {
         if param_hash[:purge_preferences]
           should create_file('apt-preferences').with({
-            :ensure  => 'present',
+            :ensure  => 'absent',
             :path    => '/etc/apt/preferences',
-            :owner   => 'root',
-            :group   => 'root',
-            :mode    => '0644',
-            :content => /Explanation/,
           })
         else
-          should create_file('apt-preferences').with({
-            :ensure  => 'present',
-            :path    => '/etc/apt/preferences',
-            :owner   => 'root',
-            :group   => 'root',
-            :mode    => '0644',
-            :content => nil,
-          })
+          should_not contain_file('apt-preferences')
         end
       }
 
@@ -162,14 +151,14 @@ describe 'apt', :type => :class do
       describe 'when setting a proxy' do
         it {
           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]}\";",
+            should contain_file('01proxy').with(
+              'path'    => '/etc/apt/apt.conf.d/01proxy',
+              'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";\n",
               'notify'  => "Exec[apt_update]"
             )
           else
-            should contain_file('configure-apt-proxy').with(
-              'path'    => '/etc/apt/apt.conf.d/proxy',
+            should contain_file('01proxy').with(
+              'path'    => '/etc/apt/apt.conf.d/01proxy',
               'notify'  => 'Exec[apt_update]',
               'ensure'  => 'absent'
             )