+ it { should contain_exec('/usr/bin/apt-get -y -o Dpkg::Options::="--force-confdef" install my_package').with(
+ :unless => "/usr/bin/dpkg -s #{title} | grep -q 'Status: install'"
+ ) }
+ end
+
+ describe "when specifying cfg_missing parameter" do
+ let :params do
+ default_params.merge(:cfg_missing => true)
+ end
+ it { should contain_exec('/usr/bin/apt-get -y -o Dpkg::Options::="--force-confmiss" install my_package').with(
+ :unless => "/usr/bin/dpkg -s #{title} | grep -q 'Status: install'"
+ ) }
+ end
+
+ describe "when specifying cfg_files and cfg_missing parameter" do
+ let :params do
+ default_params.merge(
+ :cfg_files => 'unchanged',
+ :cfg_missing => true
+ )
+ end
+ it { should contain_exec('/usr/bin/apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confmiss" install my_package').with(
+ :unless => "/usr/bin/dpkg -s #{title} | grep -q 'Status: install'"
+ ) }
+ end
+
+ describe "when specifying release and version parameters" do
+ let :params do
+ default_params.merge(
+ :release => 'testing',
+ :version => '1'
+ )
+ end
+ it { should contain_exec("/usr/bin/apt-get -y -t #{params[:release]} install #{title}=1").with(
+ :unless => "/usr/bin/apt-cache policy -t #{params[:release]} #{title} | /bin/grep -q 'Installed: #{params[:version]}'"
+ ) }
+ end
+
+ describe "when specifying release, version, cfg_files and cfg_missing parameters" do
+ let :params do
+ default_params.merge(
+ :release => 'testing',
+ :version => '1',
+ :cfg_files => 'unchanged',
+ :cfg_missing => true
+ )
+ end
+ it { should contain_exec('/usr/bin/apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confmiss" -t testing install my_package=1').with(
+ :unless => "/usr/bin/apt-cache policy -t #{params[:release]} #{title} | /bin/grep -q 'Installed: #{params[:version]}'"
+ ) }