spec/unit/logging_spec.rb in pwwka-0.16.1 vs spec/unit/logging_spec.rb in pwwka-0.17.0

- old
+ new

@@ -66,17 +66,28 @@ :payload, "payload", ].each do |name| it "will strip payload (given as a #{name.class}) if configured" do Pwwka.configuration.payload_logging = :error + Pwwka.configuration.receive_raw_payload = false ForLogging.logf("This is the payload: %{payload}", name => { foo: "bar" }) ForLogging.logf("This is also the payload: %{payload}", name => { foo: "bar" }, at: :error) expect(logger).to have_received(:info).with("This is the payload: [omitted]") expect(logger).to have_received(:error).with("This is also the payload: {:foo=>\"bar\"}") end it "will strip payload (given as a #{name.class}) of errors, too" do Pwwka.configuration.payload_logging = :fatal + Pwwka.configuration.receive_raw_payload = false + ForLogging.logf("This is the payload: %{payload}", name => { foo: "bar" }) + ForLogging.logf("This is also the payload: %{payload}", name => { foo: "bar" }, at: :error) + expect(logger).to have_received(:info).with("This is the payload: [omitted]") + expect(logger).to have_received(:error).with("This is also the payload: [omitted]") + end + + it "will strip payload (given as a #{name.class}) if we AREN'T parsing payloads" do + Pwwka.configuration.payload_logging = :info + Pwwka.configuration.receive_raw_payload = true ForLogging.logf("This is the payload: %{payload}", name => { foo: "bar" }) ForLogging.logf("This is also the payload: %{payload}", name => { foo: "bar" }, at: :error) expect(logger).to have_received(:info).with("This is the payload: [omitted]") expect(logger).to have_received(:error).with("This is also the payload: [omitted]") end