(#11413) Add spec test for apt::force to verify changes to unless

In the Previous commits, the query being done by the
apt::force install command was not strict enough and
could lead to false positives.

These queries represented by the unless parameter have been
resolved in another commit. This commit accompanies that commit
and adds basic unit tests to correspond to the changes.
This commit is contained in:
Dan Bode 2012-01-13 11:02:42 -08:00
parent 2f5d317177
commit f71db53130

View file

@ -0,0 +1,23 @@
require 'spec_helper'
describe 'apt::force', :type => :define do
let :title do
'my_package'
end
[false, '1'].each do |version|
describe "with version: #{version}" do
let :params do
{:version => version, :release => 'testing'}
end
let :unless_query do
base_command = "/usr/bin/dpkg -s #{title} | grep -q "
base_command + (version ? "'Version: #{params[:version]}'" : "'Status: install'")
end
let :exec_title do
"/usr/bin/aptitude -y -t #{params[:release]} install #{title}"
end
it { should contain_exec(exec_title).with_unless(unless_query) }
end
end
end