Sha256: 0a5f052975ab05f4f5e25d1d805b23c154fff273e5e1803c4e7d38db30e38663
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
require_relative '../test_helper' module SemanticLogger module Formatters class DefaultTest < Minitest::Test describe Default do let(:log_time) do Time.utc(2017, 1, 14, 8, 32, 5.375276) end let(:level) do :debug end let(:log) do log = SemanticLogger::Log.new('DefaultTest', level) log.time = log_time log end let(:set_exception) do begin raise 'Oh no' rescue Exception => exc log.exception = exc end end let(:formatter) do formatter = SemanticLogger::Formatters::OneLine.new # Does not use the logger instance for formatting purposes formatter.call(log, nil) formatter end describe 'message' do it 'logs message' do log.message = "Hello \nWorld\n" assert_equal "-- Hello World", formatter.message end it 'skips empty message' do refute formatter.message end end describe 'exception' do it 'logs exception' do set_exception assert_equal '-- Exception: RuntimeError: Oh no', formatter.exception end it 'skips nil exception' do refute formatter.exception end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
semantic_logger-4.2.0 | test/formatters/one_line_test.rb |