Merge pull request #1559 from chef/adamleff/add-crontab-example

Add additional example for matching crontab commands
This commit is contained in:
Adam Leff 2017-03-14 23:39:07 -05:00 committed by GitHub
commit 3d551f977f
2 changed files with 10 additions and 0 deletions

View file

@ -60,3 +60,9 @@ The following examples show how to use this InSpec audit resource.
describe crontab.where({'hour' => '*', 'minute' => '*'}) do
its('entries.length') { should cmp '0' }
end
### Test that the logged-in user's crontab contains a single command that matches a mattern
describe crontab.where { command =~ /a partial command string/ } do
its('entries.length') { should cmp 1 }
end

View file

@ -21,6 +21,10 @@ module Inspec::Resources
describe crontab.where({'hour' => '*', 'minute' => '*'}) do
its('entries.length') { should cmp '0' }
end
describe crontab.where { command =~ /a partial command string/ } do
its('entries.length') { should cmp 1 }
end
"
attr_reader :params