spec/timber/logger_spec.rb in timber-1.1.1 vs spec/timber/logger_spec.rb in timber-1.1.2
- old
+ new
@@ -45,11 +45,11 @@
it "should call and use Timber::Events.build" do
message = {message: "payment rejected", payment_rejected: {customer_id: "abcde1234", amount: 100}}
expect(Timber::Events).to receive(:build).with(message).and_call_original
logger.info(message)
expect(io.string).to start_with("payment rejected @metadata {\"level\":\"info\",\"dt\":\"2016-09-01T12:00:00.000000Z\",")
- expect(io.string).to include("\"event\":{\"server_side_app\":{\"custom\":{\"payment_rejected\":{\"customer_id\":\"abcde1234\",\"amount\":100}}}}")
+ expect(io.string).to include("\"event\":{\"custom\":{\"payment_rejected\":{\"customer_id\":\"abcde1234\",\"amount\":100}}}")
end
it "should log properly when an event is passed" do
message = Timber::Events::SQLQuery.new(sql: "select * from users", time_ms: 56, message: "select * from users")
logger.info(message)
@@ -75,10 +75,10 @@
it "should allow functions" do
logger.info do
{message: "payment rejected", payment_rejected: {customer_id: "abcde1234", amount: 100}}
end
expect(io.string).to start_with("payment rejected @metadata {\"level\":\"info\",\"dt\":\"2016-09-01T12:00:00.000000Z\",")
- expect(io.string).to include("\"event\":{\"server_side_app\":{\"custom\":{\"payment_rejected\":{\"customer_id\":\"abcde1234\",\"amount\":100}}}}")
+ expect(io.string).to include("\"event\":{\"custom\":{\"payment_rejected\":{\"customer_id\":\"abcde1234\",\"amount\":100}}}")
end
it "should escape new lines" do
logger.info "first\nsecond"
expect(io.string).to start_with("first\\nsecond @metadata")
\ No newline at end of file