test/log_test.rb in pliny-0.2.1 vs test/log_test.rb in pliny-0.3.0
- old
+ new
@@ -22,6 +22,22 @@
it "merges context from RequestStore" do
Pliny::RequestStore.store[:log_context] = { app: "pliny" }
mock(@io).puts "app=pliny foo=bar"
Pliny.log(foo: "bar")
end
+
+ it "supports a context" do
+ mock(@io).puts "app=pliny foo=bar"
+ Pliny.context(app: "pliny") do
+ Pliny.log(foo: "bar")
+ end
+ end
+
+ it "local context does not overwrite global" do
+ Pliny::RequestStore.store[:log_context] = { app: "pliny" }
+ mock(@io).puts "app=not_pliny foo=bar"
+ Pliny.context(app: "not_pliny") do
+ Pliny.log(foo: "bar")
+ end
+ assert Pliny::RequestStore.store[:log_context][:app] = "pliny"
+ end
end