Skip to content

Commit

Permalink
change mdadm::config mailaddr param into an hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Nov 9, 2013
1 parent d7f1875 commit c90515b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
6 changes: 4 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# This class should be considered private.
#
class mdadm::config(
$mailaddr = undef,
$options = {}
) {
validate_string($mailaddr)
validate_hash($options)

$mailaddr= $options['mailaddr']

if $mailaddr {
augeas { 'mdadm.conf mailaddr':
Expand Down
18 changes: 9 additions & 9 deletions spec/unit/classes/mdadm_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
it { should include_class('mdadm::config') }
end

context 'mailaddr =>' do
context 'undef' do
let(:params) {{ :mailaddr => nil }}
context 'options =>' do
context '{}' do
let(:params) {{ :options => {}}}

it { should include_class('mdadm::config') }
end

context 'foo' do
let(:params) {{ :mailaddr => 'foo' }}
context '{ mailaddr => foo }' do
let(:params) {{ :options => { 'mailaddr' => 'foo' } }}

it { should contain_augeas('mdadm.conf mailaddr') }

Expand All @@ -26,13 +26,13 @@
end
end

context 'true' do
let(:params) {{ :mailaddr => true }}
context 'undef' do
let(:params) {{ :options => nil }}

it 'should fail' do
expect { should }.to raise_error /is not a string/
expect { should }.to raise_error(/is not a Hash/)
end
end
end # mailaddr =>
end # options =>

end

0 comments on commit c90515b

Please sign in to comment.