airbrake-ruby 4.2.1 → 4.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-ruby.rb +14 -4
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/airbrake_spec.rb +52 -1
- data/spec/spec_helper.rb +0 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02aed346e7f188d5b5da63e5f193510f43b94b27
|
4
|
+
data.tar.gz: e029092bdc54e5ead538ee74dbda4142e531e442
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 254d23e27fc94213edc957aff6db744e05142024c6e7d3962ccac40c464b2450656b035b1e3261aa4bcbe923a777ae8fe55eeca4a2de8f6bb8d232f89e06cc9d
|
7
|
+
data.tar.gz: 2c417bfb7aca7750c0568e4f49da77c34c92e2b11600af44e66f2e2585d5cc06abe962fc8919ab4a1c70153038d70b504823d395ea8bdf2b5533a4617494fd3c
|
data/lib/airbrake-ruby.rb
CHANGED
@@ -78,10 +78,6 @@ module Airbrake
|
|
78
78
|
# @!macro see_public_api_method
|
79
79
|
# @see Airbrake.$0
|
80
80
|
|
81
|
-
@performance_notifier = PerformanceNotifier.new
|
82
|
-
@notice_notifier = NoticeNotifier.new
|
83
|
-
@deploy_notifier = DeployNotifier.new
|
84
|
-
|
85
81
|
class << self
|
86
82
|
# Configures the Airbrake notifier.
|
87
83
|
#
|
@@ -100,6 +96,7 @@ module Airbrake
|
|
100
96
|
def configure
|
101
97
|
yield config = Airbrake::Config.instance
|
102
98
|
Airbrake::Loggable.instance = config.logger
|
99
|
+
reset
|
103
100
|
end
|
104
101
|
|
105
102
|
# @return [Boolean] true if the notifier was configured, false otherwise
|
@@ -436,5 +433,18 @@ module Airbrake
|
|
436
433
|
def delete_performance_filter(filter_class)
|
437
434
|
@performance_notifier.delete_filter(filter_class)
|
438
435
|
end
|
436
|
+
|
437
|
+
# Resets all notifiers, including its filters
|
438
|
+
# @return [void]
|
439
|
+
# @since v4.2.2
|
440
|
+
def reset
|
441
|
+
close if @notice_notifier && configured?
|
442
|
+
|
443
|
+
@performance_notifier = PerformanceNotifier.new
|
444
|
+
@notice_notifier = NoticeNotifier.new
|
445
|
+
@deploy_notifier = DeployNotifier.new
|
446
|
+
end
|
439
447
|
end
|
440
448
|
end
|
449
|
+
|
450
|
+
Airbrake.reset
|
data/spec/airbrake_spec.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
RSpec.describe Airbrake do
|
2
|
-
before
|
2
|
+
before do
|
3
|
+
Airbrake::Config.instance = Airbrake::Config.new
|
4
|
+
described_class.reset
|
5
|
+
end
|
6
|
+
|
7
|
+
after { described_class.reset }
|
3
8
|
|
4
9
|
describe ".configure" do
|
5
10
|
it "yields the config" do
|
@@ -22,5 +27,51 @@ RSpec.describe Airbrake do
|
|
22
27
|
|
23
28
|
expect(Airbrake::Loggable.instance).to eql(logger)
|
24
29
|
end
|
30
|
+
|
31
|
+
it "makes Airbrake configured" do
|
32
|
+
expect(described_class).not_to be_configured
|
33
|
+
|
34
|
+
described_class.configure do |c|
|
35
|
+
c.project_id = 1
|
36
|
+
c.project_key = '2'
|
37
|
+
end
|
38
|
+
|
39
|
+
expect(described_class).to be_configured
|
40
|
+
end
|
41
|
+
|
42
|
+
context "when a notifier was configured" do
|
43
|
+
before do
|
44
|
+
expect(described_class).to receive(:configured?).twice.and_return(true)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "closes previously configured notice notifier" do
|
48
|
+
expect(described_class).to receive(:close).twice
|
49
|
+
described_class.configure {}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "when a notifier wasn't configured" do
|
54
|
+
before do
|
55
|
+
expect(described_class).to receive(:configured?).twice.and_return(false)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "doesn't close previously configured notice notifier" do
|
59
|
+
expect(described_class).not_to receive(:close)
|
60
|
+
described_class.configure {}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "#reset" do
|
66
|
+
context "when Airbrake was previously configured" do
|
67
|
+
before do
|
68
|
+
expect(described_class).to receive(:configured?).twice.and_return(true)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "closes notice notifier" do
|
72
|
+
expect(described_class).to receive(:close).twice
|
73
|
+
subject.reset
|
74
|
+
end
|
75
|
+
end
|
25
76
|
end
|
26
77
|
end
|
data/spec/spec_helper.rb
CHANGED
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: 4.2.
|
4
|
+
version: 4.2.2
|
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-03-
|
11
|
+
date: 2019-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbtree3
|