spec/formatters/readable_spec.rb in ougai-1.4.4 vs spec/formatters/readable_spec.rb in ougai-1.5.0
- old
+ new
@@ -16,10 +16,19 @@
message: 'it is dummy.',
stack: "error1.rb\n error2.rb"
}
end
+ context 'when severity is TRACE' do
+ subject { described_class.new.call('TRACE', Time.now, nil, data) }
+
+ it 'includes valid strings' do
+ expect(subject).to include("\e[0;34mTRACE\e[0m: Log Message!")
+ expect(subject.gsub(/\e\[([;\d]+)?m/, '')).to include(':status => 200')
+ end
+ end
+
context 'when severity is DEBUG' do
subject { described_class.new.call('DEBUG', Time.now, nil, data) }
it 'includes valid strings' do
expect(subject).to include("\e[0;37mDEBUG\e[0m: Log Message!")
@@ -57,9 +66,16 @@
context 'when severity is FATAL' do
subject { described_class.new.call('FATAL', Time.now, nil, { msg: 'TheEnd', err: err }) }
it 'includes valid strings' do
expect(subject).to include("\e[0;35mFATAL\e[0m: TheEnd")
expect(subject.gsub(/\e\[([;\d]+)?m/, '')).to include("error1.rb\n error2.rb")
+ end
+ end
+
+ context 'when severity is UNKNOWN' do
+ subject { described_class.new.call('ANY', Time.now, nil, { msg: 'unknown msg' }) }
+ it 'includes valid strings' do
+ expect(subject).to include("\e[0;32mANY\e[0m: unknown msg")
end
end
context 'when logger has excluded_fields' do
subject do