spec/darwin/cron_spec.rb in serverspec-0.6.16 vs spec/darwin/cron_spec.rb in serverspec-0.6.17

- old
+ new

@@ -1,8 +1,21 @@ 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' +describe cron do + it { should have_entry '* * * * * /usr/local/bin/batch.sh' } + its(:command) { should eq 'crontab -l | grep -- \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ /usr/local/bin/batch.sh' } +end + +describe cron do + it { should_not have_entry 'invalid entry' } +end + +describe cron do + it { should have_entry('* * * * * /usr/local/bin/batch.sh').with_user('root') } + its(:command) { should eq 'crontab -u root -l | grep -- \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ /usr/local/bin/batch.sh' } +end + +describe cron do + it { should_not have_entry('* * * * * /usr/local/bin/batch.sh').with_user('invalid-user') } end