Add spec tests for hiera_merge

Test for hiera_merge set to an invalid type that is not checked in the
code's case statement. Also test for error message returned from
validate_re().
This commit is contained in:
Garrett Honeycutt 2014-01-20 09:36:38 -05:00
parent 8a8ffbee6a
commit 0f4b8320e5

View File

@ -842,8 +842,8 @@ describe 'ssh' do
end
describe 'with hiera_merge parameter specified' do
context 'as a non-boolean' do
let(:params) { { :hiera_merge => 'not_a_boolean' } }
context 'as a non-boolean or non-string' do
let(:params) { { :hiera_merge => ['not_a_boolean','or_a_string'] } }
let(:facts) do
{ :osfamily => 'RedHat',
:lsbmajdistrelease => '6',
@ -855,6 +855,19 @@ describe 'ssh' do
end
end
context 'as an invalid string' do
let(:params) { { :hiera_merge => 'invalid_string' } }
let(:facts) do
{ :osfamily => 'RedHat',
:lsbmajdistrelease => '6',
}
end
it 'should fail' do
expect { should raise_error(Puppet::Error,/^ssh::hiera_merge may be either 'true' or 'false' and is set to <invalid_string>./) }
end
end
['true',true].each do |value|
context "as #{value}" do
let(:params) { { :hiera_merge => value } }