mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
44 lines
977 B
Ruby
44 lines
977 B
Ruby
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||
|
|
||
|
|
||
|
require 'logger'
|
||
|
require 'ap/core_ext/logger'
|
||
|
|
||
|
describe "AwesomePrint logging extensions" do
|
||
|
before(:all) do
|
||
|
@logger = Logger.new('/dev/null')
|
||
|
end
|
||
|
|
||
|
describe "ap method" do
|
||
|
it "should awesome_inspect the given object" do
|
||
|
object = mock
|
||
|
object.should_receive(:ai)
|
||
|
@logger.ap object
|
||
|
end
|
||
|
|
||
|
describe "the log level" do
|
||
|
before(:each) do
|
||
|
AwesomePrint.defaults = { }
|
||
|
end
|
||
|
|
||
|
it "should fallback to the default :debug log level" do
|
||
|
@logger.should_receive(:debug)
|
||
|
@logger.ap(nil)
|
||
|
end
|
||
|
|
||
|
it "should use the global user default if no level passed" do
|
||
|
AwesomePrint.defaults = { :log_level => :info }
|
||
|
@logger.should_receive(:info)
|
||
|
@logger.ap(nil)
|
||
|
end
|
||
|
|
||
|
it "should use the passed in level" do
|
||
|
@logger.should_receive(:warn)
|
||
|
@logger.ap(nil, :warn)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|