spec/formatters/bunyan_spec.rb in ougai-1.5.0 vs spec/formatters/bunyan_spec.rb in ougai-1.5.2
- old
+ new
@@ -112,6 +112,22 @@
expect(result).to include(data.merge(level: 30))
expect(result[:time]).to match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/)
end
end
+ describe '#datetime_format' do
+ subject do
+ formatter.call('DEBUG', Time.now, nil, data)
+ end
+
+ context 'is time AM/PM format' do
+ before do
+ formatter.datetime_format = '%I:%M:%S %p'
+ end
+
+ it 'applys output' do
+ result = JSON.parse(subject, symbolize_names: true)
+ expect(result[:time]).to match(/^\d{2}:\d{2}:\d{2} [AP]M$/)
+ end
+ end
+ end
end