airbrake 8.0.1 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,14 @@ require 'spec_helper'
3
3
  RSpec.describe "Rake integration" do
4
4
  let(:endpoint) { 'https://api.airbrake.io/api/v3/projects/113743/notices' }
5
5
 
6
+ let(:routes_endpoint) do
7
+ 'https://api.airbrake.io/api/v5/projects/113743/routes-stats'
8
+ end
9
+
10
+ let(:queries_endpoint) do
11
+ 'https://api.airbrake.io/api/v5/projects/113743/queries-stats'
12
+ end
13
+
6
14
  def wait_for_a_request_with_body(body)
7
15
  wait_for(a_request(:post, endpoint).with(body: body)).to have_been_made.once
8
16
  end
@@ -13,8 +21,16 @@ RSpec.describe "Rake integration" do
13
21
  end
14
22
 
15
23
  before do
16
- Rails.application.load_tasks
17
24
  stub_request(:post, endpoint).to_return(status: 201, body: '{}')
25
+
26
+ # Airbrake Ruby has a background thread that sends performance requests
27
+ # periodically. We don't want this to get in the way.
28
+ [routes_endpoint, queries_endpoint].each do |e|
29
+ stub_request(:put, e).to_return(status: 200, body: '')
30
+ end
31
+
32
+ Rails.application.load_tasks
33
+
18
34
  expect { faulty_task.invoke }.to raise_error(AirbrakeTestError)
19
35
  end
20
36
 
@@ -5,15 +5,31 @@ RSpec.shared_examples 'rack examples' do
5
5
 
6
6
  let(:endpoint) { 'https://api.airbrake.io/api/v3/projects/113743/notices' }
7
7
 
8
+ let(:routes_endpoint) do
9
+ 'https://api.airbrake.io/api/v5/projects/113743/routes-stats'
10
+ end
11
+
12
+ let(:queries_endpoint) do
13
+ 'https://api.airbrake.io/api/v5/projects/113743/queries-stats'
14
+ end
15
+
8
16
  def wait_for_a_request_with_body(body)
9
- wait_for(a_request(:post, endpoint).with(body: body)).to have_been_made.once
17
+ allow(Airbrake.notifiers[:performance][:default]).
18
+ to receive(:notify).and_return(nil)
19
+ wait_for(a_request(:post, endpoint).with(body: body)).
20
+ to have_been_made.at_least_once
10
21
  end
11
22
 
12
23
  before do
13
24
  # Make sure the Logger integration doesn't get in the way.
14
25
  allow_any_instance_of(Logger).to receive(:airbrake_notifier).and_return(nil)
15
26
 
16
- stub_request(:post, endpoint).to_return(status: 201, body: '{}')
27
+ allow(Airbrake.notifiers[:performance][:default]).
28
+ to receive(:notify).and_return(nil)
29
+ stub_request(:post, endpoint).to_return(status: 200, body: '')
30
+ [routes_endpoint, queries_endpoint].each do |endpoint|
31
+ stub_request(:put, endpoint).to_return(status: 200, body: '')
32
+ end
17
33
  end
18
34
 
19
35
  describe "application routes" do
@@ -47,6 +63,7 @@ RSpec.shared_examples 'rack examples' do
47
63
  before do
48
64
  login_as(OpenStruct.new(user_params))
49
65
  get '/crash'
66
+ sleep 2
50
67
  end
51
68
 
52
69
  context "when the user has first and last names" do
@@ -87,6 +104,7 @@ RSpec.shared_examples 'rack examples' do
87
104
  context "when additional parameters present" do
88
105
  before do
89
106
  get '/crash', nil, 'HTTP_USER_AGENT' => 'Bot', 'HTTP_REFERER' => 'bingo.com'
107
+ sleep 2
90
108
  end
91
109
 
92
110
  it "contains url" do
@@ -56,7 +56,7 @@ RSpec.describe Airbrake::Shoryuken::ErrorHandler do
56
56
 
57
57
  context 'when Airbrake is not configured' do
58
58
  before do
59
- @notifiers = Airbrake.instance_variable_get(:@notifiers)
59
+ @notifiers = Airbrake.notifiers[:notice]
60
60
  @default_notifier = @notifiers.delete(:default)
61
61
  end
62
62
 
@@ -34,7 +34,7 @@ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.2.2')
34
34
 
35
35
  context "when Airbrake is not configured" do
36
36
  before do
37
- @notifiers = Airbrake.instance_variable_get(:@notifiers)
37
+ @notifiers = Airbrake.notifiers[:notice]
38
38
  @default_notifier = @notifiers.delete(:default)
39
39
  end
40
40
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.1
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-23 00:00:00.000000000 Z
11
+ date: 2019-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake-ruby
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -260,9 +260,11 @@ files:
260
260
  - lib/airbrake/rack/user_filter.rb
261
261
  - lib/airbrake/rails.rb
262
262
  - lib/airbrake/rails/action_controller.rb
263
- - lib/airbrake/rails/action_controller_subscriber.rb
263
+ - lib/airbrake/rails/action_controller_notify_subscriber.rb
264
+ - lib/airbrake/rails/action_controller_route_subscriber.rb
264
265
  - lib/airbrake/rails/active_job.rb
265
266
  - lib/airbrake/rails/active_record.rb
267
+ - lib/airbrake/rails/active_record_subscriber.rb
266
268
  - lib/airbrake/rake.rb
267
269
  - lib/airbrake/rake/tasks.rb
268
270
  - lib/airbrake/resque.rb