Code Review
/
puppet-modules
/
puppetlabs-apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
apt::conf: Don't require content `ensure=>absent`.
[puppet-modules/puppetlabs-apt.git]
/
spec
/
defines
/
conf_spec.rb
diff --git
a/spec/defines/conf_spec.rb
b/spec/defines/conf_spec.rb
index 5a81b5148c7d7bf489dabdef47012abe8d58a995..e96f8bcd8299b9c2c3902f4603ba25ed802a6244 100644
(file)
--- a/
spec/defines/conf_spec.rb
+++ b/
spec/defines/conf_spec.rb
@@
-1,5
+1,9
@@
require 'spec_helper'
describe 'apt::conf', :type => :define do
require 'spec_helper'
describe 'apt::conf', :type => :define do
+ let :pre_condition do
+ 'class { "apt": }'
+ end
+ let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy' } }
let :title do
'norecommends'
end
let :title do
'norecommends'
end
@@
-16,15
+20,9
@@
describe 'apt::conf', :type => :define do
"/etc/apt/apt.conf.d/00norecommends"
end
"/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({
+ it { is_expected.to contain_file(filename).with({
'ensure' => 'present',
'ensure' => 'present',
- 'content' =>
"Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n"
,
+ 'content' =>
/Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;/
,
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
@@
-32,12
+30,23
@@
describe 'apt::conf', :type => :define do
}
end
}
end
+ describe "when creating a preference without content" do
+ let :params do
+ {
+ :priority => '00',
+ }
+ end
+
+ it 'fails' do
+ expect { subject } .to raise_error(/pass in content/)
+ end
+ end
+
describe "when removing an apt preference" do
let :params do
{
:ensure => 'absent',
:priority => '00',
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
}
end
@@
-45,9
+54,8
@@
describe 'apt::conf', :type => :define do
"/etc/apt/apt.conf.d/00norecommends"
end
"/etc/apt/apt.conf.d/00norecommends"
end
- it {
should
contain_file(filename).with({
+ it {
is_expected.to
contain_file(filename).with({
'ensure' => 'absent',
'ensure' => 'absent',
- 'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n",
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
'owner' => 'root',
'group' => 'root',
'mode' => '0644',