diff options
author | Adam Jacob <adam@opscode.com> | 2011-04-05 11:24:47 -0700 |
---|---|---|
committer | Daniel DeLeo <dan@opscode.com> | 2011-04-06 14:16:04 -0700 |
commit | 8265ed26287f7e7889099d93fb0bd918da218c72 (patch) | |
tree | 227c3263e10a650806f8d4e68f314c0e09f256aa | |
parent | 96aab555b8dbd3715371ae2c2ec8a1d883b1e463 (diff) | |
download | chef-8265ed26287f7e7889099d93fb0bd918da218c72.tar.gz |
Fixing specs for solaris cron provider
-rw-r--r-- | chef/lib/chef/provider/cron/solaris.rb | 8 | ||||
-rw-r--r-- | chef/spec/unit/provider/cron/solaris_spec.rb | 24 |
2 files changed, 16 insertions, 16 deletions
diff --git a/chef/lib/chef/provider/cron/solaris.rb b/chef/lib/chef/provider/cron/solaris.rb index 04436a937d..54e361a159 100644 --- a/chef/lib/chef/provider/cron/solaris.rb +++ b/chef/lib/chef/provider/cron/solaris.rb @@ -51,7 +51,7 @@ class Chef crontab_lines.each do |line| case line.chomp when "# Chef Name: #{@new_resource.name}" - Chef::Log.debug("Found cron '#{@new_resource.name}'") + Chef::Log.debug("#{@new_resource} found cron '#{@new_resource.name}'") cron_found = true @cron_exists = true next @@ -82,9 +82,9 @@ class Chef next end end - Chef::Log.debug("Cron '#{@new_resource.name}' not found") unless @cron_exists + Chef::Log.debug("#{@new_resource} cron '#{@new_resource.name}' not found") unless @cron_exists elsif status.exitstatus == 1 - Chef::Log.debug("Cron empty for '#{@new_resource.user}'") + Chef::Log.debug("#{@new_resource} cron empty for '#{@new_resource.user}'") @cron_empty = true end @@ -125,7 +125,7 @@ class Chef if @cron_exists unless compare_cron - Chef::Log.debug("Skipping existing cron entry '#{@new_resource.name}'") + Chef::Log.debug("#{@new_resource} skipping existing cron entry '#{@new_resource.name}'") return end status = popen4("crontab -l #{@new_resource.user}") do |pid, stdin, stdout, stderr| diff --git a/chef/spec/unit/provider/cron/solaris_spec.rb b/chef/spec/unit/provider/cron/solaris_spec.rb index 6b99899c1a..b551ff111d 100644 --- a/chef/spec/unit/provider/cron/solaris_spec.rb +++ b/chef/spec/unit/provider/cron/solaris_spec.rb @@ -47,20 +47,20 @@ CRON it "should report if it can't find the cron entry" do @provider.stub!(:popen4).and_return(@status) - Chef::Log.should_receive(:debug).with("Cron '#{@new_resource.name}' not found") + Chef::Log.should_receive(:debug).with("#{@new_resource} cron '#{@new_resource.name}' not found") @provider.load_current_resource end it "should report an empty crontab" do @status = mock("Status", :exitstatus => 1) @provider.stub!(:popen4).and_return(@status) - Chef::Log.should_receive(:debug).with("Cron empty for '#{@new_resource.user}'") + Chef::Log.should_receive(:debug).with("#{@new_resource} cron empty for '#{@new_resource.user}'") @provider.load_current_resource end it "should report finding a match if the entry exists" do @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) - Chef::Log.should_receive(:debug).with("Found cron '#{@new_resource.name}'") + Chef::Log.should_receive(:debug).with("#{@new_resource} found cron '#{@new_resource.name}'") @provider.load_current_resource end @@ -114,7 +114,7 @@ CRON describe Chef::Provider::Cron::Solaris, "action_create" do it "should add the cron entry if cron exists" do @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) - Chef::Log.should_receive(:info).with("Added cron '#{@new_resource.name}'") + Chef::Log.should_receive(:info).with("cron[cronhole some stuff] added crontab entry") @provider.action_create end @@ -127,7 +127,7 @@ CRON CRON @provider.cron_empty=true @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) - Chef::Log.should_receive(:info).with("Added cron '#{@new_resource.name}'") + Chef::Log.should_receive(:info).with("cron[cronhole some stuff] added crontab entry") @provider.action_create end @@ -141,7 +141,7 @@ CRON CRON @provider.cron_exists=true @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) - Chef::Log.should_receive(:info).with("Updated cron '#{@new_resource.name}'") + Chef::Log.should_receive(:info).with("cron[cronhole some stuff] updated crontab entry") @provider.should_receive(:compare_cron).once.and_return(true) @provider.action_create end @@ -154,8 +154,8 @@ CRON 30 * * * * /bin/true CRON @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) - Chef::Log.should_not_receive(:info).with("Updated cron '#{@new_resource.name}'") - Chef::Log.should_receive(:debug).with("Skipping existing cron entry '#{@new_resource.name}'") + Chef::Log.should_not_receive(:info).with("#{@new_resource} updated crontab entry") + Chef::Log.should_receive(:debug).with("#{@new_resource} skipping existing cron entry '#{@new_resource.name}'") @provider.should_receive(:compare_cron).once.and_return(false) @provider.cron_exists = true @provider.action_create @@ -171,7 +171,7 @@ MAILTO=warn@example.com 30 * * * * /bin/true CRON @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) - Chef::Log.should_receive(:info).with("Updated cron '#{@new_resource.name}'") + Chef::Log.should_receive(:info).with("cron[cronhole some stuff] updated crontab entry") @provider.cron_exists = true @provider.should_receive(:compare_cron).once.and_return(true) @provider.action_create @@ -201,7 +201,7 @@ CRON 30 * * * * /bin/true CRON provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) - Chef::Log.should_receive(:info).with("Updated cron 'lobster rage'") + Chef::Log.should_receive(:info).with("cron[lobster rage] updated crontab entry") provider.cron_exists = true provider.should_receive(:compare_cron).once.and_return(true) provider.action_create @@ -218,7 +218,7 @@ CRON C @provider.cron_exists=true @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) - Chef::Log.should_receive(:info).with("Deleted cron '#{@new_resource.name}'") + Chef::Log.should_receive(:info).with("cron[cronhole some stuff] deleted crontab entry") @provider.action_delete end @@ -229,7 +229,7 @@ C * 10 * * * /bin/false C @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) - Chef::Log.should_not_receive(:info).with("Deleted cron '#{@new_resource.name}'") + Chef::Log.should_not_receive(:info).with("cron[bar] deleted crontab entry") @provider.action_delete end end |