spec/formatters/bunyan_spec.rb in ougai-1.4.4 vs spec/formatters/bunyan_spec.rb in ougai-1.5.0

- old
+ new

@@ -34,10 +34,19 @@ context 'jsonize is false' do before do formatter.jsonize = false end + context 'when severity is TRACE' do + subject { formatter.call('TRACE', Time.now, nil, data) } + + it 'includes valid hash' do + expect(subject).to include(data.merge(level: 10)) + expect(subject[:time]).to be_an_instance_of(Time) + end + end + context 'when severity is DEBUG' do subject { formatter.call('DEBUG', Time.now, nil, data) } it 'includes valid hash' do expect(subject).to include(data.merge(level: 20)) @@ -76,9 +85,17 @@ subject { formatter.call('FATAL', Time.now, nil, { msg: 'TheEnd', err: err }) } it 'includes valid hash' do expect(subject).to include(level: 60, err: err) expect(subject[:time]).to be_an_instance_of(Time) + end + end + + context 'when severity is UNKNOWN' do + subject { formatter.call('ANY', Time.now, nil, { msg: 'unknown msg' }) } + + it 'includes valid hash' do + expect(subject).to include(level: 70, msg: 'unknown msg') end end end context 'with_newline is false' do