summaryrefslogtreecommitdiff
path: root/spec/unit/provider/cron/unix_spec.rb
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-03-23 13:05:13 +0000
committerThom May <thom@chef.io>2018-03-23 15:36:45 +0000
commit41eb0672da4f678231f03b1b7e14dd631f8b1e49 (patch)
treefee217a9f5ada6b89487b71576524f86d2445717 /spec/unit/provider/cron/unix_spec.rb
parent57f74c4eae1c8683abacf92ad5bca86ae4a35522 (diff)
downloadchef-tm/lower_debug.tar.gz
mechanical conversion of most debug log statements to tracetm/lower_debug
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'spec/unit/provider/cron/unix_spec.rb')
-rw-r--r--spec/unit/provider/cron/unix_spec.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/spec/unit/provider/cron/unix_spec.rb b/spec/unit/provider/cron/unix_spec.rb
index 5e1fcb35ab..62b941c4aa 100644
--- a/spec/unit/provider/cron/unix_spec.rb
+++ b/spec/unit/provider/cron/unix_spec.rb
@@ -41,10 +41,15 @@ describe Chef::Provider::Cron::Unix do
let(:exitstatus) { 0 }
let(:shell_out) { double("Mixlib::ShellOut", :status => status, :stdout => stdout, :stderr => stderr) }
+ let(:logger) { double("Mixlib::Log::Child").as_null_object }
+
it "is a Chef::Provider:Cron" do
expect(provider).to be_a(Chef::Provider::Cron)
end
+ before do
+ allow(run_context).to receive(:logger).and_return(logger)
+ end
describe "read_crontab" do
let(:stderr) { "" }
let(:stdout) do
@@ -59,7 +64,7 @@ describe Chef::Provider::Cron::Unix do
end
before do
- allow(Chef::Log).to receive(:debug)
+ allow(logger).to receive(:trace)
allow(shell_out).to receive(:format_for_exception).and_return("formatted command output")
allow(provider).to receive(:shell_out).with("/usr/bin/crontab -l", :user => username).and_return(shell_out)
end
@@ -83,7 +88,7 @@ describe Chef::Provider::Cron::Unix do
it "logs the crontab output to debug" do
provider.send(:read_crontab)
- expect(Chef::Log).to have_received(:debug).with("formatted command output")
+ expect(logger).to have_received(:trace).with("formatted command output")
end
end
@@ -98,7 +103,7 @@ describe Chef::Provider::Cron::Unix do
it "logs the crontab output to debug" do
provider.send(:read_crontab) rescue nil
- expect(Chef::Log).to have_received(:debug).with("formatted command output")
+ expect(logger).to have_received(:trace).with("formatted command output")
end
end
end