aboutsummaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorMelissa <melissa@puppet.com>2018-11-28 14:10:39 -0800
committerGitHub <noreply@github.com>2018-11-28 14:10:39 -0800
commitba2c0d33b21d41c534e2f0dc01c680b3b917e423 (patch)
tree13a0e1cf9ca448c3b9481a19498bb23c2b320462 /spec/unit
parentb61f15615bceb3e1e9f960bf1c21546ac3d87d8d (diff)
parent4c8252342eef4bd443110e61a83365805c433dc7 (diff)
downloadpuppet-cron_core-ba2c0d33b21d41c534e2f0dc01c680b3b917e423.tar.gz
puppet-cron_core-ba2c0d33b21d41c534e2f0dc01c680b3b917e423.tar.bz2
Merge pull request #6 from puppetlabs/modules8182
Expand test coverage
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/provider/cron/parsed_spec.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/unit/provider/cron/parsed_spec.rb b/spec/unit/provider/cron/parsed_spec.rb
index d913eef..d54129c 100644
--- a/spec/unit/provider/cron/parsed_spec.rb
+++ b/spec/unit/provider/cron/parsed_spec.rb
@@ -195,10 +195,14 @@ describe Puppet::Type.type(:cron).provider(:crontab) do
end
it 'contains no resources for a user who has no crontab, or for a user that is absent' do
- Puppet::Util::Execution
- .expects(:execute)
- .with('crontab -u foobar -l', failonfail: true, combine: true)
- .returns('')
+ if Puppet.version.to_f < 5.0
+ described_class.target_object('foobar').expects(:`).with('crontab -u foobar -l 2>/dev/null').returns ''
+ else
+ Puppet::Util::Execution
+ .expects(:execute)
+ .with('crontab -u foobar -l', failonfail: true, combine: true)
+ .returns('')
+ end
expect(described_class.instances.select do |resource|
resource.get('target') == 'foobar'
end).to be_empty