bugsnag 6.4.0 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,11 @@ describe Bugsnag::Configuration do
22
22
  subject.delivery_method = :wow
23
23
  expect(subject.delivery_method).to eq(:wow)
24
24
  end
25
+
26
+ it "should have sensible defaults for session tracking" do
27
+ expect(subject.session_endpoint).to eq("https://sessions.bugsnag.com")
28
+ expect(subject.track_sessions).to be false
29
+ end
25
30
  end
26
31
 
27
32
  it "should have exit exception classes ignored by default" do
@@ -23,7 +23,7 @@ describe Bugsnag::Sidekiq do
23
23
  rescue
24
24
  end
25
25
 
26
- expect(Bugsnag).to have_sent_notification {|payload|
26
+ expect(Bugsnag).to have_sent_notification {|payload, headers|
27
27
  event = get_event_from_payload(payload)
28
28
  expect(event["metaData"]["sidekiq"]["msg"]["class"]).to eq("FailingWorker")
29
29
  expect(event["metaData"]["sidekiq"]["msg"]["args"]).to eq([-0])
@@ -16,7 +16,7 @@ describe Bugsnag::MiddlewareStack do
16
16
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
17
17
  expect(callback_run_count).to eq(1)
18
18
 
19
- expect(Bugsnag).to have_sent_notification{ |payload|
19
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
20
20
  event = get_event_from_payload(payload)
21
21
  expect(event["metaData"]["some_tab"]).not_to be_nil
22
22
  expect(event["metaData"]["some_tab"]["info"]).to eq("here")
@@ -37,7 +37,7 @@ describe Bugsnag::MiddlewareStack do
37
37
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
38
38
  expect(callback_run_count).to eq(1)
39
39
 
40
- expect(Bugsnag).to have_sent_notification{ |payload|
40
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
41
41
  event = get_event_from_payload(payload)
42
42
  expect(event["metaData"]["custom"]).not_to be_nil
43
43
  expect(event["metaData"]["custom"]["info"]).to eq("here")
@@ -56,7 +56,7 @@ describe Bugsnag::MiddlewareStack do
56
56
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
57
57
  expect(callback_run_count).to eq(1)
58
58
 
59
- expect(Bugsnag).to have_sent_notification{ |payload|
59
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
60
60
  event = get_event_from_payload(payload)
61
61
  expect(event["user"]).not_to be_nil
62
62
  expect(event["user"]["id"]).to eq("here")
@@ -73,7 +73,7 @@ describe Bugsnag::MiddlewareStack do
73
73
  report.meta_data.merge!({custom: {info: 'overridden'}})
74
74
  end
75
75
 
76
- expect(Bugsnag).to have_sent_notification{ |payload|
76
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
77
77
  event = get_event_from_payload(payload)
78
78
  expect(event["metaData"]["custom"]).not_to be_nil
79
79
  expect(event["metaData"]["custom"]["info"]).to eq("overridden")
@@ -87,7 +87,7 @@ describe Bugsnag::MiddlewareStack do
87
87
  report.meta_data.merge!({custom: {info: 'overridden'}})
88
88
  end
89
89
 
90
- expect(Bugsnag).to have_sent_notification{ |payload|
90
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
91
91
  event = get_event_from_payload(payload)
92
92
  expect(event["metaData"]["custom"]).not_to be_nil
93
93
  expect(event["metaData"]["custom"]["info"]).to eq("overridden")
@@ -97,7 +97,7 @@ describe Bugsnag::MiddlewareStack do
97
97
  it "does not have have before callbacks by default" do
98
98
  expect(Bugsnag.before_notify_callbacks.size).to eq(0)
99
99
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
100
- expect(Bugsnag).to have_sent_notification{ |payload|
100
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
101
101
  event = get_event_from_payload(payload)
102
102
  expect(event["metaData"].size).to eq(0)
103
103
  }
@@ -172,7 +172,7 @@ describe Bugsnag::MiddlewareStack do
172
172
 
173
173
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
174
174
 
175
- expect(Bugsnag).to have_sent_notification{ |payload|
175
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
176
176
  event = get_event_from_payload(payload)
177
177
  expect(event["metaData"]['test']['value']).to eq("abcdef*****3456")
178
178
  }
@@ -187,7 +187,7 @@ describe Bugsnag::MiddlewareStack do
187
187
  Bugsnag.notify(e)
188
188
  end
189
189
 
190
- expect(Bugsnag).to have_sent_notification{ |payload|
190
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
191
191
  event = get_event_from_payload(payload)
192
192
  expect(event["metaData"]["error"]).to_not be_nil
193
193
  expect(event["metaData"]["error"]).to eq({"suggestion" => "prepend"})
@@ -205,7 +205,7 @@ describe Bugsnag::MiddlewareStack do
205
205
  Bugsnag.notify(e)
206
206
  end
207
207
 
208
- expect(Bugsnag).to have_sent_notification{ |payload|
208
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
209
209
  event = get_event_from_payload(payload)
210
210
  expect(event["metaData"]["error"]).to be_nil
211
211
  }
@@ -240,7 +240,7 @@ describe Bugsnag::MiddlewareStack do
240
240
  }
241
241
  end
242
242
 
243
- expect(Bugsnag).to have_sent_notification{ |payload|
243
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
244
244
  event = get_event_from_payload(payload)
245
245
  expect(event["unhandled"]).to be true
246
246
  expect(event["severityReason"]).to eq({
@@ -25,7 +25,7 @@ describe Bugsnag::Rack do
25
25
  it "delivers an exception if auto_notify is enabled" do
26
26
  rack_stack.call(rack_env) rescue nil
27
27
 
28
- expect(Bugsnag).to have_sent_notification{ |payload|
28
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
29
29
  exception_class = payload["events"].first["exceptions"].first["errorClass"]
30
30
  expect(exception_class).to eq(exception.class.to_s)
31
31
  }
@@ -35,7 +35,7 @@ describe Bugsnag::Rack do
35
35
  it "applies the correct severity reason" do
36
36
  rack_stack.call(rack_env) rescue nil
37
37
 
38
- expect(Bugsnag).to have_sent_notification{ |payload|
38
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
39
39
  event = get_event_from_payload(payload)
40
40
  expect(event["unhandled"]).to be true
41
41
  expect(event["severityReason"]).to eq({
@@ -13,7 +13,7 @@ describe Bugsnag::Middleware::Rails3Request do
13
13
  })
14
14
  Bugsnag.notify(BugsnagTestException.new('Grimbles'))
15
15
 
16
- expect(Bugsnag).to have_sent_notification { |payload|
16
+ expect(Bugsnag).to have_sent_notification { |payload, headers|
17
17
  event = get_event_from_payload(payload)
18
18
  puts event["metaData"].inspect
19
19
  expect(event["metaData"]["request"]).to eq({
@@ -38,7 +38,7 @@ describe Bugsnag::Middleware::Rails3Request do
38
38
 
39
39
  Bugsnag.notify(BugsnagTestException.new('Grimbles'))
40
40
 
41
- expect(Bugsnag).to have_sent_notification { |payload|
41
+ expect(Bugsnag).to have_sent_notification { |payload, headers|
42
42
  event = get_event_from_payload(payload)
43
43
  puts event["metaData"].inspect
44
44
  expect(event["metaData"]["request"]).to eq({
@@ -31,8 +31,8 @@ describe Bugsnag::Report do
31
31
  it "should contain an api_key if one is set" do
32
32
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
33
33
 
34
- expect(Bugsnag).to have_sent_notification{ |payload|
35
- expect(payload["apiKey"]).to eq("c9d60ae4c7e70c4b6c4ebd3e8056d2b8")
34
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
35
+ expect(headers["Bugsnag-Api-Key"]).to eq("c9d60ae4c7e70c4b6c4ebd3e8056d2b8")
36
36
  }
37
37
  end
38
38
 
@@ -57,8 +57,8 @@ describe Bugsnag::Report do
57
57
  report.api_key = "9d84383f9be2ca94902e45c756a9979d"
58
58
  end
59
59
 
60
- expect(Bugsnag).to have_sent_notification{ |payload|
61
- expect(payload["apiKey"]).to eq("9d84383f9be2ca94902e45c756a9979d")
60
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
61
+ expect(headers["Bugsnag-Api-Key"]).to eq("9d84383f9be2ca94902e45c756a9979d")
62
62
  }
63
63
  end
64
64
 
@@ -68,7 +68,7 @@ describe Bugsnag::Report do
68
68
  report.grouping_hash = "this is my grouping hash"
69
69
  end
70
70
 
71
- expect(Bugsnag).to have_sent_notification{ |payload|
71
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
72
72
  event = get_event_from_payload(payload)
73
73
  expect(event["groupingHash"]).to eq("this is my grouping hash")
74
74
  }
@@ -85,15 +85,15 @@ describe Bugsnag::Report do
85
85
 
86
86
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
87
87
 
88
- expect(Bugsnag).to have_sent_notification{ |payload|
89
- expect(payload["apiKey"]).to eq("c9d60ae4c7e70c4b6c4ebd3e8056d2b9")
88
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
89
+ expect(headers["Bugsnag-Api-Key"]).to eq("c9d60ae4c7e70c4b6c4ebd3e8056d2b9")
90
90
  }
91
91
  end
92
92
 
93
93
  it "has the right exception class" do
94
94
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
95
95
 
96
- expect(Bugsnag).to have_sent_notification{ |payload|
96
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
97
97
  exception = get_exception_from_payload(payload)
98
98
  expect(exception["errorClass"]).to eq("BugsnagTestException")
99
99
  }
@@ -102,7 +102,7 @@ describe Bugsnag::Report do
102
102
  it "has the right exception message" do
103
103
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
104
104
 
105
- expect(Bugsnag).to have_sent_notification{ |payload|
105
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
106
106
  exception = get_exception_from_payload(payload)
107
107
  expect(exception["message"]).to eq("It crashed")
108
108
  }
@@ -111,7 +111,7 @@ describe Bugsnag::Report do
111
111
  it "has a valid stacktrace" do
112
112
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
113
113
 
114
- expect(Bugsnag).to have_sent_notification{ |payload|
114
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
115
115
  exception = get_exception_from_payload(payload)
116
116
  expect(exception["stacktrace"].length).to be > 0
117
117
  }
@@ -120,7 +120,7 @@ describe Bugsnag::Report do
120
120
  it "uses correct unhandled defaults" do
121
121
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
122
122
 
123
- expect(Bugsnag).to have_sent_notification{ |payload|
123
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
124
124
  event = get_event_from_payload(payload)
125
125
  expect(event["unhandled"]).to be false
126
126
  expect(event["severity"]).to eq("warning")
@@ -134,7 +134,7 @@ describe Bugsnag::Report do
134
134
  Bugsnag.notify(BugsnagTestException.new("It crashed")) do |notification|
135
135
  notification.severity = "info"
136
136
  end
137
- expect(Bugsnag).to have_sent_notification{ |payload|
137
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
138
138
  event = get_event_from_payload(payload)
139
139
  expect(event["unhandled"]).to be false
140
140
  expect(event["severity"]).to eq("info")
@@ -146,7 +146,7 @@ describe Bugsnag::Report do
146
146
 
147
147
  it "sets correct severity and reason for specific error classes" do
148
148
  Bugsnag.notify(SignalException.new("TERM"))
149
- expect(Bugsnag).to have_sent_notification{ |payload|
149
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
150
150
  event = get_event_from_payload(payload)
151
151
  expect(event["unhandled"]).to be false
152
152
  expect(event["severity"]).to eq("info")
@@ -171,7 +171,7 @@ describe Bugsnag::Report do
171
171
  })
172
172
  end
173
173
 
174
- expect(Bugsnag).to have_sent_notification{ |payload|
174
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
175
175
  event = get_event_from_payload(payload)
176
176
  expect(event["metaData"]["some_tab"]).to eq(
177
177
  "info" => "here",
@@ -191,7 +191,7 @@ describe Bugsnag::Report do
191
191
 
192
192
  Bugsnag.notify(exception)
193
193
 
194
- expect(Bugsnag).to have_sent_notification{ |payload|
194
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
195
195
  event = get_event_from_payload(payload)
196
196
  expect(event["metaData"]["some_tab"]).to eq(
197
197
  "info" => "here",
@@ -213,7 +213,7 @@ describe Bugsnag::Report do
213
213
  report.remove_tab(:some_tab)
214
214
  end
215
215
 
216
- expect(Bugsnag).to have_sent_notification{ |payload|
216
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
217
217
  event = get_event_from_payload(payload)
218
218
  expect(event["metaData"]["some_tab"]).to be_nil
219
219
  }
@@ -232,7 +232,7 @@ describe Bugsnag::Report do
232
232
  report.remove_tab(nil)
233
233
  end
234
234
 
235
- expect(Bugsnag).to have_sent_notification{ |payload|
235
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
236
236
  event = get_event_from_payload(payload)
237
237
  expect(event["metaData"]["some_tab"]).to eq(
238
238
  "info" => "here",
@@ -248,7 +248,7 @@ describe Bugsnag::Report do
248
248
  report.add_tab(:some_tab, "added")
249
249
  end
250
250
 
251
- expect(Bugsnag).to have_sent_notification{ |payload|
251
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
252
252
  event = get_event_from_payload(payload)
253
253
  expect(event["metaData"]["custom"]).to eq(
254
254
  "some_tab" => "added",
@@ -269,7 +269,7 @@ describe Bugsnag::Report do
269
269
  report.add_tab(:some_tab, {:info => "overridden"})
270
270
  end
271
271
 
272
- expect(Bugsnag).to have_sent_notification{ |payload|
272
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
273
273
  event = get_event_from_payload(payload)
274
274
  expect(event["metaData"]["some_tab"]).to eq(
275
275
  "info" => "overridden",
@@ -284,7 +284,7 @@ describe Bugsnag::Report do
284
284
 
285
285
  Bugsnag.notify(exception)
286
286
 
287
- expect(Bugsnag).to have_sent_notification{ |payload|
287
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
288
288
  event = get_event_from_payload(payload)
289
289
  expect(event["user"]["id"]).to eq("exception_user_id")
290
290
  }
@@ -298,7 +298,7 @@ describe Bugsnag::Report do
298
298
  report.user.merge!({:id => "override_user_id"})
299
299
  end
300
300
 
301
- expect(Bugsnag).to have_sent_notification{ |payload|
301
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
302
302
  event = get_event_from_payload(payload)
303
303
  expect(event["user"]["id"]).to eq("override_user_id")
304
304
  }
@@ -310,7 +310,7 @@ describe Bugsnag::Report do
310
310
 
311
311
  Bugsnag.notify(exception)
312
312
 
313
- expect(Bugsnag).to have_sent_notification{ |payload|
313
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
314
314
  event = get_event_from_payload(payload)
315
315
  expect(event["context"]).to eq("exception_context")
316
316
  }
@@ -322,7 +322,7 @@ describe Bugsnag::Report do
322
322
 
323
323
  Bugsnag.notify(exception)
324
324
 
325
- expect(Bugsnag).to have_sent_notification{ |payload|
325
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
326
326
  event = get_event_from_payload(payload)
327
327
  expect(event["groupingHash"]).to eq("exception_hash")
328
328
  }
@@ -337,7 +337,7 @@ describe Bugsnag::Report do
337
337
  report.context = "override_context"
338
338
  end
339
339
 
340
- expect(Bugsnag).to have_sent_notification{ |payload|
340
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
341
341
  event = get_event_from_payload(payload)
342
342
  expect(event["context"]).to eq("override_context")
343
343
  }
@@ -353,7 +353,7 @@ describe Bugsnag::Report do
353
353
  })
354
354
  end
355
355
 
356
- expect(Bugsnag).to have_sent_notification{ |payload|
356
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
357
357
  event = get_event_from_payload(payload)
358
358
  expect(event["metaData"]["some_tab"]).to eq(
359
359
  "info" => "here",
@@ -372,7 +372,7 @@ describe Bugsnag::Report do
372
372
  })
373
373
  end
374
374
 
375
- expect(Bugsnag).to have_sent_notification{ |payload|
375
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
376
376
  # Truncated body should be no bigger than
377
377
  # 2 truncated hashes (4096*2) + rest of payload (20000)
378
378
  expect(::JSON.dump(payload).length).to be < 4096*2 + 20000
@@ -389,7 +389,7 @@ describe Bugsnag::Report do
389
389
  })
390
390
  end
391
391
 
392
- expect(Bugsnag).to have_sent_notification{ |payload|
392
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
393
393
  # Truncated body should be no bigger than
394
394
  # 2 truncated hashes (4096*2) + rest of payload (20000)
395
395
  expect(::JSON.dump(payload).length).to be < 4096*2 + 20000
@@ -403,7 +403,7 @@ describe Bugsnag::Report do
403
403
  ex.set_backtrace(stacktrace)
404
404
  Bugsnag.notify(ex)
405
405
 
406
- expect(Bugsnag).to have_sent_notification{ |payload|
406
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
407
407
  # Truncated body should be no bigger than
408
408
  # 400 stacktrace lines * approx 60 chars per line + rest of payload (20000)
409
409
  expect(::JSON.dump(payload).length).to be < 400*60 + 20000
@@ -415,7 +415,7 @@ describe Bugsnag::Report do
415
415
  report.severity = "info"
416
416
  end
417
417
 
418
- expect(Bugsnag).to have_sent_notification{ |payload|
418
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
419
419
  event = get_event_from_payload(payload)
420
420
  expect(event["severity"]).to eq("info")
421
421
  }
@@ -425,7 +425,7 @@ describe Bugsnag::Report do
425
425
  it "defaults to warning severity" do
426
426
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
427
427
 
428
- expect(Bugsnag).to have_sent_notification{ |payload|
428
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
429
429
  event = get_event_from_payload(payload)
430
430
  expect(event["severity"]).to eq("warning")
431
431
  }
@@ -436,7 +436,7 @@ describe Bugsnag::Report do
436
436
  report.context = 'test_context'
437
437
  end
438
438
 
439
- expect(Bugsnag).to have_sent_notification{ |payload|
439
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
440
440
  event = get_event_from_payload(payload)
441
441
  expect(event["context"]).to eq("test_context")
442
442
  }
@@ -447,7 +447,7 @@ describe Bugsnag::Report do
447
447
  report.user = {id: 'test_user'}
448
448
  end
449
449
 
450
- expect(Bugsnag).to have_sent_notification{ |payload|
450
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
451
451
  event = get_event_from_payload(payload)
452
452
  expect(event["user"]["id"]).to eq("test_user")
453
453
  }
@@ -470,7 +470,7 @@ describe Bugsnag::Report do
470
470
 
471
471
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
472
472
 
473
- expect(Bugsnag).to have_sent_notification{ |payload|
473
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
474
474
  event = get_event_from_payload(payload)
475
475
  expect(event["app"]["releaseStage"]).to eq("production")
476
476
  }
@@ -490,7 +490,7 @@ describe Bugsnag::Report do
490
490
  Bugsnag.configuration.notify_release_stages = ["development"]
491
491
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
492
492
 
493
- expect(Bugsnag).to have_sent_notification{ |payload|
493
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
494
494
  event = get_event_from_payload(payload)
495
495
  expect(event["exceptions"].length).to eq(1)
496
496
  }
@@ -506,7 +506,7 @@ describe Bugsnag::Report do
506
506
  Bugsnag.configuration.project_root = "/Random/location/here"
507
507
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
508
508
 
509
- expect(Bugsnag).to have_sent_notification{ |payload|
509
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
510
510
  exception = get_exception_from_payload(payload)
511
511
  expect(exception["stacktrace"].size).to be >= 1
512
512
  expect(exception["stacktrace"].first["inProject"]).to be_nil
@@ -517,7 +517,7 @@ describe Bugsnag::Report do
517
517
  Bugsnag.configuration.project_root = File.expand_path File.dirname(__FILE__)
518
518
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
519
519
 
520
- expect(Bugsnag).to have_sent_notification{ |payload|
520
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
521
521
  exception = get_exception_from_payload(payload)
522
522
  expect(exception["stacktrace"].size).to be >= 1
523
523
  expect(exception["stacktrace"].first["inProject"]).to eq(true)
@@ -539,7 +539,7 @@ describe Bugsnag::Report do
539
539
  "(pry):3:in `__pry__'"
540
540
  ]}
541
541
  Bugsnag.notify(ex)
542
- expect(Bugsnag).to have_sent_notification{ |payload|
542
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
543
543
  exception = get_exception_from_payload(payload)
544
544
 
545
545
  expect(exception["stacktrace"][0]["inProject"]).to be_nil
@@ -556,7 +556,7 @@ describe Bugsnag::Report do
556
556
  Bugsnag.configuration.app_version = "1.1.1"
557
557
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
558
558
 
559
- expect(Bugsnag).to have_sent_notification{ |payload|
559
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
560
560
  event = get_event_from_payload(payload)
561
561
  expect(event["app"]["version"]).to eq("1.1.1")
562
562
  }
@@ -568,7 +568,7 @@ describe Bugsnag::Report do
568
568
  report.meta_data.merge!({:request => {:params => {:password => "1234", :other_password => "12345", :other_data => "123456"}}})
569
569
  end
570
570
 
571
- expect(Bugsnag).to have_sent_notification{ |payload|
571
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
572
572
  event = get_event_from_payload(payload)
573
573
  expect(event["metaData"]).not_to be_nil
574
574
  expect(event["metaData"]["request"]).not_to be_nil
@@ -586,7 +586,7 @@ describe Bugsnag::Report do
586
586
  report.meta_data.merge!({:request => {:params => {:password => "1234", :other_password => "123456", :other_data => "123456"}}})
587
587
  end
588
588
 
589
- expect(Bugsnag).to have_sent_notification{ |payload|
589
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
590
590
  event = get_event_from_payload(payload)
591
591
  expect(event["metaData"]).not_to be_nil
592
592
  expect(event["metaData"]["request"]).not_to be_nil
@@ -604,7 +604,7 @@ describe Bugsnag::Report do
604
604
  report.meta_data.merge!({:request => {:params => {:password => "1234", :other_password => "123456", :other_data => "123456"}}})
605
605
  end
606
606
 
607
- expect(Bugsnag).to have_sent_notification{ |payload|
607
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
608
608
  event = get_event_from_payload(payload)
609
609
  expect(event["metaData"]).not_to be_nil
610
610
  expect(event["metaData"]["request"]).not_to be_nil
@@ -622,7 +622,7 @@ describe Bugsnag::Report do
622
622
  report.meta_data.merge!({:request => {:params => {:password => "1234", :other_password => "123456", :other_data => "123456"}}})
623
623
  end
624
624
 
625
- expect(Bugsnag).to have_sent_notification{ |payload|
625
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
626
626
  event = get_event_from_payload(payload)
627
627
  expect(event["metaData"]).not_to be_nil
628
628
  expect(event["metaData"]["request"]).not_to be_nil
@@ -638,7 +638,7 @@ describe Bugsnag::Report do
638
638
  report.meta_data.merge!({:request => {:params => {:nil_param => nil}}})
639
639
  end
640
640
 
641
- expect(Bugsnag).to have_sent_notification{ |payload|
641
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
642
642
  event = get_event_from_payload(payload)
643
643
  expect(event["metaData"]).not_to be_nil
644
644
  expect(event["metaData"]["request"]).not_to be_nil
@@ -700,7 +700,7 @@ describe Bugsnag::Report do
700
700
  Bugsnag.notify $!
701
701
  end
702
702
 
703
- expect(Bugsnag).to have_sent_notification{ |payload|
703
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
704
704
  event = get_event_from_payload(payload)
705
705
  expect(event["exceptions"].size).to eq(2)
706
706
  }
@@ -712,7 +712,7 @@ describe Bugsnag::Report do
712
712
 
713
713
  Bugsnag.notify(ex)
714
714
 
715
- expect(Bugsnag).to have_sent_notification{ |payload|
715
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
716
716
  event = get_event_from_payload(payload)
717
717
  expect(event["exceptions"].size).to eq(1)
718
718
  }
@@ -726,7 +726,7 @@ describe Bugsnag::Report do
726
726
  end
727
727
 
728
728
  Bugsnag.notify(first_ex)
729
- expect(Bugsnag).to have_sent_notification{ |payload|
729
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
730
730
  event = get_event_from_payload(payload)
731
731
  expect(event["exceptions"].size).to eq(5)
732
732
  }
@@ -735,7 +735,7 @@ describe Bugsnag::Report do
735
735
  it "calls to_exception on i18n error objects" do
736
736
  Bugsnag.notify(OpenStruct.new(:to_exception => BugsnagTestException.new("message")))
737
737
 
738
- expect(Bugsnag).to have_sent_notification{ |payload|
738
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
739
739
  exception = get_exception_from_payload(payload)
740
740
  expect(exception["errorClass"]).to eq("BugsnagTestException")
741
741
  expect(exception["message"]).to eq("message")
@@ -745,7 +745,7 @@ describe Bugsnag::Report do
745
745
  it "generates runtimeerror for non exceptions" do
746
746
  notify_test_exception
747
747
 
748
- expect(Bugsnag).to have_sent_notification{ |payload|
748
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
749
749
  exception = get_exception_from_payload(payload)
750
750
  expect(exception["errorClass"]).to eq("RuntimeError")
751
751
  expect(exception["message"]).to eq("test message")
@@ -761,7 +761,7 @@ describe Bugsnag::Report do
761
761
 
762
762
  Bugsnag.notify(ex)
763
763
 
764
- expect(Bugsnag).to have_sent_notification{ |payload|
764
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
765
765
  exception = get_exception_from_payload(payload)
766
766
  expect(exception["stacktrace"].length).to eq(2)
767
767
 
@@ -786,7 +786,7 @@ describe Bugsnag::Report do
786
786
 
787
787
  Bugsnag.notify(ex)
788
788
 
789
- expect(Bugsnag).to have_sent_notification{ |payload|
789
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
790
790
  exception = get_exception_from_payload(payload)
791
791
  expect(exception["stacktrace"].length).to eq(2)
792
792
 
@@ -810,7 +810,7 @@ describe Bugsnag::Report do
810
810
  report.meta_data.merge!({fluff: {fluff: invalid_data}})
811
811
  end
812
812
 
813
- expect(Bugsnag).to have_sent_notification{ |payload|
813
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
814
814
  event = get_event_from_payload(payload)
815
815
  if defined?(Encoding::UTF_8)
816
816
  expect(event['metaData']['fluff']['fluff']).to match(/fl�ff/)
@@ -831,7 +831,7 @@ describe Bugsnag::Report do
831
831
  Bugsnag.notify $!
832
832
  end
833
833
 
834
- expect(Bugsnag).to have_sent_notification { |payload|
834
+ expect(Bugsnag).to have_sent_notification { |payload, headers|
835
835
  if defined?(Encoding::UTF_8)
836
836
  expect(payload.to_json).to match(/foo�bar/)
837
837
  else
@@ -853,7 +853,7 @@ describe Bugsnag::Report do
853
853
  end
854
854
  end
855
855
 
856
- expect(Bugsnag).to have_sent_notification { |payload|
856
+ expect(Bugsnag).to have_sent_notification { |payload, headers|
857
857
  if defined?(Encoding::UTF_8)
858
858
  expect(payload.to_json).to match(/foo�bar/)
859
859
  else
@@ -876,7 +876,7 @@ describe Bugsnag::Report do
876
876
  Bugsnag.notify $!
877
877
  end
878
878
 
879
- expect(Bugsnag).to have_sent_notification { |payload|
879
+ expect(Bugsnag).to have_sent_notification { |payload, headers|
880
880
  if defined?(Encoding::UTF_8)
881
881
  expect(payload.to_json).to match(/foo�bar/)
882
882
  else
@@ -899,7 +899,7 @@ describe Bugsnag::Report do
899
899
  Bugsnag.notify $!
900
900
  end
901
901
 
902
- expect(Bugsnag).to have_sent_notification { |payload|
902
+ expect(Bugsnag).to have_sent_notification { |payload, headers|
903
903
  if defined?(Encoding::UTF_8)
904
904
  expect(payload.to_json).to match(/foo�bar/)
905
905
  else
@@ -925,7 +925,7 @@ describe Bugsnag::Report do
925
925
  Bugsnag.notify $!
926
926
  end
927
927
 
928
- expect(Bugsnag).to have_sent_notification { |payload|
928
+ expect(Bugsnag).to have_sent_notification { |payload, headers|
929
929
  if defined?(Encoding::UTF_8)
930
930
  expect(payload.to_json).to match(/foo�bar/)
931
931
  else
@@ -943,7 +943,7 @@ describe Bugsnag::Report do
943
943
  Bugsnag.notify $!
944
944
  end
945
945
 
946
- expect(Bugsnag).to have_sent_notification { |payload|
946
+ expect(Bugsnag).to have_sent_notification { |payload, headers|
947
947
  exception = get_exception_from_payload(payload)
948
948
  expect(exception['stacktrace'].size).to be > 0
949
949
  }
@@ -952,7 +952,7 @@ describe Bugsnag::Report do
952
952
  it 'should use defaults when notify is called' do
953
953
  Bugsnag.notify(BugsnagTestException.new("It crashed"))
954
954
 
955
- expect(Bugsnag).to have_sent_notification{ |payload|
955
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
956
956
  event = payload["events"][0]
957
957
  expect(event["unhandled"]).to be false
958
958
  expect(event["severityReason"]).to eq({"type" => "handledException"})
@@ -969,7 +969,7 @@ describe Bugsnag::Report do
969
969
  }
970
970
  end
971
971
 
972
- expect(Bugsnag).to have_sent_notification{ |payload|
972
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
973
973
  event = payload["events"][0]
974
974
  expect(event["severityReason"]).to eq(
975
975
  {
@@ -993,7 +993,7 @@ describe Bugsnag::Report do
993
993
  }
994
994
  end
995
995
 
996
- expect(Bugsnag).to have_sent_notification{ |payload|
996
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
997
997
  event = payload["events"][0]
998
998
  expect(event["unhandled"]).to be false
999
999
  expect(event["severityReason"]).to eq({"type" => "handledException"})
@@ -1017,7 +1017,7 @@ describe Bugsnag::Report do
1017
1017
  Bugsnag.notify $!
1018
1018
  end
1019
1019
 
1020
- expect(Bugsnag).to have_sent_notification{ |payload|
1020
+ expect(Bugsnag).to have_sent_notification{ |payload, headers|
1021
1021
  exception = get_exception_from_payload(payload)
1022
1022
  expect(exception["errorClass"]).to eq('Java::JavaLang::NullPointerException')
1023
1023
  expect(exception["message"]).to eq("")