Skip to content

Commit

Permalink
Add specs for cron type
Browse files Browse the repository at this point in the history
  • Loading branch information
mizzy committed May 18, 2013
1 parent 46c4897 commit cc73cee
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spec/darwin/cron_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'spec_helper'

include Serverspec::Helper::Darwin

describe 'Serverspec cron matchers of Darwin family' do
it_behaves_like 'support cron have_entry matcher', '* * * * * /usr/local/bin/batch.sh'
it_behaves_like 'support cron have_entry with user matcher', '* * * * * /usr/local/bin/batch.sh', 'root'
end
8 changes: 8 additions & 0 deletions spec/debian/cron_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'spec_helper'

include Serverspec::Helper::Debian

describe 'Serverspec cron matchers of Debian family' do
it_behaves_like 'support cron have_entry matcher', '* * * * * /usr/local/bin/batch.sh'
it_behaves_like 'support cron have_entry with user matcher', '* * * * * /usr/local/bin/batch.sh', 'root'
end
8 changes: 8 additions & 0 deletions spec/gentoo/cron_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'spec_helper'

include Serverspec::Helper::Gentoo

describe 'Serverspec cron matchers of Gentoo family' do
it_behaves_like 'support cron have_entry matcher', '* * * * * /usr/local/bin/batch.sh'
it_behaves_like 'support cron have_entry with user matcher', '* * * * * /usr/local/bin/batch.sh', 'root'
end
8 changes: 8 additions & 0 deletions spec/redhat/cron_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'spec_helper'

include Serverspec::Helper::RedHat

describe 'Serverspec cron matchers of Red Hat family' do
it_behaves_like 'support cron have_entry matcher', '* * * * * /usr/local/bin/batch.sh'
it_behaves_like 'support cron have_entry with user matcher', '* * * * * /usr/local/bin/batch.sh', 'root'
end
2 changes: 1 addition & 1 deletion spec/redhat/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

include Serverspec::Helper::RedHat

describe 'Serverspec service matchers of Red Hat family' do
describe 'Serverspec file matchers of Red Hat family' do
it_behaves_like 'support file be_file matcher', '/etc/ssh/sshd_config'
it_behaves_like 'support file be_directory matcher', '/etc/ssh'
it_behaves_like 'support file contain matcher', '/etc/ssh/sshd_config', 'This is the sshd server system-wide configuration file'
Expand Down
8 changes: 8 additions & 0 deletions spec/solaris/cron_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'spec_helper'

include Serverspec::Helper::Solaris

describe 'Serverspec cron matchers of Solaris family' do
it_behaves_like 'support cron have_entry matcher', '* * * * * /usr/local/bin/batch.sh'
it_behaves_like 'support cron have_entry with user matcher', '* * * * * /usr/local/bin/batch.sh', 'root'
end
23 changes: 23 additions & 0 deletions spec/support/shared_cron_examples.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
shared_examples_for 'support cron have_entry matcher' do |entry|
describe 'have_cron_entry' do
describe cron do
it { should have_cron_entry entry }
end

describe cron do
it { should_not have_cron_entry 'invalid entry' }
end
end
end

shared_examples_for 'support cron have_entry with user matcher' do |entry, user|
describe 'have_cron_entry' do
describe cron do
it { should have_cron_entry(entry).with_user(user) }
end

describe cron do
it { should_not have_cron_entry('invalid entry').with_user(user) }
end
end
end

0 comments on commit cc73cee

Please sign in to comment.