diff options
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/provider/cron/filetype_spec.rb | 6 |
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 |