Sha256: f14fb8d07516fc2c806bb8772a1bbfeaae93e37bf4119b3bced735fba8e854fb
Contents?: true
Size: 1.33 KB
Versions: 6
Compression:
Stored size: 1.33 KB
Contents
# -*- rspec -*- #encoding: utf-8 require_relative '../../helpers' require 'tempfile' require 'rspec' require 'loggability/logger' require 'loggability/formatter' 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
6 entries across 6 versions & 1 rubygems