forked from nuclearsandwich/puppet-jenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix spec errors in jenkins_repo_spec.rb
- Loading branch information
1 parent
4d201f8
commit b5400e9
Showing
1 changed file
with
40 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,50 @@ | ||
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 |