diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-01-29 13:55:15 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-01-29 13:55:15 -0800 |
commit | 0fb2730a4c77264d6d5267eb3261f2912a25791f (patch) | |
tree | 291db6c00b9de87362a169e7656fc4ed767652cc /spec/unit/application_spec.rb | |
parent | 2162973112cda6c9ae53eee7591dd621d1712e3d (diff) | |
download | chef-0fb2730a4c77264d6d5267eb3261f2912a25791f.tar.gz |
fix "please stub a default message first"
fixes this kind of thing:
1) Chef::Application class method: fatal! should log an error message to the logger
Failure/Error: Chef::Log.stub!(:fatal).with("blah").and_return(true)
#<IO:0x0000010106ab88> received :puts with unexpected arguments
expected: ("FATAL: blah")
got: (no args)
Please stub a default value first if message might be received with other args as well.
# /Users/lamont/oc/chef/spec/unit/application_spec.rb:234:in `block (3 levels) in <top (required)>'
Diffstat (limited to 'spec/unit/application_spec.rb')
-rw-r--r-- | spec/unit/application_spec.rb | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index 426dbd5242..05be73f16d 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -24,8 +24,8 @@ describe Chef::Application do ARGV.clear Chef::Log.logger = Logger.new(StringIO.new) @app = Chef::Application.new - Dir.stub!(:chdir).and_return(0) - @app.stub!(:reconfigure) + Dir.stub(:chdir).and_return(0) + @app.stub(:reconfigure) Chef::Log.init(STDERR) end @@ -36,8 +36,8 @@ describe Chef::Application do describe "reconfigure" do before do @app = Chef::Application.new - @app.stub!(:configure_chef).and_return(true) - @app.stub!(:configure_logging).and_return(true) + @app.stub(:configure_chef).and_return(true) + @app.stub(:configure_logging).and_return(true) end it "should configure chef" do @@ -59,10 +59,10 @@ describe Chef::Application do describe "run" do before do - @app.stub!(:setup_application).and_return(true) - @app.stub!(:run_application).and_return(true) - @app.stub!(:configure_chef).and_return(true) - @app.stub!(:configure_logging).and_return(true) + @app.stub(:setup_application).and_return(true) + @app.stub(:run_application).and_return(true) + @app.stub(:configure_chef).and_return(true) + @app.stub(:configure_logging).and_return(true) end it "should reconfigure the application before running" do @@ -85,8 +85,8 @@ describe Chef::Application do describe "configure_chef" do before do @app = Chef::Application.new - #Chef::Config.stub!(:merge!).and_return(true) - @app.stub!(:parse_options).and_return(true) + #Chef::Config.stub(:merge!).and_return(true) + @app.stub(:parse_options).and_return(true) end it "should parse the commandline options" do @@ -152,11 +152,11 @@ describe Chef::Application do describe "when configuring the logger" do before do @app = Chef::Application.new - Chef::Log.stub!(:init) + Chef::Log.stub(:init) end it "should initialise the chef logger" do - Chef::Log.stub!(:level=) + Chef::Log.stub(:level=) @monologger = mock("Monologger") MonoLogger.should_receive(:new).with(Chef::Config[:log_location]).and_return(@monologger) Chef::Log.should_receive(:init).with(@monologger) @@ -173,7 +173,7 @@ describe Chef::Application do shared_examples_for "log_level_is_auto" do context "when STDOUT is to a tty" do before do - STDOUT.stub!(:tty?).and_return(true) + STDOUT.stub(:tty?).and_return(true) end it "configures the log level to :warn" do @@ -195,7 +195,7 @@ describe Chef::Application do context "when STDOUT is not to a tty" do before do - STDOUT.stub!(:tty?).and_return(false) + STDOUT.stub(:tty?).and_return(false) end it "configures the log level to :info" do @@ -230,9 +230,9 @@ describe Chef::Application do describe "class method: fatal!" do before do - STDERR.stub!(:puts).with("FATAL: blah").and_return(true) - Chef::Log.stub!(:fatal).with("blah").and_return(true) - Process.stub!(:exit).and_return(true) + STDERR.stub(:puts).with("FATAL: blah").and_return(true) + Chef::Log.stub(:fatal).and_return(true) + Process.stub(:exit).and_return(true) end it "should log an error message to the logger" do |