Sha256: 1be32dbb8403735d89bd16f852a92122aa553308b017bdaeb991692db39e37b1

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe Lita::Logger do
  let(:io) { StringIO.new }

  it "uses a custom log level" do
    logger = described_class.get_logger(:debug)
    expect(logger.level).to eq(Logger::DEBUG)
  end

  it "uses the info level if the config is nil" do
    logger = described_class.get_logger(nil)
    expect(logger.level).to eq(Logger::INFO)
  end

  it "uses the info level if the config level is invalid" do
    logger = described_class.get_logger(:foo)
    expect(logger.level).to eq(Logger::INFO)
  end

  it "logs messages with a custom format" do
    logger = described_class.get_logger(:debug, io: io)
    logger.fatal "foo"
    expect(io.string).to match(/^\[.+\] FATAL: foo$/)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rita-5.0.0.alpha.4 spec/lita/logger_spec.rb
rita-5.0.0.alpha.3 spec/lita/logger_spec.rb
rita-5.0.0.alpha.2 spec/lita/logger_spec.rb
rita-5.0.0.alpha.1 spec/lita/logger_spec.rb