airbrake-ruby 6.1.0-java → 6.2.0-java

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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/lib/airbrake-ruby/async_sender.rb +11 -15
  3. data/lib/airbrake-ruby/backlog.rb +123 -0
  4. data/lib/airbrake-ruby/config.rb +7 -0
  5. data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +1 -1
  6. data/lib/airbrake-ruby/nested_exception.rb +22 -1
  7. data/lib/airbrake-ruby/notice.rb +5 -3
  8. data/lib/airbrake-ruby/notice_notifier.rb +1 -0
  9. data/lib/airbrake-ruby/performance_notifier.rb +1 -0
  10. data/lib/airbrake-ruby/response.rb +56 -5
  11. data/lib/airbrake-ruby/sync_sender.rb +41 -10
  12. data/lib/airbrake-ruby/version.rb +1 -1
  13. data/lib/airbrake-ruby.rb +2 -1
  14. metadata +5 -122
  15. data/spec/airbrake_spec.rb +0 -522
  16. data/spec/async_sender_spec.rb +0 -65
  17. data/spec/backtrace_spec.rb +0 -430
  18. data/spec/benchmark_spec.rb +0 -35
  19. data/spec/code_hunk_spec.rb +0 -124
  20. data/spec/config/processor_spec.rb +0 -167
  21. data/spec/config/validator_spec.rb +0 -204
  22. data/spec/config_spec.rb +0 -188
  23. data/spec/context_spec.rb +0 -54
  24. data/spec/deploy_notifier_spec.rb +0 -50
  25. data/spec/file_cache_spec.rb +0 -35
  26. data/spec/filter_chain_spec.rb +0 -124
  27. data/spec/filters/context_filter_spec.rb +0 -32
  28. data/spec/filters/dependency_filter_spec.rb +0 -14
  29. data/spec/filters/exception_attributes_filter_spec.rb +0 -52
  30. data/spec/filters/gem_root_filter_spec.rb +0 -44
  31. data/spec/filters/git_last_checkout_filter_spec.rb +0 -61
  32. data/spec/filters/git_repository_filter_spec.rb +0 -72
  33. data/spec/filters/git_revision_filter_spec.rb +0 -126
  34. data/spec/filters/keys_allowlist_spec.rb +0 -204
  35. data/spec/filters/keys_blocklist_spec.rb +0 -242
  36. data/spec/filters/root_directory_filter_spec.rb +0 -39
  37. data/spec/filters/sql_filter_spec.rb +0 -274
  38. data/spec/filters/system_exit_filter_spec.rb +0 -16
  39. data/spec/filters/thread_filter_spec.rb +0 -281
  40. data/spec/fixtures/notroot.txt +0 -7
  41. data/spec/fixtures/project_root/code.rb +0 -221
  42. data/spec/fixtures/project_root/empty_file.rb +0 -0
  43. data/spec/fixtures/project_root/long_line.txt +0 -1
  44. data/spec/fixtures/project_root/short_file.rb +0 -3
  45. data/spec/fixtures/project_root/vendor/bundle/ignored_file.rb +0 -5
  46. data/spec/helpers.rb +0 -9
  47. data/spec/ignorable_spec.rb +0 -14
  48. data/spec/inspectable_spec.rb +0 -45
  49. data/spec/loggable_spec.rb +0 -17
  50. data/spec/monotonic_time_spec.rb +0 -25
  51. data/spec/nested_exception_spec.rb +0 -73
  52. data/spec/notice_notifier/options_spec.rb +0 -269
  53. data/spec/notice_notifier_spec.rb +0 -361
  54. data/spec/notice_spec.rb +0 -300
  55. data/spec/performance_breakdown_spec.rb +0 -11
  56. data/spec/performance_notifier_spec.rb +0 -645
  57. data/spec/promise_spec.rb +0 -203
  58. data/spec/query_spec.rb +0 -11
  59. data/spec/queue_spec.rb +0 -18
  60. data/spec/remote_settings/callback_spec.rb +0 -162
  61. data/spec/remote_settings/settings_data_spec.rb +0 -348
  62. data/spec/remote_settings_spec.rb +0 -201
  63. data/spec/request_spec.rb +0 -9
  64. data/spec/response_spec.rb +0 -110
  65. data/spec/spec_helper.rb +0 -100
  66. data/spec/stashable_spec.rb +0 -23
  67. data/spec/stat_spec.rb +0 -39
  68. data/spec/sync_sender_spec.rb +0 -168
  69. data/spec/tdigest_spec.rb +0 -235
  70. data/spec/thread_pool_spec.rb +0 -196
  71. data/spec/time_truncate_spec.rb +0 -30
  72. data/spec/timed_trace_spec.rb +0 -127
  73. data/spec/truncator_spec.rb +0 -267
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-13 00:00:00.000000000 Z
11
+ date: 2022-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree-jruby
@@ -40,6 +40,7 @@ extra_rdoc_files: []
40
40
  files:
41
41
  - lib/airbrake-ruby.rb
42
42
  - lib/airbrake-ruby/async_sender.rb
43
+ - lib/airbrake-ruby/backlog.rb
43
44
  - lib/airbrake-ruby/backtrace.rb
44
45
  - lib/airbrake-ruby/benchmark.rb
45
46
  - lib/airbrake-ruby/code_hunk.rb
@@ -93,65 +94,6 @@ files:
93
94
  - lib/airbrake-ruby/timed_trace.rb
94
95
  - lib/airbrake-ruby/truncator.rb
95
96
  - lib/airbrake-ruby/version.rb
96
- - spec/airbrake_spec.rb
97
- - spec/async_sender_spec.rb
98
- - spec/backtrace_spec.rb
99
- - spec/benchmark_spec.rb
100
- - spec/code_hunk_spec.rb
101
- - spec/config/processor_spec.rb
102
- - spec/config/validator_spec.rb
103
- - spec/config_spec.rb
104
- - spec/context_spec.rb
105
- - spec/deploy_notifier_spec.rb
106
- - spec/file_cache_spec.rb
107
- - spec/filter_chain_spec.rb
108
- - spec/filters/context_filter_spec.rb
109
- - spec/filters/dependency_filter_spec.rb
110
- - spec/filters/exception_attributes_filter_spec.rb
111
- - spec/filters/gem_root_filter_spec.rb
112
- - spec/filters/git_last_checkout_filter_spec.rb
113
- - spec/filters/git_repository_filter_spec.rb
114
- - spec/filters/git_revision_filter_spec.rb
115
- - spec/filters/keys_allowlist_spec.rb
116
- - spec/filters/keys_blocklist_spec.rb
117
- - spec/filters/root_directory_filter_spec.rb
118
- - spec/filters/sql_filter_spec.rb
119
- - spec/filters/system_exit_filter_spec.rb
120
- - spec/filters/thread_filter_spec.rb
121
- - spec/fixtures/notroot.txt
122
- - spec/fixtures/project_root/code.rb
123
- - spec/fixtures/project_root/empty_file.rb
124
- - spec/fixtures/project_root/long_line.txt
125
- - spec/fixtures/project_root/short_file.rb
126
- - spec/fixtures/project_root/vendor/bundle/ignored_file.rb
127
- - spec/helpers.rb
128
- - spec/ignorable_spec.rb
129
- - spec/inspectable_spec.rb
130
- - spec/loggable_spec.rb
131
- - spec/monotonic_time_spec.rb
132
- - spec/nested_exception_spec.rb
133
- - spec/notice_notifier/options_spec.rb
134
- - spec/notice_notifier_spec.rb
135
- - spec/notice_spec.rb
136
- - spec/performance_breakdown_spec.rb
137
- - spec/performance_notifier_spec.rb
138
- - spec/promise_spec.rb
139
- - spec/query_spec.rb
140
- - spec/queue_spec.rb
141
- - spec/remote_settings/callback_spec.rb
142
- - spec/remote_settings/settings_data_spec.rb
143
- - spec/remote_settings_spec.rb
144
- - spec/request_spec.rb
145
- - spec/response_spec.rb
146
- - spec/spec_helper.rb
147
- - spec/stashable_spec.rb
148
- - spec/stat_spec.rb
149
- - spec/sync_sender_spec.rb
150
- - spec/tdigest_spec.rb
151
- - spec/thread_pool_spec.rb
152
- - spec/time_truncate_spec.rb
153
- - spec/timed_trace_spec.rb
154
- - spec/truncator_spec.rb
155
97
  homepage: https://airbrake.io
156
98
  licenses:
157
99
  - MIT
@@ -172,67 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
114
  - !ruby/object:Gem::Version
173
115
  version: '0'
174
116
  requirements: []
175
- rubygems_version: 3.2.32
117
+ rubygems_version: 3.3.3
176
118
  signing_key:
177
119
  specification_version: 4
178
120
  summary: Ruby notifier for https://airbrake.io
179
- test_files:
180
- - spec/airbrake_spec.rb
181
- - spec/async_sender_spec.rb
182
- - spec/backtrace_spec.rb
183
- - spec/benchmark_spec.rb
184
- - spec/code_hunk_spec.rb
185
- - spec/config/processor_spec.rb
186
- - spec/config/validator_spec.rb
187
- - spec/config_spec.rb
188
- - spec/context_spec.rb
189
- - spec/deploy_notifier_spec.rb
190
- - spec/file_cache_spec.rb
191
- - spec/filter_chain_spec.rb
192
- - spec/filters/context_filter_spec.rb
193
- - spec/filters/dependency_filter_spec.rb
194
- - spec/filters/exception_attributes_filter_spec.rb
195
- - spec/filters/gem_root_filter_spec.rb
196
- - spec/filters/git_last_checkout_filter_spec.rb
197
- - spec/filters/git_repository_filter_spec.rb
198
- - spec/filters/git_revision_filter_spec.rb
199
- - spec/filters/keys_allowlist_spec.rb
200
- - spec/filters/keys_blocklist_spec.rb
201
- - spec/filters/root_directory_filter_spec.rb
202
- - spec/filters/sql_filter_spec.rb
203
- - spec/filters/system_exit_filter_spec.rb
204
- - spec/filters/thread_filter_spec.rb
205
- - spec/fixtures/notroot.txt
206
- - spec/fixtures/project_root/code.rb
207
- - spec/fixtures/project_root/empty_file.rb
208
- - spec/fixtures/project_root/long_line.txt
209
- - spec/fixtures/project_root/short_file.rb
210
- - spec/fixtures/project_root/vendor/bundle/ignored_file.rb
211
- - spec/helpers.rb
212
- - spec/ignorable_spec.rb
213
- - spec/inspectable_spec.rb
214
- - spec/loggable_spec.rb
215
- - spec/monotonic_time_spec.rb
216
- - spec/nested_exception_spec.rb
217
- - spec/notice_notifier/options_spec.rb
218
- - spec/notice_notifier_spec.rb
219
- - spec/notice_spec.rb
220
- - spec/performance_breakdown_spec.rb
221
- - spec/performance_notifier_spec.rb
222
- - spec/promise_spec.rb
223
- - spec/query_spec.rb
224
- - spec/queue_spec.rb
225
- - spec/remote_settings/callback_spec.rb
226
- - spec/remote_settings/settings_data_spec.rb
227
- - spec/remote_settings_spec.rb
228
- - spec/request_spec.rb
229
- - spec/response_spec.rb
230
- - spec/spec_helper.rb
231
- - spec/stashable_spec.rb
232
- - spec/stat_spec.rb
233
- - spec/sync_sender_spec.rb
234
- - spec/tdigest_spec.rb
235
- - spec/thread_pool_spec.rb
236
- - spec/time_truncate_spec.rb
237
- - spec/timed_trace_spec.rb
238
- - spec/truncator_spec.rb
121
+ test_files: []
@@ -1,522 +0,0 @@
1
- RSpec.describe Airbrake do
2
- let(:remote_settings) { instance_double(Airbrake::RemoteSettings) }
3
-
4
- before do
5
- allow(Airbrake::RemoteSettings).to receive(:poll).and_return(remote_settings)
6
- allow(remote_settings).to receive(:stop_polling)
7
- end
8
-
9
- after { described_class.instance_variable_set(:@remote_settings, nil) }
10
-
11
- it "gets initialized with a performance notifier" do
12
- expect(described_class.performance_notifier).not_to be_nil
13
- end
14
-
15
- it "gets initialized with a notice notifier" do
16
- expect(described_class.notice_notifier).not_to be_nil
17
- end
18
-
19
- it "gets initialized with a deploy notifier" do
20
- expect(described_class.deploy_notifier).not_to be_nil
21
- end
22
-
23
- describe ".configure" do
24
- before do
25
- Airbrake::Config.instance = Airbrake::Config.new
26
- described_class.reset
27
- end
28
-
29
- after { described_class.reset }
30
-
31
- it "yields the config" do
32
- expect do |b|
33
- described_class.configure(&b)
34
- rescue Airbrake::Error
35
- nil
36
- end.to yield_with_args(Airbrake::Config)
37
- end
38
-
39
- it "sets logger to Airbrake::Loggable" do
40
- logger = Logger.new(File::NULL)
41
- described_class.configure do |c|
42
- c.project_id = 1
43
- c.project_key = '123'
44
- c.logger = logger
45
- end
46
-
47
- expect(Airbrake::Loggable.instance).to eql(logger)
48
- end
49
-
50
- it "makes Airbrake configured" do
51
- expect(described_class).not_to be_configured
52
-
53
- described_class.configure do |c|
54
- c.project_id = 1
55
- c.project_key = '2'
56
- end
57
-
58
- expect(described_class).to be_configured
59
- end
60
-
61
- context "when called multiple times" do
62
- it "doesn't overwrite performance notifier" do
63
- described_class.configure { anything }
64
- performance_notifier = described_class.performance_notifier
65
-
66
- described_class.configure { anything }
67
- expect(described_class.performance_notifier).to eql(performance_notifier)
68
- end
69
-
70
- it "doesn't overwrite notice notifier" do
71
- described_class.configure { anything }
72
- notice_notifier = described_class.notice_notifier
73
-
74
- described_class.configure { anything }
75
- expect(described_class.notice_notifier).to eql(notice_notifier)
76
- end
77
-
78
- it "doesn't overwrite deploy notifier" do
79
- described_class.configure { anything }
80
- deploy_notifier = described_class.deploy_notifier
81
-
82
- described_class.configure { anything }
83
- expect(described_class.deploy_notifier).to eql(deploy_notifier)
84
- end
85
-
86
- it "doesn't append the same notice notifier filters over and over" do
87
- described_class.configure do |c|
88
- c.project_id = 1
89
- c.project_key = '2'
90
- end
91
-
92
- allow(described_class.notice_notifier).to receive(:add_filter)
93
-
94
- 10.times { described_class.configure { anything } }
95
-
96
- expect(described_class.notice_notifier).not_to have_received(:add_filter)
97
- end
98
-
99
- it "appends some default filters" do
100
- allow(described_class.notice_notifier).to receive(:add_filter)
101
-
102
- described_class.configure do |c|
103
- c.project_id = 1
104
- c.project_key = '2'
105
- end
106
-
107
- expect(described_class.notice_notifier).to have_received(:add_filter).with(
108
- an_instance_of(Airbrake::Filters::RootDirectoryFilter),
109
- )
110
- end
111
- end
112
-
113
- context "when blocklist_keys gets configured" do
114
- before { allow(described_class.notice_notifier).to receive(:add_filter) }
115
-
116
- it "adds blocklist filter" do
117
- allow(described_class.notice_notifier).to receive(:add_filter)
118
-
119
- described_class.configure { |c| c.blocklist_keys = %w[password] }
120
-
121
- expect(described_class.notice_notifier).to have_received(:add_filter)
122
- .with(an_instance_of(Airbrake::Filters::KeysBlocklist))
123
- end
124
-
125
- it "initializes blocklist with specified parameters" do
126
- allow(Airbrake::Filters::KeysBlocklist).to receive(:new)
127
-
128
- described_class.configure { |c| c.blocklist_keys = %w[password] }
129
-
130
- expect(Airbrake::Filters::KeysBlocklist)
131
- .to have_received(:new).with(%w[password])
132
- end
133
- end
134
-
135
- context "when allowlist_keys gets configured" do
136
- before { allow(described_class.notice_notifier).to receive(:add_filter) }
137
-
138
- it "adds allowlist filter" do
139
- described_class.configure { |c| c.allowlist_keys = %w[banana] }
140
- expect(described_class.notice_notifier).to have_received(:add_filter)
141
- .with(an_instance_of(Airbrake::Filters::KeysAllowlist))
142
- end
143
-
144
- it "initializes allowlist with specified parameters" do
145
- allow(Airbrake::Filters::KeysAllowlist).to receive(:new)
146
-
147
- described_class.configure { |c| c.allowlist_keys = %w[banana] }
148
- expect(Airbrake::Filters::KeysAllowlist)
149
- .to have_received(:new).with(%w[banana])
150
- end
151
- end
152
-
153
- context "when root_directory gets configured" do
154
- before { allow(described_class.notice_notifier).to receive(:add_filter) }
155
-
156
- it "adds root directory filter" do
157
- described_class.configure { |c| c.root_directory = '/my/path' }
158
-
159
- expect(described_class.notice_notifier).to have_received(:add_filter)
160
- .with(an_instance_of(Airbrake::Filters::RootDirectoryFilter))
161
- end
162
-
163
- it "initializes root directory filter with specified path" do
164
- allow(Airbrake::Filters::RootDirectoryFilter).to receive(:new)
165
- described_class.configure { |c| c.root_directory = '/my/path' }
166
-
167
- expect(Airbrake::Filters::RootDirectoryFilter)
168
- .to have_received(:new).with('/my/path')
169
- end
170
-
171
- it "adds git revision filter" do
172
- described_class.configure { |c| c.root_directory = '/my/path' }
173
- expect(described_class.notice_notifier).to have_received(:add_filter)
174
- .with(an_instance_of(Airbrake::Filters::GitRevisionFilter))
175
- end
176
-
177
- it "initializes git revision filter with correct root directory" do
178
- allow(Airbrake::Filters::GitRevisionFilter).to receive(:new)
179
- described_class.configure { |c| c.root_directory = '/my/path' }
180
-
181
- expect(Airbrake::Filters::GitRevisionFilter)
182
- .to have_received(:new).with('/my/path')
183
- end
184
-
185
- it "adds git repository filter" do
186
- described_class.configure { |c| c.root_directory = '/my/path' }
187
-
188
- expect(described_class.notice_notifier).to have_received(:add_filter)
189
- .with(an_instance_of(Airbrake::Filters::GitRepositoryFilter))
190
- end
191
-
192
- it "initializes git repository filter with correct root directory" do
193
- allow(Airbrake::Filters::GitRepositoryFilter).to receive(:new)
194
-
195
- described_class.configure { |c| c.root_directory = '/my/path' }
196
-
197
- expect(Airbrake::Filters::GitRepositoryFilter)
198
- .to have_received(:new).with('/my/path')
199
- end
200
-
201
- it "adds git last checkout filter" do
202
- described_class.configure { |c| c.root_directory = '/my/path' }
203
- expect(described_class.notice_notifier).to have_received(:add_filter)
204
- .with(an_instance_of(Airbrake::Filters::GitLastCheckoutFilter))
205
- end
206
-
207
- it "initializes git last checkout filter with correct root directory" do
208
- allow(Airbrake::Filters::GitLastCheckoutFilter).to receive(:new)
209
- described_class.configure { |c| c.root_directory = '/my/path' }
210
-
211
- expect(Airbrake::Filters::GitLastCheckoutFilter)
212
- .to have_received(:new).with('/my/path')
213
- end
214
- end
215
- end
216
-
217
- describe ".notify_request" do
218
- before do
219
- allow(described_class.performance_notifier).to receive(:notify)
220
- end
221
-
222
- context "when :stash key is not provided" do
223
- it "doesn't add anything to the stash of the request" do
224
- described_class.notify_request(
225
- method: 'GET',
226
- route: '/',
227
- status_code: 200,
228
- timing: 1,
229
- )
230
-
231
- expect(
232
- described_class.performance_notifier,
233
- ).to have_received(:notify) do |request|
234
- expect(request.stash).to be_empty
235
- end
236
- end
237
- end
238
-
239
- context "when :stash key is provided" do
240
- it "adds the value as the stash of the request" do
241
- described_class.notify_request(
242
- {
243
- method: 'GET',
244
- route: '/',
245
- status_code: 200,
246
- timing: 1,
247
- },
248
- request_id: 1,
249
- )
250
-
251
- expect(
252
- described_class.performance_notifier,
253
- ).to have_received(:notify) do |request|
254
- expect(request.stash).to eq(request_id: 1)
255
- end
256
- end
257
- end
258
- end
259
-
260
- describe ".notify_request_sync" do
261
- it "notifies request synchronously" do
262
- allow(described_class.performance_notifier).to receive(:notify_sync)
263
-
264
- described_class.notify_request_sync(
265
- {
266
- method: 'GET',
267
- route: '/',
268
- status_code: 200,
269
- timing: 1,
270
- },
271
- request_id: 1,
272
- )
273
-
274
- expect(described_class.performance_notifier).to have_received(:notify_sync)
275
- end
276
- end
277
-
278
- describe ".notify_query" do
279
- before do
280
- allow(described_class.performance_notifier).to receive(:notify)
281
- end
282
-
283
- context "when :stash key is not provided" do
284
- it "doesn't add anything to the stash of the query" do
285
- described_class.notify_query(
286
- method: 'GET',
287
- route: '/',
288
- query: '',
289
- timing: 1,
290
- )
291
-
292
- expect(
293
- described_class.performance_notifier,
294
- ).to have_received(:notify) do |query|
295
- expect(query.stash).to be_empty
296
- end
297
- end
298
- end
299
-
300
- context "when :stash key is provided" do
301
- it "adds the value as the stash of the query" do
302
- described_class.notify_query(
303
- {
304
- method: 'GET',
305
- route: '/',
306
- query: '',
307
- timing: 1,
308
- },
309
- request_id: 1,
310
- )
311
-
312
- expect(
313
- described_class.performance_notifier,
314
- ).to have_received(:notify) do |query|
315
- expect(query.stash).to eq(request_id: 1)
316
- end
317
- end
318
- end
319
- end
320
-
321
- describe ".notify_query_sync" do
322
- it "notifies query synchronously" do
323
- allow(described_class.performance_notifier).to receive(:notify_sync)
324
-
325
- described_class.notify_query_sync(
326
- {
327
- method: 'GET',
328
- route: '/',
329
- query: '',
330
- timing: 1,
331
- },
332
- request_id: 1,
333
- )
334
-
335
- expect(described_class.performance_notifier).to have_received(:notify_sync)
336
- end
337
- end
338
-
339
- describe ".notify_performance_breakdown" do
340
- before do
341
- allow(described_class.performance_notifier).to receive(:notify)
342
- end
343
-
344
- context "when :stash key is not provided" do
345
- it "doesn't add anything to the stash of the performance breakdown" do
346
- described_class.notify_query(
347
- method: 'GET',
348
- route: '/',
349
- query: '',
350
- timing: 1,
351
- )
352
-
353
- expect(
354
- described_class.performance_notifier,
355
- ).to have_received(:notify) do |query|
356
- expect(query.stash).to be_empty
357
- end
358
- end
359
- end
360
-
361
- context "when :stash key is provided" do
362
- it "adds the value as the stash of the performance breakdown" do
363
- described_class.notify_performance_breakdown(
364
- {
365
- method: 'GET',
366
- route: '/',
367
- response_type: :html,
368
- groups: {},
369
- timing: 1,
370
- },
371
- request_id: 1,
372
- )
373
-
374
- expect(
375
- described_class.performance_notifier,
376
- ).to have_received(:notify) do |performance_breakdown|
377
- expect(performance_breakdown.stash).to eq(request_id: 1)
378
- end
379
- end
380
- end
381
- end
382
-
383
- describe ".notify_performance_breakdown_sync" do
384
- it "notifies performance breakdown synchronously" do
385
- allow(described_class.performance_notifier).to receive(:notify_sync)
386
-
387
- described_class.notify_performance_breakdown_sync(
388
- {
389
- method: 'GET',
390
- route: '/',
391
- response_type: :html,
392
- groups: {},
393
- timing: 1,
394
- },
395
- request_id: 1,
396
- )
397
-
398
- expect(described_class.performance_notifier).to have_received(:notify_sync)
399
- end
400
- end
401
-
402
- describe ".notify_queue" do
403
- before do
404
- allow(described_class.performance_notifier).to receive(:notify)
405
- end
406
-
407
- context "when :stash key is not provided" do
408
- it "doesn't add anything to the stash of the queue" do
409
- described_class.notify_queue(
410
- queue: 'bananas',
411
- error_count: 10,
412
- )
413
-
414
- expect(
415
- described_class.performance_notifier,
416
- ).to have_received(:notify) do |queue|
417
- expect(queue.stash).to be_empty
418
- end
419
- end
420
- end
421
-
422
- context "when :stash key is provided" do
423
- it "adds the value as the stash of the queue" do
424
- described_class.notify_queue(
425
- {
426
- queue: 'bananas',
427
- error_count: 10,
428
- },
429
- request_id: 1,
430
- )
431
-
432
- expect(
433
- described_class.performance_notifier,
434
- ).to have_received(:notify) do |queue|
435
- expect(queue.stash).to eq(request_id: 1)
436
- end
437
- end
438
- end
439
- end
440
-
441
- describe ".notify_queue_sync" do
442
- it "notifies queue synchronously" do
443
- allow(described_class.performance_notifier).to receive(:notify_sync)
444
-
445
- described_class.notify_queue_sync(
446
- {
447
- queue: 'bananas',
448
- error_count: 10,
449
- },
450
- request_id: 1,
451
- )
452
-
453
- expect(described_class.performance_notifier).to have_received(:notify_sync)
454
- end
455
- end
456
-
457
- describe ".performance_notifier" do
458
- it "returns a performance notifier" do
459
- expect(described_class.performance_notifier)
460
- .to be_an(Airbrake::PerformanceNotifier)
461
- end
462
- end
463
-
464
- describe ".notice_notifier" do
465
- it "returns a notice notifier" do
466
- expect(described_class.notice_notifier).to be_an(Airbrake::NoticeNotifier)
467
- end
468
- end
469
-
470
- describe ".deploy_notifier" do
471
- it "returns a deploy notifier" do
472
- expect(described_class.deploy_notifier).to be_an(Airbrake::DeployNotifier)
473
- end
474
- end
475
-
476
- # rubocop:disable RSpec/MessageSpies
477
- describe ".close" do
478
- after { described_class.reset }
479
-
480
- context "when notice_notifier is defined" do
481
- it "gets closed" do
482
- expect(described_class.notice_notifier).to receive(:close)
483
- end
484
- end
485
-
486
- context "when notice_notifier is undefined" do
487
- it "doesn't get closed (because it wasn't initialized)" do
488
- described_class.instance_variable_set(:@notice_notifier, nil)
489
- expect_any_instance_of(Airbrake::NoticeNotifier).not_to receive(:close)
490
- end
491
- end
492
-
493
- context "when performance_notifier is defined" do
494
- it "gets closed" do
495
- expect(described_class.performance_notifier).to receive(:close)
496
- end
497
- end
498
-
499
- context "when perforance_notifier is undefined" do
500
- it "doesn't get closed (because it wasn't initialized)" do
501
- described_class.instance_variable_set(:@performance_notifier, nil)
502
- expect_any_instance_of(Airbrake::PerformanceNotifier)
503
- .not_to receive(:close)
504
- end
505
- end
506
-
507
- context "when remote settings are defined" do
508
- it "stops polling" do
509
- described_class.instance_variable_set(:@remote_settings, remote_settings)
510
- expect(remote_settings).to receive(:stop_polling)
511
- end
512
- end
513
-
514
- context "when remote settings are undefined" do
515
- it "doesn't stop polling (because they weren't initialized)" do
516
- described_class.instance_variable_set(:@remote_settings, nil)
517
- expect(remote_settings).not_to receive(:stop_polling)
518
- end
519
- end
520
- end
521
- # rubocop:enable RSpec/MessageSpies
522
- end