spec/timber/logger_spec.rb in timber-2.0.16 vs spec/timber/logger_spec.rb in timber-2.0.17
- old
+ new
@@ -16,10 +16,15 @@
it "should accept strings" do
logger.info("this is a test")
expect(io.string).to start_with("this is a test @metadata {\"level\":\"info\",\"dt\":\"2016-09-01T12:00:00.000000Z\"")
end
+ it "should non-strings" do
+ logger.info(true)
+ expect(io.string).to start_with("true @metadata")
+ end
+
context "with a context" do
let(:http_context) do
Timber::Contexts::HTTP.new(
method: "POST",
path: "/checkout",
@@ -167,9 +172,14 @@
it "should allow messages with options" do
logger.info("message", tag: "tag")
expect(io.string).to start_with("message @metadata")
expect(io.string).to include('"level":"info"')
expect(io.string).to include('"tags":["tag"]')
+ end
+
+ it "should accept non-string messages" do
+ logger.info(true)
+ expect(io.string).to start_with("true @metadata")
end
end
describe "#error" do
let(:io) { StringIO.new }
\ No newline at end of file