Sha256: fa7a59abcf5644092ad390036d7e9feb7d1bd4fe028bdae69ba3268753c99951
Contents?: true
Size: 1.36 KB
Versions: 12
Compression:
Stored size: 1.36 KB
Contents
require 'spec_helper' module Seahorse module Client module Plugins describe Logging do def setup_plugin(options = {}) @config ||= Configuration.new Logging.new.add_options(@config) @config = @config.build!(options) @handlers ||= HandlerList.new Logging.new.add_handlers(@handlers, @config) end it 'adds default configuration options' do setup_plugin expect(@config.logger).to be(nil) expect(@config.log_level).to equal(:info) expect(@config.log_formatter).to eq(Client::Logging::Formatter.default) end it 'adds a handler when a :logger is configured' do logger = Object.new setup_plugin(logger: logger) expect(@config.logger).to be(logger) expect(@handlers.first).to be(Client::Logging::Handler) end it 'skips the handler when :logger is not configured' do setup_plugin # no logger expect(@config.logger).to be(nil) expect(@handlers.to_a).to eq([]) end it 'adds the handler to the bottom of the stack' do @handlers = double('handler-list') expect(@handlers).to receive(:add). with(Client::Logging::Handler, step: :validate) setup_plugin(logger: Object.new) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems