summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorlamont-granquist <lamont@scriptkiddie.org>2013-09-24 16:19:04 -0700
committerlamont-granquist <lamont@scriptkiddie.org>2013-09-24 16:19:04 -0700
commit661a43c61a7927b9a69c79605b2e101f1ac7592f (patch)
treefd716cb43a57a8fafed4056df0d690d531a0d775 /spec
parentfb1ab3eca60bc8051445014ed863cbaeaa619f41 (diff)
parented4168d0d4660b4d51a32508872cda1dad264a92 (diff)
downloadchef-661a43c61a7927b9a69c79605b2e101f1ac7592f.tar.gz
Merge pull request #1006 from opscode/lcg/tty-unix-test-fix
default case should be same as log_level :auto
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/application_spec.rb31
1 files changed, 16 insertions, 15 deletions
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb
index ec7f236f1f..9df82d9587 100644
--- a/spec/unit/application_spec.rb
+++ b/spec/unit/application_spec.rb
@@ -186,18 +186,8 @@ describe Chef::Application do
@app.configure_logging
end
- it "should initialise the chef logger level" do
- # By default, Chef translates :auto to :warn
- Chef::Log.should_receive(:level=).with(:warn).and_return(true)
- @app.configure_logging
- end
-
- context "and log_level is :auto" do
- before do
- Chef::Config[:log_level] = :auto
- end
-
- context "and STDOUT is to a tty" 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)
end
@@ -207,7 +197,7 @@ describe Chef::Application do
Chef::Log.level.should == :warn
end
- context "and force_logger is configured" do
+ context "when force_logger is configured" do
before do
Chef::Config[:force_logger] = true
end
@@ -219,7 +209,7 @@ describe Chef::Application do
end
end
- context "and STDOUT is not to a tty" do
+ context "when STDOUT is not to a tty" do
before do
STDOUT.stub!(:tty?).and_return(false)
end
@@ -229,7 +219,7 @@ describe Chef::Application do
Chef::Log.level.should == :info
end
- context "and force_formatter is configured" do
+ context "when force_formatter is configured" do
before do
Chef::Config[:force_formatter] = true
end
@@ -239,7 +229,18 @@ describe Chef::Application do
end
end
end
+ end
+
+ context "when log_level is not set" do
+ it_behaves_like "log_level_is_auto"
+ end
+
+ context "when log_level is :auto" do
+ before do
+ Chef::Config[:log_level] = :auto
+ end
+ it_behaves_like "log_level_is_auto"
end
end