(MODULES-1200) Fix inconsistent header across files
[puppet-modules/puppetlabs-apt.git] / spec / defines / conf_spec.rb
index 7c04db1c12883a53aa3b2a7e23e6c472723e10ba..2c1752f074cb301741edc771a4ba3420bae950b0 100644 (file)
@@ -1,5 +1,6 @@
 require 'spec_helper'
 describe 'apt::conf', :type => :define do
+  let(:facts) { { :lsbdistid => 'Debian' } }
   let :title do
     'norecommends'
   end
@@ -16,19 +17,36 @@ describe 'apt::conf', :type => :define do
       "/etc/apt/apt.conf.d/00norecommends"
     end
 
-    it { should contain_apt__conf('norecommends').with({
-         'priority' => '00',
-         'content'  => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n"
-      })
-    }
-
     it { should contain_file(filename).with({
-          'ensure'    => 'file',
-          'content'   => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n",
+          'ensure'    => 'present',
+          'content'   => /Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;/,
           'owner'     => 'root',
           'group'     => 'root',
           'mode'      => '0644',
         })
       }
   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;/,
+        'owner'     => 'root',
+        'group'     => 'root',
+        'mode'      => '0644',
+      })
+    }
+  end
 end