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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4afc2ce123b0443711d5000b9a4915756155688
4
- data.tar.gz: 1f0973aa904e653d9e84912c5be4a3b6f69e9670
3
+ metadata.gz: 02aed346e7f188d5b5da63e5f193510f43b94b27
4
+ data.tar.gz: e029092bdc54e5ead538ee74dbda4142e531e442
5
5
  SHA512:
6
- metadata.gz: 0431f29c2a8f926d47c551439d9e000b429b8e0a6c815bc7fbdf01e4833ed4bf79d0d6e2aee2c516220be4cdd40e047b7bb5494e3cdb1b894980dbfae7a6a1bf
7
- data.tar.gz: 5cd4dae34942ae97efa61210f35ab50cdd1e3c6f3d7a428598a627d9e77b457b466d68aa7a474f0f4198d31a45feee1d2e488b728c05e069f065f1044f0c3a7e
6
+ metadata.gz: 254d23e27fc94213edc957aff6db744e05142024c6e7d3962ccac40c464b2450656b035b1e3261aa4bcbe923a777ae8fe55eeca4a2de8f6bb8d232f89e06cc9d
7
+ data.tar.gz: 2c417bfb7aca7750c0568e4f49da77c34c92e2b11600af44e66f2e2585d5cc06abe962fc8919ab4a1c70153038d70b504823d395ea8bdf2b5533a4617494fd3c
@@ -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
@@ -2,5 +2,5 @@
2
2
  # More information: http://semver.org/
3
3
  module Airbrake
4
4
  # @return [String] the library version
5
- AIRBRAKE_RUBY_VERSION = '4.2.1'.freeze
5
+ AIRBRAKE_RUBY_VERSION = '4.2.2'.freeze
6
6
  end
@@ -1,5 +1,10 @@
1
1
  RSpec.describe Airbrake do
2
- before { Airbrake::Config.instance = Airbrake::Config.new }
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
@@ -98,10 +98,3 @@ class Ruby21Error < RuntimeError
98
98
  raise ex
99
99
  end
100
100
  end
101
-
102
- puts <<BANNER
103
- #{'#' * 80}
104
- # RUBY_VERSION: #{RUBY_VERSION}
105
- # RUBY_ENGINE: #{RUBY_ENGINE}
106
- #{'#' * 80}
107
- BANNER
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.1
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-14 00:00:00.000000000 Z
11
+ date: 2019-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree3