airbrake 9.2.1 → 9.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/airbrake/rack/middleware.rb +21 -13
- data/lib/airbrake/rails/action_controller_performance_breakdown_subscriber.rb +20 -2
- data/lib/airbrake/version.rb +1 -1
- metadata +5 -81
- data/spec/apps/rack/dummy_app.rb +0 -17
- data/spec/apps/rails/dummy_app.rb +0 -258
- data/spec/apps/rails/dummy_task.rake +0 -15
- data/spec/apps/rails/logs/32.log +0 -34094
- data/spec/apps/rails/logs/42.log +0 -1488
- data/spec/apps/rails/logs/52.log +0 -6321
- data/spec/apps/sinatra/sinatra_test_app.rb +0 -12
- data/spec/integration/rack/rack_spec.rb +0 -19
- data/spec/integration/rails/rails_spec.rb +0 -430
- data/spec/integration/rails/rake_spec.rb +0 -97
- data/spec/integration/shared_examples/rack_examples.rb +0 -110
- data/spec/integration/sinatra/sinatra_spec.rb +0 -30
- data/spec/spec_helper.rb +0 -105
- data/spec/support/matchers/a_notice_with.rb +0 -29
- data/spec/unit/logger_spec.rb +0 -125
- data/spec/unit/rack/context_filter_spec.rb +0 -90
- data/spec/unit/rack/http_headers_filter_spec.rb +0 -44
- data/spec/unit/rack/http_params_filter_spec.rb +0 -58
- data/spec/unit/rack/instrumentable_spec.rb +0 -105
- data/spec/unit/rack/middleware_spec.rb +0 -98
- data/spec/unit/rack/rack_spec.rb +0 -46
- data/spec/unit/rack/request_body_filter_spec.rb +0 -44
- data/spec/unit/rack/request_store_spec.rb +0 -36
- data/spec/unit/rack/route_filter_spec.rb +0 -52
- data/spec/unit/rack/session_filter_spec.rb +0 -44
- data/spec/unit/rack/user_filter_spec.rb +0 -30
- data/spec/unit/rack/user_spec.rb +0 -218
- data/spec/unit/rails/action_cable/notify_callback_spec.rb +0 -26
- data/spec/unit/rails/action_controller_notify_subscriber_spec.rb +0 -43
- data/spec/unit/rails/action_controller_performance_breakdown_subscriber_spec.rb +0 -63
- data/spec/unit/rails/action_controller_route_subscriber_spec.rb +0 -84
- data/spec/unit/rails/active_record_subscriber_spec.rb +0 -70
- data/spec/unit/rails/excon_spec.rb +0 -46
- data/spec/unit/rake/tasks_spec.rb +0 -70
- data/spec/unit/shoryuken_spec.rb +0 -55
- data/spec/unit/sidekiq/retryable_jobs_filter_spec.rb +0 -36
- data/spec/unit/sidekiq_spec.rb +0 -33
- data/spec/unit/sneakers_spec.rb +0 -83
data/spec/unit/sneakers_spec.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'sneakers'
|
2
|
-
require 'airbrake/sneakers'
|
3
|
-
|
4
|
-
RSpec.describe Airbrake::Sneakers::ErrorReporter do
|
5
|
-
let(:worker) do
|
6
|
-
queue = instance_double('queue')
|
7
|
-
allow(queue).to receive_messages(
|
8
|
-
name: 'test-queue',
|
9
|
-
opts: {},
|
10
|
-
exchange: instance_double('exchange')
|
11
|
-
)
|
12
|
-
|
13
|
-
Class.new do
|
14
|
-
include Sneakers::Worker
|
15
|
-
from_queue 'defaults'
|
16
|
-
|
17
|
-
def work(_)
|
18
|
-
raise 'oops error'
|
19
|
-
end
|
20
|
-
end.new(queue)
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:error) { StandardError.new('Something is wrong') }
|
24
|
-
let(:endpoint) { 'https://api.airbrake.io/api/v3/projects/113743/notices' }
|
25
|
-
|
26
|
-
def wait_for_a_request_with_body(body)
|
27
|
-
wait_for(a_request(:post, endpoint).with(body: body)).to have_been_made.once
|
28
|
-
end
|
29
|
-
|
30
|
-
before do
|
31
|
-
stub_request(:post, endpoint).to_return(status: 201, body: '{}')
|
32
|
-
|
33
|
-
Sneakers.configure(daemonize: true, log: '/dev/null')
|
34
|
-
Sneakers::Worker.configure_metrics
|
35
|
-
end
|
36
|
-
|
37
|
-
after { Sneakers.clear! }
|
38
|
-
|
39
|
-
it "should send a notice" do
|
40
|
-
handler = instance_double('handler')
|
41
|
-
expect(handler).to receive(:error).once
|
42
|
-
allow(worker.logger).to receive(:error)
|
43
|
-
worker.do_work(nil, nil, "msg", handler)
|
44
|
-
|
45
|
-
wait_for_a_request_with_body(/"message":"oops error"/)
|
46
|
-
wait_for_a_request_with_body(/test-queue/)
|
47
|
-
wait_for_a_request_with_body(/"component":"sneakers"/)
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should support call without worker" do
|
51
|
-
subject.call(error, message: 'my_glorious_messsage', delivery_info: {})
|
52
|
-
wait_for_a_request_with_body(/"message":"Something is wrong"/)
|
53
|
-
wait_for_a_request_with_body(/"params":{"message":"my_glorious_messsage"/)
|
54
|
-
# worker class is nil so action is NilClass
|
55
|
-
wait_for_a_request_with_body(/"action":"NilClass"/)
|
56
|
-
wait_for_a_request_with_body(/"component":"sneakers"/)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should support call with worker" do
|
60
|
-
subject.call(error, '', message: 'my_special_message', delivery_info: {})
|
61
|
-
wait_for_a_request_with_body(/"message":"Something is wrong"/)
|
62
|
-
wait_for_a_request_with_body(/"params":{"message":"my_special_message"/)
|
63
|
-
# worker class is a String so action is String
|
64
|
-
wait_for_a_request_with_body(/"action":"String"/)
|
65
|
-
wait_for_a_request_with_body(/"component":"sneakers"/)
|
66
|
-
wait_for_a_request_with_body(
|
67
|
-
/"params":{"message":"my_special_message","delivery_info":{}}/
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
71
|
-
described_class::IGNORED_KEYS.each do |key|
|
72
|
-
context "when delivery_info/#{key} is present" do
|
73
|
-
it "filters out #{key}" do
|
74
|
-
subject.call(
|
75
|
-
error, '', message: 'msg', delivery_info: { key => 'a', foo: 'b' }
|
76
|
-
)
|
77
|
-
wait_for_a_request_with_body(
|
78
|
-
/"params":{"message":"msg","delivery_info":{"foo":"b"}}/
|
79
|
-
)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|