1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00
awesome_print/spec/core_ext/logger_spec.rb
Mauro George 526f907629 Improves spec runner harness, switches to better env detection.
Does not run rails specs when running mongoid specs

WIP Start of remove BRE to check tests

Remove old helper of active record

Use RSpec skip to skip AR specs

Run ActionView only when needed

Run ActiveSupport only when needed

Run Mongoid only when needed

Create ExtVerifier.require_dependencies

Run MongoMapper only when needed

Always load nokogiri specs

Always load ostruct specs

Run Ripple only when needed

Remove :: when check for defined constants

Require spec_helper directly

Remove 1.8.6 old monkey patch

Add some RSpec configs
2015-01-02 13:20:18 -05:00

43 lines
985 B
Ruby

require 'spec_helper'
require 'logger'
require 'awesome_print/core_ext/logger'
RSpec.describe "AwesomePrint logging extensions" do
before(:all) do
@logger = Logger.new('/dev/null') rescue Logger.new('nul')
end
describe "ap method" do
it "should awesome_inspect the given object" do
object = double
expect(object).to receive(:ai)
@logger.ap object
end
describe "the log level" do
before do
AwesomePrint.defaults = {}
end
it "should fallback to the default :debug log level" do
expect(@logger).to receive(:debug)
@logger.ap(nil)
end
it "should use the global user default if no level passed" do
AwesomePrint.defaults = { :log_level => :info }
expect(@logger).to receive(:info)
@logger.ap(nil)
end
it "should use the passed in level" do
expect(@logger).to receive(:warn)
@logger.ap(nil, :warn)
end
end
end
end