airbrake-ruby 4.2.1-java → 4.2.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9e06910893059d6b1edc1e736226a565baf2e76
4
- data.tar.gz: 1f0973aa904e653d9e84912c5be4a3b6f69e9670
3
+ metadata.gz: 98cb0154c5664568cd2fc6d7becf87e3a3cce093
4
+ data.tar.gz: e029092bdc54e5ead538ee74dbda4142e531e442
5
5
  SHA512:
6
- metadata.gz: 14ba2aca76ab70c744b6d026814a4e4ee69eb281e5048507a7e3dfdad77c4939e8817b43599ffcf11be3d594d1a7c2e310ee0bb5b5f3ede73e171c9bbc697f1f
7
- data.tar.gz: 5cd4dae34942ae97efa61210f35ab50cdd1e3c6f3d7a428598a627d9e77b457b466d68aa7a474f0f4198d31a45feee1d2e488b728c05e069f065f1044f0c3a7e
6
+ metadata.gz: fce1fff2f9b1dd77063ba99435521d7b9620657213c0bbfb09b886b8d71804a559b4a41d2281eac8dc420971a0b8a6b8231d4b99aaf7f242aa53b108dbbdcf6d
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
@@ -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
data/spec/spec_helper.rb CHANGED
@@ -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: java
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: rbtree-jruby