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
Release prep v9.1.0
[puppet-modules/puppetlabs-apt.git]
/
spec
/
defines
/
setting_spec.rb
diff --git
a/spec/defines/setting_spec.rb
b/spec/defines/setting_spec.rb
index 16db75145ab8acc97b1a7c367e326974c4022322..7a7189605395e82bdd25d7167b709890d577f7d2 100644
(file)
--- a/
spec/defines/setting_spec.rb
+++ b/
spec/defines/setting_spec.rb
@@
-1,15
+1,23
@@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'apt::setting' do
let(:pre_condition) { 'class { "apt": }' }
let :facts do
{
require 'spec_helper'
describe 'apt::setting' do
let(:pre_condition) { 'class { "apt": }' }
let :facts do
{
- os: { distro: { codename: 'jessie' }, family: 'Debian', name: 'Debian', release: { major: '8', full: '8.0' } },
- lsbdistrelease: '8.0',
- lsbdistcodename: 'jessie',
- operatingsystem: 'Debian',
- osfamily: 'Debian',
- lsbdistid: 'Debian',
+ os: {
+ family: 'Debian',
+ name: 'Debian',
+ release: {
+ major: '9',
+ full: '9.0'
+ },
+ distro: {
+ codename: 'stretch',
+ id: 'Debian'
+ }
+ }
}
end
let(:title) { 'conf-teddybear' }
}
end
let(:title) { 'conf-teddybear' }
@@
-19,11
+27,11
@@
describe 'apt::setting' do
describe 'when using the defaults' do
context 'without source or content' do
it do
describe 'when using the defaults' do
context 'without source or content' do
it do
-
is_expected
.to raise_error(Puppet::Error, %r{needs either of })
+
expect(subject)
.to raise_error(Puppet::Error, %r{needs either of })
end
end
end
end
- context 'with title=conf-teddybear
' do
+ context 'with title=conf-teddybear' do
let(:params) { default_params }
it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]') }
let(:params) { default_params }
it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]') }
@@
-47,10
+55,10
@@
describe 'apt::setting' do
let(:params) { { source: 'puppet:///la/die/dah' } }
it {
let(:params) { { source: 'puppet:///la/die/dah' } }
it {
-
is_expected
.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with(ensure: 'file',
- owner: 'root',
- group: 'root',
- source: params[:source].to_s)
+
expect(subject)
.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with(ensure: 'file',
+
owner: 'root',
+
group: 'root',
+
source: params[:source].to_s)
}
end
}
end
@@
-58,10
+66,10
@@
describe 'apt::setting' do
let(:params) { default_params }
it {
let(:params) { default_params }
it {
-
is_expected
.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with(ensure: 'file',
- owner: 'root',
- group: 'root',
- content: params[:content].to_s)
+
expect(subject)
.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with(ensure: 'file',
+
owner: 'root',
+
group: 'root',
+
content: params[:content].to_s)
}
end
end
}
end
end
@@
-74,10
+82,18
@@
describe 'apt::setting' do
end
let(:facts) do
{
end
let(:facts) do
{
- os: { family: 'Debian', name: 'Debian', release: { major: '8', full: '8.0' } },
- lsbdistid: 'Debian',
- osfamily: 'Debian',
- lsbdistcodename: 'jessie',
+ os: {
+ family: 'Debian',
+ name: 'Debian',
+ release: {
+ major: '9',
+ full: '9.0'
+ },
+ distro: {
+ codename: 'stretch',
+ id: 'Debian'
+ }
+ }
}
end
let(:title) { 'conf-teddybear' }
}
end
let(:title) { 'conf-teddybear' }
@@
-93,7
+109,7
@@
describe 'apt::setting' do
let(:params) { default_params.merge(source: 'la') }
it do
let(:params) { default_params.merge(source: 'la') }
it do
-
is_expected
.to raise_error(Puppet::Error, %r{cannot have both })
+
expect(subject)
.to raise_error(Puppet::Error, %r{cannot have both })
end
end
end
end
@@
-102,7
+118,7
@@
describe 'apt::setting' do
let(:params) { default_params }
it do
let(:params) { default_params }
it do
-
is_expected
.to raise_error(Puppet::Error, %r{must start with either})
+
expect(subject)
.to raise_error(Puppet::Error, %r{must start with either})
end
end
end
end
@@
-110,7
+126,7
@@
describe 'apt::setting' do
let(:params) { default_params.merge(ensure: 'banana') }
it do
let(:params) { default_params.merge(ensure: 'banana') }
it do
-
is_expected
.to raise_error(Puppet::Error, %r{Enum\['absent', 'file', 'present'\]})
+
expect(subject)
.to raise_error(Puppet::Error, %r{Enum\['absent', 'file', 'present'\]})
end
end
end
end
@@
-131,7
+147,7
@@
describe 'apt::setting' do
let(:params) { default_params.merge(ensure: 'absent') }
it {
let(:params) { default_params.merge(ensure: 'absent') }
it {
-
is_expected
.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with(ensure: 'absent')
+
expect(subject)
.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with(ensure: 'absent')
}
end
end
}
end
end