fixed test for changing aptitude to apt-get
[puppet-modules/puppetlabs-apt.git] / spec / defines / pin_spec.rb
index bfa0126030abdddde3f8802af4ed34f531b97056..3aaf49cef494e79f3b4fce0c2e2e02ba91d7915d 100644 (file)
@@ -5,6 +5,7 @@ describe 'apt::pin', :type => :define do
   let :default_params do
     {
       :ensure   => 'present',
+      :order    => '',
       :packages => '*',
       :priority => '0',
       :release  => nil
@@ -16,6 +17,11 @@ describe 'apt::pin', :type => :define do
       :packages  => 'apache',
       :priority  => '1'
     },
+    {
+      :order     => 50,
+      :packages  => 'apache',
+      :priority  => '1'
+    },
     {
       :ensure    => 'absent',
       :packages  => 'apache',
@@ -40,11 +46,11 @@ describe 'apt::pin', :type => :define do
 
       it { should contain_file("#{title}.pref").with({
           'ensure'  => param_hash[:ensure],
-          'path'    => "/etc/apt/preferences.d/#{title}.pref",
+          'path'    => "/etc/apt/preferences.d/#{param_hash[:order] == '' ? "" : "#{param_hash[:order]}-"}#{title}.pref",
           'owner'   => 'root',
           'group'   => 'root',
           'mode'    => '0644',
-          'content' => "# #{title}\nPackage: #{param_hash[:packages]}\nPin: release a=#{param_hash[:release] || title}\nPin-Priority: #{param_hash[:priority]}\n",
+          'content' => "# #{title}\nExplanation: : #{title}\nPackage: #{param_hash[:packages]}\nPin: release a=#{param_hash[:release] || title}\nPin-Priority: #{param_hash[:priority]}\n",
         })
       }
     end