2012-01-23 22:08:00 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
describe 'apt::pin', :type => :define do
|
|
|
|
let(:title) { 'my_pin' }
|
|
|
|
|
|
|
|
let :default_params do
|
|
|
|
{
|
|
|
|
:packages => '*',
|
|
|
|
:priority => '0'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
[{},
|
|
|
|
{
|
|
|
|
:packages => 'apache',
|
|
|
|
:priority => '1'
|
|
|
|
}
|
|
|
|
].each do |param_set|
|
|
|
|
describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do
|
|
|
|
let :param_hash do
|
2012-02-04 02:24:09 +01:00
|
|
|
default_params.merge(param_set)
|
2012-01-23 22:08:00 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
param_set
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should include_class("apt::params") }
|
|
|
|
|
2012-02-04 02:24:09 +01:00
|
|
|
it { should contain_file("#{title}.pref").with({
|
|
|
|
'path' => "/etc/apt/preferences.d/#{title}",
|
|
|
|
'ensure' => "file",
|
|
|
|
'owner' => "root",
|
|
|
|
'group' => "root",
|
|
|
|
'mode' => "644",
|
|
|
|
'content' => "# #{title}\nPackage: #{param_hash[:packages]}\nPin: release a=#{title}\nPin-Priority: #{param_hash[:priority]}"
|
|
|
|
})
|
2012-01-23 22:08:00 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|