Skip to content

Commit

Permalink
specs for fail statements, replaces fail {'':} with functions
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Feb 9, 2015
1 parent 023e234 commit ee4a915
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$repourl = "http://archive.cloudera.com/cdh${cdhver}/redhat/6/${::hardwaremodel}/cdh/cloudera-cdh${cdhver}.repo"
}
default: {
fail { "Yum repository '${source}' is not supported for architecture ${::hardwaremodel}": }
fail("Yum repository '${source}' is not supported for architecture ${::hardwaremodel}")
}
}
case $osrel {
Expand All @@ -35,7 +35,7 @@
}
}
default: {
fail { "Yum repository '${source}' is not supported for redhat version ${::osrel}": }
fail("Yum repository '${source}' is not supported for redhat version ${::osrel}")
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,35 @@

it_behaves_like 'redhat-install', 'RedHat', '6'
end

context 'fail when architecture not supported' do
let(:facts) {{
:osfamily => 'RedHat',
:hardwaremodel => 'arc',
}}

let(:params) { {
:source => 'cloudera',
} }

it { expect {
should compile
}.to raise_error(/is not supported for architecture/) }
end

context 'fail when release not supported' do
let(:facts) {{
:osfamily => 'RedHat',
:operatingsystemmajrelease => '7',
:hardwaremodel => 'x86_64',
}}

let(:params) { {
:source => 'cloudera',
} }

it { expect {
should compile
}.to raise_error(/is not supported for redhat version/) }
end
end

0 comments on commit ee4a915

Please sign in to comment.