Skip to content

Commit

Permalink
rspec for #25
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Jan 13, 2015
1 parent 1625b63 commit 683b598
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,38 @@
it_behaves_like 'debian', 'Ubuntu', 'precise'
end

shared_examples 'redhat' do |operatingsystem, lsbdistcodename, mrel|
let(:params) {{
:source => 'mesosphere',
}}

let(:osrel) { lsbdistcodename}

let(:facts) {{
:operatingsystem => operatingsystem,
:osfamily => 'RedHat',
:lsbdistcodename => lsbdistcodename,
:operatingsystemmajrelease => lsbdistcodename,
:lsbdistid => operatingsystem,
}}

it { should contain_package('mesosphere-el-repo').with({
'ensure' => 'present',
'provider' => 'rpm',
'source' => "http://repos.mesosphere.io/el/#{osrel}/noarch/RPMS/mesosphere-el-repo-#{osrel}-#{mrel}.noarch.rpm",
})}

context "undef source" do
let(:params) {{
:source => 'undef',
}}
it { should_not contain_package('mesosphere-el-repo') }
end
end

context 'on RedHat based systems' do
it_behaves_like 'redhat', 'CentOS', '6', '2'
it_behaves_like 'redhat', 'CentOS', '7', '1'
end

end

0 comments on commit 683b598

Please sign in to comment.