From 4c8252342eef4bd443110e61a83365805c433dc7 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Nov 2018 15:48:59 -0800 Subject: Update tests to pass on puppet 4 --- spec/unit/provider/cron/parsed_spec.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'spec/unit') 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 -- cgit v1.2.3