Commit b5400e9e authored by Tim Meusel's avatar Tim Meusel

fix spec errors in jenkins_repo_spec.rb

parent 4d201f81
require 'spec_helper'
describe 'jenkins', type: :class do
describe 'repo' do
describe 'default' do
describe 'RedHat' do
let(:facts) do
{
osfamily: 'RedHat',
operatingsystem: 'CentOs',
operatingsystemrelease: '6.7',
operatingsystemmajrelease: '6'
}
end
it { is_expected.to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
on_supported_os.each do |os, facts|
context "on #{os} " do
systemd_fact = case facts[:operatingsystemmajrelease]
when '6'
{ systemd: false }
else
{ systemd: true }
end
let :facts do
facts.merge(systemd_fact)
end
describe 'Suse' do
let(:facts) { { osfamily: 'Suse', operatingsystem: 'OpenSuSE' } }
it { is_expected.to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
describe 'Debian' do
let(:facts) do
{
osfamily: 'Debian',
lsbdistid: 'debian',
lsbdistcodename: 'natty',
operatingsystem: 'Debian',
os: {
name: 'Debian',
release: { full: '11.04' }
}
}
describe 'repo' do
describe 'default' do
case facts[:os]['family']
when 'RedHat'
describe 'RedHat' do
it { is_expected.to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
describe 'repo => false' do
let(:params) { { repo: false } }
it { is_expected.not_to contain_class('jenkins::repo') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
when 'Suse'
describe 'Suse' do
it { is_expected.to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
when 'Debian'
describe 'Debian' do
it { is_expected.to contain_class('jenkins::repo::debian') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
end
end
end
it { is_expected.to contain_class('jenkins::repo::debian') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
end
describe 'Unknown' do
let(:facts) { { osfamily: 'SomethingElse', operatingsystem: 'RedHat' } }
it { expect { is_expected.to raise_error(Puppet::Error) } }
end
end
describe 'repo => false' do
let(:facts) do
{
osfamily: 'RedHat',
operatingsystem: 'CentOs',
operatingsystemrelease: '6.7',
operatingsystemmajrelease: '6'
}
end
let(:params) { { repo: false } }
it { is_expected.not_to contain_class('jenkins::repo') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment