spec/notification_spec.rb in bugsnag-3.0.0 vs spec/notification_spec.rb in bugsnag-4.0.0
- old
+ new
@@ -270,9 +270,26 @@
# 2 truncated hashes (4096*2) + rest of payload (20000)
expect(::JSON.dump(payload).length).to be < 4096*2 + 20000
}
end
+ it "truncates large messages before sending" do
+ Bugsnag.notify(BugsnagTestException.new(SecureRandom.hex(500_000)), {
+ :meta_data => {
+ :some_tab => {
+ :giant => SecureRandom.hex(500_000/2),
+ :mega => SecureRandom.hex(500_000/2)
+ }
+ }
+ })
+
+ expect(Bugsnag).to have_sent_notification{ |payload|
+ # Truncated body should be no bigger than
+ # 2 truncated hashes (4096*2) + rest of payload (20000)
+ expect(::JSON.dump(payload).length).to be < 4096*2 + 20000
+ }
+ end
+
it "accepts a severity in overrides" do
Bugsnag.notify(BugsnagTestException.new("It crashed"), {
:severity => "info"
})