Sha256: 7fea814ae98e996b7f8ff90c95b876d8adbb0b8cf1a075d7b762ee9ec9b23037
Contents?: true
Size: 1.29 KB
Versions: 7
Compression:
Stored size: 1.29 KB
Contents
# -*- ruby -*- # vim: set nosta noet ts=4 sw=4: # frozen_string_literal: true require_relative '../../helpers' require 'loggability/formatter/html' describe Loggability::Formatter::HTML do subject { described_class.new } it "formats messages as HTML" do expect( subject.call( 'INFO', Time.at(1336286481), nil, "Foom." ) ).to match( %r{<span class="log-message-text">Foom.</span>}i ) end it "formats exceptions into useful messages" do msg = nil begin raise ArgumentError, "invalid argument" rescue => err msg = subject.call( 'INFO', Time.at(1336286481), nil, err ) end expect( msg ).to match( %r{<span class=\"log-exc\">ArgumentError</span>}i ) expect( msg ).to match( %r{<span class=\"log-exc-message\">invalid argument</span>}i ) expect( msg ).to match( %r{ from <span class=\"log-exc-firstframe\">}i ) end it "formats regular objects into useful messages" do expect( subject.call( 'INFO', Time.at(1336286481), nil, Object.new ) ).to match( %r{<span class=\"log-message-text\">#<Object:0x[[:xdigit:]]+></span>} ) end it "escapes the 'progname' part of log messages" do progname = "#<Class:0x007f9efa153d08>:0x7f9efa153c18" expect( subject.call( 'DEBUG', Time.at(1336286481), progname, Object.new ) ).to match( %r{#<Class:0x0} ) end end
Version data entries
7 entries across 7 versions & 1 rubygems