Skip to content

Commit

Permalink
fix rspec-puppet syntax to work with ruby 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Sep 14, 2013
1 parent 7c27501 commit 10d7489
Showing 1 changed file with 62 additions and 48 deletions.
110 changes: 62 additions & 48 deletions spec/classes/smartd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@
let(:facts) {{ :osfamily => 'RedHat' }}

it { should contain_package('smartmontools').with_ensure('present') }
it { should contain_service('smartd').with(
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
)}
it { should contain_file('/etc/smartd.conf').with(
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0644',
:notify => 'Service[smartd]'
)}
it do
should contain_service('smartd').with({
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
})
end
it do
should contain_file('/etc/smartd.conf').with({
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0644',
:notify => 'Service[smartd]'
})
end
it 'should contain File[/etc/smartd.conf] with correct contents' do
verify_contents(subject, '/etc/smartd.conf', [
'DEFAULT -m root -M daily',
Expand All @@ -48,53 +52,63 @@
let(:facts) {{ :osfamily => 'Debian' }}

it { should contain_package('smartmontools').with_ensure('present') }
it { should contain_service('smartd').with(
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
)}
it { should contain_file('/etc/smartd.conf').with(
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0644',
:require => 'Package[smartmontools]',
:notify => 'Service[smartd]'
)}
it do
should contain_service('smartd').with({
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
})
end
it do
should contain_file('/etc/smartd.conf').with({
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0644',
:require => 'Package[smartmontools]',
:notify => 'Service[smartd]'
})
end
it 'should contain File[/etc/smartd.conf] with correct contents' do
verify_contents(subject, '/etc/smartd.conf', [
'DEFAULT -m root -M daily',
'DEVICESCAN',
])
end
it { should contain_shell_config('start_smartd').with(
:ensure => 'present',
:file => '/etc/default/smartmontools',
:key => 'start_smartd',
:value => 'yes',
:before => 'Service[smartd]'
)}
it do
should contain_shell_config('start_smartd').with(
:ensure => 'present',
:file => '/etc/default/smartmontools',
:key => 'start_smartd',
:value => 'yes',
:before => 'Service[smartd]'
})
end
end

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

it { should contain_package('smartmontools').with_ensure('present') }
it { should contain_service('smartd').with(
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
)}
it { should contain_file('/usr/local/etc/smartd.conf').with(
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0644',
:require => 'Package[smartmontools]',
:notify => 'Service[smartd]'
)}
it do
should contain_service('smartd').with({
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
})
end
it do
should contain_file('/usr/local/etc/smartd.conf').with({
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0644',
:require => 'Package[smartmontools]',
:notify => 'Service[smartd]'
})
end
it 'should contain File[/usr/local/etc/smartd.conf] with correct contents' do
verify_contents(subject, '/usr/local/etc/smartd.conf', [
'DEFAULT -m root -M daily',
Expand Down

0 comments on commit 10d7489

Please sign in to comment.