Skip to content

Commit eed510e

Browse files
committed
Fix tests
1 parent d2fa3ae commit eed510e

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

spec/classes/letsencrypt_spec.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
describe 'with defaults' do
1616
it { is_expected.to compile }
1717

18-
epel = facts[:osfamily] == 'RedHat'
18+
epel = facts[:osfamily] == 'RedHat' && facts[:operatingsystem] != 'Fedora'
1919

2020
it 'contains File[/usr/local/sbin/letsencrypt-domain-validation]' do
2121
is_expected.to contain_file('/usr/local/sbin/letsencrypt-domain-validation').
@@ -46,8 +46,7 @@
4646
cron_monthday: ['*'])
4747
is_expected.to contain_cron('letsencrypt-renew').with_ensure('absent')
4848

49-
case facts[:operatingsystem]
50-
when 'FreeBSD'
49+
if facts[:osfamily] == 'FreeBSD'
5150
is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email [email protected]')
5251
is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini server https://acme-v01.api.letsencrypt.org/directory')
5352
is_expected.to contain_file('letsencrypt-renewal-hooks-puppet').
@@ -64,8 +63,12 @@
6463
is_expected.to contain_file('letsencrypt-renewal-hooks-puppet').with_path('/etc/letsencrypt/renewal-hooks-puppet')
6564
end
6665

67-
if facts[:osfamily] == 'RedHat' && facts[:operatingsystemmajrelease] == '7'
68-
is_expected.to contain_class('epel').that_comes_before('Package[letsencrypt]')
66+
if facts[:osfamily] == 'RedHat'
67+
if facts[:operatingsystem] == 'Fedora'
68+
is_expected.not_to contain_class('epel')
69+
else
70+
is_expected.to contain_class('epel').that_comes_before('Package[letsencrypt]')
71+
end
6972
is_expected.to contain_class('letsencrypt::install').with(install_method: 'package')
7073
is_expected.to contain_class('letsencrypt').with(package_command: 'certbot')
7174
is_expected.to contain_package('letsencrypt').with(name: 'certbot')

spec/defines/letsencrypt_certonly_spec.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@
2323
it { is_expected.to contain_class('Letsencrypt::Config') }
2424
it { is_expected.to contain_class('Letsencrypt::Params') }
2525

26-
case facts[:kernel]
27-
when 'Linux'
26+
if facts[:osfamily] == 'FreeBSD'
27+
it { is_expected.to contain_file('/usr/local/etc/letsencrypt') }
28+
it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email [email protected]') }
29+
it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini server https://acme-v01.api.letsencrypt.org/directory') }
30+
else
2831
it { is_expected.to contain_file('/etc/letsencrypt') }
2932
it { is_expected.to contain_package('letsencrypt') } unless facts[:os]['release']['full'] == '14.04'
3033
it { is_expected.to contain_ini_setting('/etc/letsencrypt/cli.ini email [email protected]') }
3134
it { is_expected.to contain_ini_setting('/etc/letsencrypt/cli.ini server https://acme-v01.api.letsencrypt.org/directory') }
32-
else
33-
it { is_expected.to contain_file('/usr/local/etc/letsencrypt') }
34-
it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini email [email protected]') }
35-
it { is_expected.to contain_ini_setting('/usr/local/etc/letsencrypt/cli.ini server https://acme-v01.api.letsencrypt.org/directory') }
3635
end
3736
it { is_expected.to contain_exec('initialize letsencrypt') }
3837
it { is_expected.to contain_exec('letsencrypt certonly foo.example.com') }

0 commit comments

Comments
 (0)