Sha256: f771f5029de460e34d5f0b0818bef3dea28be4c2b48ea8f97ede15ea11345b2c

Contents?: true

Size: 641 Bytes

Versions: 1

Compression:

Stored size: 641 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'time'

module Config
  module Factory
    describe 'log' do
      it 'logs to stdout in a timestamp-first format' do
        out = StringIO.new
        Factory.log_device = out
        begin
          msg = 'I am a log message'
          Factory.log.warn(msg)
          logged = out.string
          expect(logged).to include(msg)
          timestamp_str = logged.split[0]
          timestamp = Time.parse(timestamp_str)
          expect(timestamp.to_date).to eq(Time.now.utc.to_date)
        ensure
          Factory.log_device = $stdout
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
config-factory-0.1.0 spec/unit/config/factory/log_spec.rb