aboutsummaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorcthorn42 <christopher.thorn@puppet.com>2023-11-27 14:33:43 -0800
committerGitHub <noreply@github.com>2023-11-27 14:33:43 -0800
commit05eb6f54809b5e6102d33fb5747690d32ee082a4 (patch)
tree60eaae0ad250b7e6efd7329873be74dd77813649 /spec/unit
parent8990735b40f5aa0e95b444aaff8af08feab35968 (diff)
parentbe5ae9bc9e198a00f2a790992b663dda374006ba (diff)
downloadpuppet-cron_core-05eb6f54809b5e6102d33fb5747690d32ee082a4.tar.gz
puppet-cron_core-05eb6f54809b5e6102d33fb5747690d32ee082a4.tar.bz2
Merge pull request #62 from joshcooper/stringify_process_output
Convert ProcessOutput to String explicitly
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/provider/cron/filetype_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/unit/provider/cron/filetype_spec.rb b/spec/unit/provider/cron/filetype_spec.rb
index bd579c1..8dc0c32 100644
--- a/spec/unit/provider/cron/filetype_spec.rb
+++ b/spec/unit/provider/cron/filetype_spec.rb
@@ -6,6 +6,7 @@ describe Puppet::Provider::Cron::FileType do
shared_examples_for 'crontab provider' do
let(:cron) { type.new('no_such_user') }
let(:crontab) { File.read(my_fixture(crontab_output)) }
+ let(:managedtab) { File.read(my_fixture('managed_output')) }
let(:options) { { failonfail: true, combine: true } }
let(:uid) { 'no_such_user' }
let(:user_options) { options.merge(uid: uid) }
@@ -30,6 +31,11 @@ describe Puppet::Provider::Cron::FileType do
expect(cron.read).to eq(crontab)
end
+ it 'returns a String' do
+ expect(Puppet::Util::Execution).to receive(:execute).with(['crontab', '-l'], user_options).and_return(Puppet::Util::Execution::ProcessOutput.new(managedtab, 0))
+ expect(cron.read).to be_an_instance_of(String)
+ end
+
it 'does not switch user if current user is the target user' do
expect(Puppet::Util).to receive(:uid).with(uid).twice.and_return 9000
expect(Puppet::Util::SUIDManager).to receive(:uid).and_return 9000