airbrake 9.2.1 → 9.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/airbrake/rack/middleware.rb +21 -13
  3. data/lib/airbrake/rails/action_controller_performance_breakdown_subscriber.rb +20 -2
  4. data/lib/airbrake/version.rb +1 -1
  5. metadata +5 -81
  6. data/spec/apps/rack/dummy_app.rb +0 -17
  7. data/spec/apps/rails/dummy_app.rb +0 -258
  8. data/spec/apps/rails/dummy_task.rake +0 -15
  9. data/spec/apps/rails/logs/32.log +0 -34094
  10. data/spec/apps/rails/logs/42.log +0 -1488
  11. data/spec/apps/rails/logs/52.log +0 -6321
  12. data/spec/apps/sinatra/sinatra_test_app.rb +0 -12
  13. data/spec/integration/rack/rack_spec.rb +0 -19
  14. data/spec/integration/rails/rails_spec.rb +0 -430
  15. data/spec/integration/rails/rake_spec.rb +0 -97
  16. data/spec/integration/shared_examples/rack_examples.rb +0 -110
  17. data/spec/integration/sinatra/sinatra_spec.rb +0 -30
  18. data/spec/spec_helper.rb +0 -105
  19. data/spec/support/matchers/a_notice_with.rb +0 -29
  20. data/spec/unit/logger_spec.rb +0 -125
  21. data/spec/unit/rack/context_filter_spec.rb +0 -90
  22. data/spec/unit/rack/http_headers_filter_spec.rb +0 -44
  23. data/spec/unit/rack/http_params_filter_spec.rb +0 -58
  24. data/spec/unit/rack/instrumentable_spec.rb +0 -105
  25. data/spec/unit/rack/middleware_spec.rb +0 -98
  26. data/spec/unit/rack/rack_spec.rb +0 -46
  27. data/spec/unit/rack/request_body_filter_spec.rb +0 -44
  28. data/spec/unit/rack/request_store_spec.rb +0 -36
  29. data/spec/unit/rack/route_filter_spec.rb +0 -52
  30. data/spec/unit/rack/session_filter_spec.rb +0 -44
  31. data/spec/unit/rack/user_filter_spec.rb +0 -30
  32. data/spec/unit/rack/user_spec.rb +0 -218
  33. data/spec/unit/rails/action_cable/notify_callback_spec.rb +0 -26
  34. data/spec/unit/rails/action_controller_notify_subscriber_spec.rb +0 -43
  35. data/spec/unit/rails/action_controller_performance_breakdown_subscriber_spec.rb +0 -63
  36. data/spec/unit/rails/action_controller_route_subscriber_spec.rb +0 -84
  37. data/spec/unit/rails/active_record_subscriber_spec.rb +0 -70
  38. data/spec/unit/rails/excon_spec.rb +0 -46
  39. data/spec/unit/rake/tasks_spec.rb +0 -70
  40. data/spec/unit/shoryuken_spec.rb +0 -55
  41. data/spec/unit/sidekiq/retryable_jobs_filter_spec.rb +0 -36
  42. data/spec/unit/sidekiq_spec.rb +0 -33
  43. data/spec/unit/sneakers_spec.rb +0 -83
@@ -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