-
Notifications
You must be signed in to change notification settings - Fork 271
/
Copy pathforeman_repos_spec.rb
50 lines (44 loc) · 1.26 KB
/
foreman_repos_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'spec_helper'
describe 'foreman::repos' do
let(:title) { 'foreman' }
let(:repo) { '1.18' }
let(:params) { { repo: repo, yum_repo_baseurl: 'http://example.org' } }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
case facts[:osfamily]
when 'RedHat'
yumcode = case os
when /^fedora-/
"f#{facts[:operatingsystemmajrelease]}"
else
"el#{facts[:operatingsystemmajrelease]}"
end
it do
is_expected.to contain_foreman__repos__yum('foreman')
.with_repo(repo)
.with_yumcode(yumcode)
.with_gpgcheck(true)
.with_baseurl('http://example.org')
end
when 'Debian'
it { is_expected.to contain_foreman__repos__apt('foreman').with_repo(repo) }
end
end
end
context 'on unsupported osfamily' do
let :facts do
{
networking: {
hostname: 'localhost',
},
os: {
family: 'unsupported',
},
}
end
it 'should fail' do
is_expected.to compile.and_raise_error(/#{facts[:hostname]}: This module does not support osfamily #{facts[:osfamily]}/)
end
end
end