(#11966) Change apt update to apt_update.
[puppet-modules/puppetlabs-apt.git] / spec / defines / conf_spec.rb
index 7c04db1c12883a53aa3b2a7e23e6c472723e10ba..5a81b5148c7d7bf489dabdef47012abe8d58a995 100644 (file)
@@ -23,7 +23,7 @@ describe 'apt::conf', :type => :define do
     }
 
     it { should contain_file(filename).with({
-          'ensure'    => 'file',
+          'ensure'    => 'present',
           'content'   => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n",
           'owner'     => 'root',
           'group'     => 'root',
@@ -31,4 +31,27 @@ describe 'apt::conf', :type => :define do
         })
       }
   end
+
+  describe "when removing an apt preference" do
+    let :params do
+      {
+        :ensure   => 'absent',
+        :priority => '00',
+        :content  => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n"
+      }
+    end
+
+    let :filename do
+      "/etc/apt/apt.conf.d/00norecommends"
+    end
+
+    it { should contain_file(filename).with({
+        'ensure'    => 'absent',
+        'content'   => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n",
+        'owner'     => 'root',
+        'group'     => 'root',
+        'mode'      => '0644',
+      })
+    }
+  end
 end