Sha256: 54a7c210c6ab9c1602a4b944487debca6c79d7935485b53752436c3deda28df5

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

require "spec_helper"

describe Timber::Overrides::LoggerAdd, :rails_23 => true do
  describe "#add" do
    let(:io) { StringIO.new }
    let(:logger) do
      logger = ::Logger.new(io)
      logger.formatter = proc do |severity, datetime, progname, msg|
         "#{msg}\n"
      end
      logger
    end

    it "should display the message only when passed to a default logger" do
      event = Timber::Events::Custom.new(message: "Build version 1.0.0", type: :build, data: {version: "1.0.0"})
      logger.info(event)
      expect(io.string).to eq("Build version 1.0.0\n")
    end

    it "should work with blocks" do
      event = Timber::Events::Custom.new(message: "Build version 1.0.0", type: :build, data: {version: "1.0.0"})
      logger.info { event }
      expect(io.string).to eq("Build version 1.0.0\n")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
timber-1.1.14 spec/timber/overrides/logger_add_spec.rb
timber-1.1.13 spec/timber/overrides/logger_add_spec.rb