summaryrefslogtreecommitdiff
path: root/spec/mixlib
diff options
context:
space:
mode:
authorChristopher Brown <cb@opscode.com>2009-12-14 11:51:00 -0800
committerChristopher Brown <cb@opscode.com>2009-12-14 11:51:00 -0800
commit227da700bc76ea01ccd8f68076b1d4befd6ead47 (patch)
treeb7d9a70b4714a138d239f4eb431c62b8c9c64f1c /spec/mixlib
parent336f3ec002177105233c9d79731d52124266adb8 (diff)
downloadmixlib-log-227da700bc76ea01ccd8f68076b1d4befd6ead47.tar.gz
make log level changes backward compatible
Diffstat (limited to 'spec/mixlib')
-rw-r--r--spec/mixlib/log_spec.rb24
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/mixlib/log_spec.rb b/spec/mixlib/log_spec.rb
index 259ae36..dcfa544 100644
--- a/spec/mixlib/log_spec.rb
+++ b/spec/mixlib/log_spec.rb
@@ -1,5 +1,6 @@
#
# Author:: Adam Jacob (<adam@opscode.com>)
+# Author:: Christopher Brown (<cb@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
@@ -34,7 +35,7 @@ describe Mixlib::Log do
lambda { Logit.init(tf) }.should_not raise_error
end
- it "should set the log level with :debug, :info, :warn, :error, or :fatal" do
+ it "should set the log level using the binding form, with :debug, :info, :warn, :error, or :fatal" do
levels = {
:debug => Logger::DEBUG,
:info => Logger::INFO,
@@ -45,10 +46,29 @@ describe Mixlib::Log do
levels.each do |symbol, constant|
Logit.level(symbol)
Logit.logger.level.should == constant
+ Logit.level.should == symbol
end
end
- it "should raise an ArgumentError if you try and set the level to something strange" do
+ it "should set the log level using the method form, with :debug, :info, :warn, :error, or :fatal" do
+ levels = {
+ :debug => Logger::DEBUG,
+ :info => Logger::INFO,
+ :warn => Logger::WARN,
+ :error => Logger::ERROR,
+ :fatal => Logger::FATAL
+ }
+ levels.each do |symbol, constant|
+ Logit.level(symbol)
+ Logit.logger.level.should == constant
+ end
+ end
+
+ it "should raise an ArgumentError if you try and set the level to something strange using the binding form" do
+ lambda { Logit.level = :the_roots }.should raise_error(ArgumentError)
+ end
+
+ it "should raise an ArgumentError if you try and set the level to something strange using the method form" do
lambda { Logit.level(:the_roots) }.should raise_error(ArgumentError)
end