summaryrefslogtreecommitdiff
path: root/spec/unit/config_spec.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2012-11-13 13:19:04 -0800
committerdanielsdeleo <dan@opscode.com>2012-11-20 20:00:26 -0800
commit41a1471ccda66947793e6597fa1f19d0a351e215 (patch)
treeec2ec7e614a687849a309b8e2868c1602b18e751 /spec/unit/config_spec.rb
parent832674e6254b287a9cd188d5a1756955bee45c6c (diff)
downloadchef-41a1471ccda66947793e6597fa1f19d0a351e215.tar.gz
Change default output to formatters when in console
Diffstat (limited to 'spec/unit/config_spec.rb')
-rw-r--r--spec/unit/config_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index 89161c9df1..927e7059b1 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -62,6 +62,51 @@ describe Chef::Config do
it_behaves_like "server URL"
end
+ describe "when configuring formatters" do
+ # if TTY and not(force-logger)
+ # formatter = configured formatter or default formatter
+ # formatter goes to STDOUT/ERR
+ # if log file is writeable
+ # log level is configured level or info
+ # log location is file
+ # else
+ # log level is warn
+ # log location is STDERR
+ # end
+ # elsif not(TTY) and force formatter
+ # formatter = configured formatter or default formatter
+ # if log_location specified
+ # formatter goes to log_location
+ # else
+ # formatter goes to STDOUT/ERR
+ # end
+ # else
+ # formatter = "null"
+ # log_location = configured-value or defualt
+ # log_level = info or defualt
+ # end
+ #
+ before do
+ @config_class = Class.new(Chef::Config)
+ end
+
+ it "has an empty list of formatters by default" do
+ @config_class.formatters.should == []
+ end
+
+ it "configures a formatter with a short name" do
+ @config_class.add_formatter(:doc)
+ @config_class.formatters.should == [[:doc, nil]]
+ end
+
+ it "configures a formatter with a file output" do
+ @config_class.add_formatter(:doc, "/var/log/formatter.log")
+ @config_class.formatters.should == [[:doc, "/var/log/formatter.log"]]
+ end
+
+
+ end
+
describe "class method: manage_secret_key" do
before do
Chef::FileCache.stub!(:load).and_return(true)