Skip to content

Commit

Permalink
Uncomment specs for contain_class
Browse files Browse the repository at this point in the history
  • Loading branch information
petems committed Jun 30, 2016
1 parent f66a6d2 commit 54b2b47
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 29 deletions.
6 changes: 3 additions & 3 deletions spec/classes/ipmi_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
describe 'el5.x' do
before { facts[:operatingsystemmajrelease] = '5' }

# it { should contain_class('ipmi::install') }
it { should create_class('ipmi::install') }
it { should contain_package('OpenIPMI').with_ensure('present') }
it { should contain_package('OpenIPMI-tools').with_ensure('present') }
end

describe 'el6.x' do
before { facts[:operatingsystemmajrelease] = '6' }

# it { should contain_class('ipmi::install') }
it { should create_class('ipmi::install') }
it { should contain_package('OpenIPMI').with_ensure('present') }
it { should contain_package('ipmitool').with_ensure('present') }
end

describe 'el7.x' do
before { facts[:operatingsystemmajrelease] = '7' }

# it { should contain_class('ipmi::install') }
it { should create_class('ipmi::install') }
it { should contain_package('OpenIPMI').with_ensure('present') }
it { should contain_package('ipmitool').with_ensure('present') }
end
Expand Down
43 changes: 34 additions & 9 deletions spec/classes/ipmi_params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,67 @@
describe 'el5.x' do
before { facts[:operatingsystemmajrelease] = '5' }

# it { should contain_class('ipmi::params') }
it { should create_class('ipmi::params') }
end

describe 'el6.x' do
before { facts[:operatingsystemmajrelease] = '6' }

# it { should contain_class('ipmi::params') }
it { should create_class('ipmi::params') }
end

describe 'el7.x' do
before { facts[:operatingsystemmajrelease] = '7' }

# it { should contain_class('ipmi::params') }
it { should create_class('ipmi::params') }
end

describe 'unsupported operatingsystemmajrelease' do
before { facts[:operatingsystemmajrelease] = '1' }

it 'should fail' do
expect { should contain_class('ipmi::params') }.
expect { should create_class('ipmi::params') }.
to raise_error(Puppet::Error, /not supported on operatingsystemmajrelease 1/)
end
end
end

describe 'for osfamily Debian' do
let(:facts) {{ :osfamily => 'Debian' }}

describe 'Debian' do
before { facts[:operatingsystem] = 'Debian' }

it { should create_class('ipmi::params') }
end

describe 'Ubuntu' do
before { facts[:operatingsystem] = 'Ubuntu' }

it { should create_class('ipmi::params') }
end

describe 'unsupported Debian based operatingsystem' do
before { facts[:operatingsystem] = 'LinuxMint' }

it 'should fail' do
expect { should contain_class('ipmi::params') }.
to raise_error(Puppet::Error, /Module ipmi is not supported on operatingsystem LinuxMint/)
end
end
end

describe 'unsupported osfamily' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian',
}
{
:osfamily => 'Solaris',
:operatingsystem => 'Nexenta',
}
end

it 'should fail' do
expect { should contain_class('ipmi::params') }.
to raise_error(Puppet::Error, /not supported on Debian/)
to raise_error(Puppet::Error, /not supported on Nexenta/)
end
end

Expand Down
10 changes: 5 additions & 5 deletions spec/classes/ipmi_service_ipmi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'ipmi::service::ipmi', :type => :class do

describe 'no params' do
# it { should contain_class('ipmi::service::ipmi') }
it { should create_class('ipmi::service::ipmi') }
it do
should contain_service('ipmi').with({
:ensure => 'running',
Expand All @@ -17,7 +17,7 @@
describe 'with enable => false' do
let(:params) {{ :enable => false }}

# it { should contain_class('ipmi::service::ipmi') }
it { should create_class('ipmi::service::ipmi') }
it do
should contain_service('ipmi').with({
:ensure => 'running',
Expand All @@ -31,7 +31,7 @@
describe 'with enable => true' do
let(:params) {{ :enable => true }}

# it { should contain_class('ipmi::service::ipmi') }
it { should create_class('ipmi::service::ipmi') }
it do
should contain_service('ipmi').with({
:ensure => 'running',
Expand All @@ -55,7 +55,7 @@
describe 'with ensure => running' do
let(:params) {{ :ensure => 'running' }}

# it { should contain_class('ipmi::service::ipmi') }
it { should create_class('ipmi::service::ipmi') }
it do
should contain_service('ipmi').with({
:ensure => 'running',
Expand All @@ -69,7 +69,7 @@
describe 'with ensure => running' do
let(:params) {{ :ensure => 'stopped' }}

# it { should contain_class('ipmi::service::ipmi') }
it { should create_class('ipmi::service::ipmi') }
it do
should contain_service('ipmi').with({
:ensure => 'stopped',
Expand Down
14 changes: 7 additions & 7 deletions spec/classes/ipmi_service_ipmievd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'ipmi::service::ipmievd', :type => :class do

describe 'no params' do
# it { should contain_class('ipmi::service::ipmievd') }
it { should create_class('ipmi::service::ipmievd') }
it do
should contain_service('ipmievd').with({
:ensure => 'running',
Expand All @@ -17,7 +17,7 @@
describe 'with enable => false' do
let(:params) {{ :enable => false }}

# it { should contain_class('ipmi::service::ipmievd') }
it { should create_class('ipmi::service::ipmievd') }
it do
should contain_service('ipmievd').with({
:ensure => 'running',
Expand All @@ -31,7 +31,7 @@
describe 'with enable => true' do
let(:params) {{ :enable => true }}

# it { should contain_class('ipmi::service::ipmievd') }
it { should create_class('ipmi::service::ipmievd') }
it do
should contain_service('ipmievd').with({
:ensure => 'running',
Expand All @@ -47,15 +47,15 @@

it 'should fail' do
expect {
should contain_class('ipmi::service')
should create_class('ipmi::service')
}.to raise_error(Puppet::Error, /is not a boolean/)
end
end

describe 'with ensure => running' do
let(:params) {{ :ensure => 'running' }}

# it { should contain_class('ipmi::service::ipmievd') }
it { should create_class('ipmi::service::ipmievd') }
it do
should contain_service('ipmievd').with({
:ensure => 'running',
Expand All @@ -69,7 +69,7 @@
describe 'with ensure => running' do
let(:params) {{ :ensure => 'stopped' }}

# it { should contain_class('ipmi::service::ipmievd') }
it { should create_class('ipmi::service::ipmievd') }
it do
should contain_service('ipmievd').with({
:ensure => 'stopped',
Expand All @@ -86,7 +86,7 @@

it 'should fail' do
expect {
should contain_class('ipmi::service::ipmievd')
should create_class('ipmi::service::ipmievd')
}.to raise_error(Puppet::Error, /does not match/)
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/classes/ipmi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end

describe 'no params' do
# it { should contain_class('ipmi') }
it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
Expand Down Expand Up @@ -40,7 +40,7 @@
describe 'service_ensure => running' do
let(:params) {{ :service_ensure => 'running' }}

# it { should contain_class('ipmi') }
it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
Expand Down Expand Up @@ -69,7 +69,7 @@
describe 'service_ensure => stopped' do
let(:params) {{ :service_ensure => 'stopped' }}

# it { should contain_class('ipmi') }
it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
Expand Down Expand Up @@ -108,7 +108,7 @@
describe 'ipmievd_service_ensure => running' do
let(:params) {{ :ipmievd_service_ensure => 'running' }}

# it { should contain_class('ipmi') }
it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
Expand Down Expand Up @@ -137,7 +137,7 @@
describe 'ipmievd_service_ensure => stopped' do
let(:params) {{ :ipmievd_service_ensure => 'stopped' }}

# it { should contain_class('ipmi') }
it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
Expand Down

0 comments on commit 54b2b47

Please sign in to comment.