spec/timber/logger_spec.rb in timberio-1.0.2 vs spec/timber/logger_spec.rb in timberio-1.0.3
- old
+ new
@@ -52,9 +52,14 @@
logger.info do
{message: "payment rejected", type: :payment_rejected, data: {customer_id: "abcde1234", amount: 100}}
end
expect(io.string).to eq("payment rejected @timber.io {\"level\":\"info\",\"dt\":\"2016-09-01T12:00:00.000000Z\",\"event\":{\"custom\":{\"payment_rejected\":{\"customer_id\":\"abcde1234\",\"amount\":100}}}}\n")
end
+
+ it "should escape new lines" do
+ logger.info "first\nsecond"
+ expect(io.string).to eq("first\\nsecond @timber.io {\"level\":\"info\",\"dt\":\"2016-09-01T12:00:00.000000Z\"}\n")
+ end
end
context "with the :json format" do
before(:each) { logger.formatter = Timber::Logger::JSONFormatter.new }
\ No newline at end of file