forked from jhoblitt/puppet-smartd
-
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.
start using shared_examples in rspec
to try to reduce duplicate test statements
- Loading branch information
Joshua Hoblitt
committed
Sep 21, 2013
1 parent
3a2d8d2
commit 535b835
Showing
2 changed files
with
81 additions
and
97 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require 'spec_helper' | ||
|
||
describe 'smartd::params', :type => :class do | ||
|
||
shared_examples 'osfamily' do |family| | ||
let(:facts) {{ :osfamily => family }} | ||
|
||
it { should include_class('smartd::params') } | ||
end | ||
|
||
describe 'for osfamily RedHat' do | ||
it_behaves_like 'osfamily', 'RedHat' | ||
end | ||
|
||
describe 'for osfamily Debian' do | ||
it_behaves_like 'osfamily', 'Debian' | ||
end | ||
|
||
describe 'for osfamily FreeBSD' do | ||
it_behaves_like 'osfamily', 'FreeBSD' | ||
end | ||
|
||
describe 'unsupported osfamily' do | ||
let :facts do | ||
{ | ||
:osfamily => 'Solaris', | ||
:operatingsystem => 'Solaris', | ||
} | ||
end | ||
|
||
it 'should fail' do | ||
expect { should include_class('smartd::params') }. | ||
to raise_error(Puppet::Error, /not supported on Solaris/) | ||
end | ||
end | ||
|
||
end |
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