airbrake-ruby 5.0.0.rc.2-java → 5.2.0-java
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 +1 -0
- data/lib/airbrake-ruby/backtrace.rb +6 -5
- data/lib/airbrake-ruby/config.rb +19 -38
- data/lib/airbrake-ruby/config/processor.rb +8 -17
- data/lib/airbrake-ruby/config/validator.rb +2 -0
- data/lib/airbrake-ruby/file_cache.rb +1 -1
- data/lib/airbrake-ruby/filter_chain.rb +1 -0
- data/lib/airbrake-ruby/filters/dependency_filter.rb +1 -0
- data/lib/airbrake-ruby/filters/gem_root_filter.rb +1 -0
- data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +1 -2
- data/lib/airbrake-ruby/filters/git_repository_filter.rb +3 -0
- data/lib/airbrake-ruby/filters/git_revision_filter.rb +2 -0
- data/lib/airbrake-ruby/filters/keys_filter.rb +21 -13
- data/lib/airbrake-ruby/filters/root_directory_filter.rb +1 -0
- data/lib/airbrake-ruby/filters/sql_filter.rb +4 -4
- data/lib/airbrake-ruby/filters/system_exit_filter.rb +1 -0
- data/lib/airbrake-ruby/filters/thread_filter.rb +3 -2
- data/lib/airbrake-ruby/grouppable.rb +1 -1
- data/lib/airbrake-ruby/ignorable.rb +1 -0
- data/lib/airbrake-ruby/mergeable.rb +1 -1
- data/lib/airbrake-ruby/notice_notifier.rb +1 -0
- data/lib/airbrake-ruby/performance_breakdown.rb +1 -6
- data/lib/airbrake-ruby/performance_notifier.rb +1 -14
- data/lib/airbrake-ruby/promise.rb +1 -0
- data/lib/airbrake-ruby/query.rb +1 -6
- data/lib/airbrake-ruby/queue.rb +1 -8
- data/lib/airbrake-ruby/remote_settings.rb +16 -54
- data/lib/airbrake-ruby/remote_settings/callback.rb +44 -0
- data/lib/airbrake-ruby/remote_settings/settings_data.rb +14 -14
- data/lib/airbrake-ruby/request.rb +1 -8
- data/lib/airbrake-ruby/stat.rb +1 -12
- data/lib/airbrake-ruby/sync_sender.rb +1 -0
- data/lib/airbrake-ruby/tdigest.rb +2 -0
- data/lib/airbrake-ruby/thread_pool.rb +1 -0
- data/lib/airbrake-ruby/truncator.rb +8 -2
- data/lib/airbrake-ruby/version.rb +2 -2
- data/spec/backtrace_spec.rb +26 -26
- data/spec/code_hunk_spec.rb +2 -2
- data/spec/config/processor_spec.rb +21 -101
- data/spec/config_spec.rb +5 -29
- data/spec/filters/gem_root_filter_spec.rb +4 -4
- data/spec/filters/git_last_checkout_filter_spec.rb +1 -1
- data/spec/filters/keys_allowlist_spec.rb +1 -0
- data/spec/filters/keys_blocklist_spec.rb +10 -0
- data/spec/filters/root_directory_filter_spec.rb +4 -4
- data/spec/filters/sql_filter_spec.rb +2 -2
- data/spec/filters/thread_filter_spec.rb +1 -1
- data/spec/notice_notifier/options_spec.rb +2 -2
- data/spec/notice_notifier_spec.rb +2 -2
- data/spec/notice_spec.rb +1 -1
- data/spec/performance_breakdown_spec.rb +0 -12
- data/spec/performance_notifier_spec.rb +0 -25
- data/spec/query_spec.rb +1 -11
- data/spec/queue_spec.rb +1 -13
- data/spec/remote_settings/callback_spec.rb +143 -0
- data/spec/remote_settings/settings_data_spec.rb +34 -13
- data/spec/remote_settings_spec.rb +40 -83
- data/spec/request_spec.rb +1 -13
- data/spec/spec_helper.rb +4 -4
- data/spec/stat_spec.rb +0 -9
- data/spec/tdigest_spec.rb +1 -1
- metadata +8 -5
data/spec/config_spec.rb
CHANGED
@@ -26,7 +26,11 @@ RSpec.describe Airbrake::Config do
|
|
26
26
|
its(:query_stats) { is_expected.to eq(true) }
|
27
27
|
its(:job_stats) { is_expected.to eq(true) }
|
28
28
|
its(:error_notifications) { is_expected.to eq(true) }
|
29
|
-
its(:
|
29
|
+
its(:remote_config) { is_expected.to eq(true) }
|
30
|
+
|
31
|
+
its(:remote_config_host) do
|
32
|
+
is_expected.to eq('https://notifier-configs.airbrake.io')
|
33
|
+
end
|
30
34
|
|
31
35
|
describe "#new" do
|
32
36
|
context "when user config is passed" do
|
@@ -173,32 +177,4 @@ RSpec.describe Airbrake::Config do
|
|
173
177
|
expect(subject.logger.level).to eq(Logger::WARN)
|
174
178
|
end
|
175
179
|
end
|
176
|
-
|
177
|
-
describe "#blacklist_keys=" do
|
178
|
-
before { allow(Kernel).to receive(:warn) }
|
179
|
-
|
180
|
-
it "sets blocklist_keys instead" do
|
181
|
-
subject.blacklist_keys = [1, 2, 3]
|
182
|
-
expect(subject.blocklist_keys).to eq([1, 2, 3])
|
183
|
-
end
|
184
|
-
|
185
|
-
it "prints a warning" do
|
186
|
-
expect(Kernel).to receive(:warn).with(/use blocklist_keys= instead/)
|
187
|
-
subject.blacklist_keys = [1, 2, 3]
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe "#whitelist_keys=" do
|
192
|
-
before { allow(Kernel).to receive(:warn) }
|
193
|
-
|
194
|
-
it "sets allowlist_keys instead" do
|
195
|
-
subject.whitelist_keys = [1, 2, 3]
|
196
|
-
expect(subject.allowlist_keys).to eq([1, 2, 3])
|
197
|
-
end
|
198
|
-
|
199
|
-
it "prints a warning" do
|
200
|
-
expect(Kernel).to receive(:warn).with(/use allowlist_keys= instead/)
|
201
|
-
subject.whitelist_keys = [1, 2, 3]
|
202
|
-
end
|
203
|
-
end
|
204
180
|
end
|
@@ -7,18 +7,18 @@ RSpec.describe Airbrake::Filters::GemRootFilter do
|
|
7
7
|
after { 2.times { Gem.path.pop } }
|
8
8
|
|
9
9
|
it "replaces gem root in the backtrace with a label" do
|
10
|
-
# rubocop:disable
|
10
|
+
# rubocop:disable Layout/LineLength
|
11
11
|
notice[:errors].first[:backtrace] = [
|
12
12
|
{ file: "/home/kyrylo/code/airbrake/ruby/spec/spec_helper.rb" },
|
13
13
|
{ file: "#{root1}/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb" },
|
14
14
|
{ file: "/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb" },
|
15
15
|
{ file: "#{root2}/gems/rspec-core-3.3.2/exe/rspec" },
|
16
16
|
]
|
17
|
-
# rubocop:enable
|
17
|
+
# rubocop:enable Layout/LineLength
|
18
18
|
|
19
19
|
subject.call(notice)
|
20
20
|
|
21
|
-
# rubocop:disable
|
21
|
+
# rubocop:disable Layout/LineLength
|
22
22
|
expect(notice[:errors].first[:backtrace]).to(
|
23
23
|
eq(
|
24
24
|
[
|
@@ -29,7 +29,7 @@ RSpec.describe Airbrake::Filters::GemRootFilter do
|
|
29
29
|
],
|
30
30
|
),
|
31
31
|
)
|
32
|
-
# rubocop:enable
|
32
|
+
# rubocop:enable Layout/LineLength
|
33
33
|
end
|
34
34
|
|
35
35
|
it "does not filter file when it is nil" do
|
@@ -44,7 +44,7 @@ RSpec.describe Airbrake::Filters::GitLastCheckoutFilter do
|
|
44
44
|
it "attaches last checkouted email" do
|
45
45
|
subject.call(notice)
|
46
46
|
expect(notice[:context][:lastCheckout][:email]).to(
|
47
|
-
match(/\A\w+[\w.-]
|
47
|
+
match(/\A\w+[\w.-]*@(\w+\.)*\w+\z/),
|
48
48
|
)
|
49
49
|
end
|
50
50
|
|
@@ -151,6 +151,7 @@ RSpec.describe Airbrake::Filters::KeysAllowlist do
|
|
151
151
|
# thing. One is a Java exception, the other is a Ruby exception.
|
152
152
|
# Likely a bug: https://github.com/jruby/jruby/issues/1903
|
153
153
|
raise ex unless RUBY_ENGINE == 'jruby'
|
154
|
+
|
154
155
|
expect { subject.call(notice) }.to raise_error(java.lang.StackOverflowError)
|
155
156
|
end
|
156
157
|
end
|
@@ -150,6 +150,16 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
|
|
150
150
|
{ bongo: { bish: '[Filtered]' } },
|
151
151
|
],
|
152
152
|
)
|
153
|
+
|
154
|
+
it "doesn't mutate the original hash" do
|
155
|
+
params = { bongo: { bish: 'bash' } }
|
156
|
+
notice[:params] = params
|
157
|
+
|
158
|
+
blocklist = described_class.new([:bish])
|
159
|
+
blocklist.call(notice)
|
160
|
+
|
161
|
+
expect(params[:bongo][:bish]).to eq('bash')
|
162
|
+
end
|
153
163
|
end
|
154
164
|
|
155
165
|
context "and it is recursive" do
|
@@ -5,18 +5,18 @@ RSpec.describe Airbrake::Filters::RootDirectoryFilter do
|
|
5
5
|
let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) }
|
6
6
|
|
7
7
|
it "replaces root directory in the backtrace with a label" do
|
8
|
-
# rubocop:disable
|
8
|
+
# rubocop:disable Layout/LineLength
|
9
9
|
notice[:errors].first[:backtrace] = [
|
10
10
|
{ file: "/home/kyrylo/code/airbrake/ruby/spec/spec_helper.rb" },
|
11
11
|
{ file: "#{root_directory}/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb " },
|
12
12
|
{ file: "/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb" },
|
13
13
|
{ file: "#{root_directory}/gems/rspec-core-3.3.2/exe/rspec" },
|
14
14
|
]
|
15
|
-
# rubocop:enable
|
15
|
+
# rubocop:enable Layout/LineLength
|
16
16
|
|
17
17
|
subject.call(notice)
|
18
18
|
|
19
|
-
# rubocop:disable
|
19
|
+
# rubocop:disable Layout/LineLength
|
20
20
|
expect(notice[:errors].first[:backtrace]).to(
|
21
21
|
eq(
|
22
22
|
[
|
@@ -27,7 +27,7 @@ RSpec.describe Airbrake::Filters::RootDirectoryFilter do
|
|
27
27
|
],
|
28
28
|
),
|
29
29
|
)
|
30
|
-
# rubocop:enable
|
30
|
+
# rubocop:enable Layout/LineLength
|
31
31
|
end
|
32
32
|
|
33
33
|
it "does not filter file when it is nil" do
|
@@ -22,7 +22,7 @@ RSpec.describe Airbrake::Filters::SqlFilter do
|
|
22
22
|
|
23
23
|
ALL_DIALECTS = %i[mysql postgres sqlite cassandra oracle].freeze
|
24
24
|
|
25
|
-
# rubocop:disable
|
25
|
+
# rubocop:disable Layout/LineLength
|
26
26
|
[
|
27
27
|
{
|
28
28
|
input: 'SELECT * FROM things;',
|
@@ -229,7 +229,7 @@ RSpec.describe Airbrake::Filters::SqlFilter do
|
|
229
229
|
].each do |test|
|
230
230
|
include_examples 'query filtering', test
|
231
231
|
end
|
232
|
-
# rubocop:enable
|
232
|
+
# rubocop:enable Layout/LineLength
|
233
233
|
|
234
234
|
[
|
235
235
|
'COMMIT',
|
@@ -149,10 +149,10 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
149
149
|
expect(proxied_request.header['proxy-authorization'].first)
|
150
150
|
.to eq('Basic dXNlcjpwYXNzd29yZA==')
|
151
151
|
|
152
|
-
# rubocop:disable
|
152
|
+
# rubocop:disable Layout/LineLength
|
153
153
|
expect(proxied_request.request_line)
|
154
154
|
.to eq("POST http://localhost:#{proxy.config[:Port]}/api/v3/projects/105138/notices HTTP/1.1\r\n")
|
155
|
-
# rubocop:enable
|
155
|
+
# rubocop:enable Layout/LineLength
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
@@ -309,7 +309,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
309
309
|
|
310
310
|
notice = subject.build_notice(Exception.new)
|
311
311
|
|
312
|
-
# rubocop:disable
|
312
|
+
# rubocop:disable Layout/LineLength
|
313
313
|
expect(notice[:errors].first[:backtrace]).to eq(
|
314
314
|
[
|
315
315
|
{ file: 'org/jruby/RubyKernel.java', line: 998, function: 'eval' },
|
@@ -317,7 +317,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
317
317
|
{ file: '/ruby/stdlib/irb.rb:489', line: 489, function: 'block in eval_input' },
|
318
318
|
],
|
319
319
|
)
|
320
|
-
# rubocop:enable
|
320
|
+
# rubocop:enable Layout/LineLength
|
321
321
|
end
|
322
322
|
end
|
323
323
|
|
data/spec/notice_spec.rb
CHANGED
@@ -268,7 +268,7 @@ RSpec.describe Airbrake::Notice do
|
|
268
268
|
it "sets a payload value" do
|
269
269
|
hash = { bingo: 'bango' }
|
270
270
|
notice[:params] = hash
|
271
|
-
expect(notice[:params]).to
|
271
|
+
expect(notice[:params]).to eq(hash)
|
272
272
|
end
|
273
273
|
|
274
274
|
it "raises error if notice is ignored" do
|
@@ -3,21 +3,9 @@ RSpec.describe Airbrake::PerformanceBreakdown do
|
|
3
3
|
subject do
|
4
4
|
described_class.new(
|
5
5
|
method: 'GET', route: '/', response_type: '', groups: {},
|
6
|
-
start_time: Time.now
|
7
6
|
)
|
8
7
|
end
|
9
8
|
|
10
9
|
it { is_expected.to respond_to(:stash) }
|
11
10
|
end
|
12
|
-
|
13
|
-
describe "#end_time" do
|
14
|
-
it "is always equal to start_time + 1 second by default" do
|
15
|
-
time = Time.now
|
16
|
-
performance_breakdown = described_class.new(
|
17
|
-
method: 'GET', route: '/', response_type: '', groups: {},
|
18
|
-
start_time: time
|
19
|
-
)
|
20
|
-
expect(performance_breakdown.end_time).to eq(time + 1)
|
21
|
-
end
|
22
|
-
end
|
23
11
|
end
|
@@ -541,31 +541,6 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
541
541
|
end
|
542
542
|
end
|
543
543
|
|
544
|
-
context "when :start_time is specified (deprecated)" do
|
545
|
-
before do
|
546
|
-
allow(Kernel).to receive(:warn)
|
547
|
-
end
|
548
|
-
|
549
|
-
it "uses the value of :start_time to update stat" do
|
550
|
-
subject.notify(
|
551
|
-
Airbrake::Query.new(
|
552
|
-
method: 'POST',
|
553
|
-
route: '/foo',
|
554
|
-
query: 'SELECT * FROM things',
|
555
|
-
start_time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
556
|
-
end_time: Time.new(2018, 1, 1, 0, 50, 0, 0),
|
557
|
-
),
|
558
|
-
)
|
559
|
-
subject.close
|
560
|
-
|
561
|
-
expect(
|
562
|
-
a_request(:put, queries).with(
|
563
|
-
body: /"count":1,"sum":60000.0,"sumsq":3600000000.0/,
|
564
|
-
),
|
565
|
-
).to have_been_made
|
566
|
-
end
|
567
|
-
end
|
568
|
-
|
569
544
|
context "when provided :timing is zero" do
|
570
545
|
it "doesn't notify" do
|
571
546
|
queue = Airbrake::Queue.new(queue: 'bananas', error_count: 0, timing: 0)
|
data/spec/query_spec.rb
CHANGED
@@ -2,20 +2,10 @@ RSpec.describe Airbrake::Query do
|
|
2
2
|
describe "#stash" do
|
3
3
|
subject do
|
4
4
|
described_class.new(
|
5
|
-
method: 'GET', route: '/', query: '',
|
5
|
+
method: 'GET', route: '/', query: '',
|
6
6
|
)
|
7
7
|
end
|
8
8
|
|
9
9
|
it { is_expected.to respond_to(:stash) }
|
10
10
|
end
|
11
|
-
|
12
|
-
describe "#end_time" do
|
13
|
-
it "is always equal to start_time + 1 second by default" do
|
14
|
-
time = Time.now
|
15
|
-
query = described_class.new(
|
16
|
-
method: 'GET', route: '/', query: '', start_time: time,
|
17
|
-
)
|
18
|
-
expect(query.end_time).to eq(time + 1)
|
19
|
-
end
|
20
|
-
end
|
21
11
|
end
|
data/spec/queue_spec.rb
CHANGED
@@ -9,21 +9,9 @@ RSpec.describe Airbrake::Queue do
|
|
9
9
|
it { is_expected.to respond_to(:stash) }
|
10
10
|
end
|
11
11
|
|
12
|
-
describe "#end_time" do
|
13
|
-
it "is always equal to start_time + 1 second by default" do
|
14
|
-
time = Time.now
|
15
|
-
queue = described_class.new(
|
16
|
-
queue: 'bananas', error_count: 0, start_time: time,
|
17
|
-
)
|
18
|
-
expect(queue.end_time).to eq(time + 1)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
12
|
describe "#route" do
|
23
13
|
it "always returns an empty route" do
|
24
|
-
queue = described_class.new(
|
25
|
-
queue: 'a', error_count: 0, start_time: Time.now,
|
26
|
-
)
|
14
|
+
queue = described_class.new(queue: 'a', error_count: 0)
|
27
15
|
expect(queue.route).to be_empty
|
28
16
|
end
|
29
17
|
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
RSpec.describe Airbrake::RemoteSettings::Callback do
|
2
|
+
describe "#call" do
|
3
|
+
let(:logger) { Logger.new(File::NULL) }
|
4
|
+
|
5
|
+
let(:config) do
|
6
|
+
Airbrake::Config.new(
|
7
|
+
project_id: 123,
|
8
|
+
logger: logger,
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:data) do
|
13
|
+
instance_double(Airbrake::RemoteSettings::SettingsData)
|
14
|
+
end
|
15
|
+
|
16
|
+
before do
|
17
|
+
allow(data).to receive(:to_h)
|
18
|
+
allow(data).to receive(:error_host)
|
19
|
+
allow(data).to receive(:apm_host)
|
20
|
+
allow(data).to receive(:error_notifications?)
|
21
|
+
allow(data).to receive(:performance_stats?)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "logs given data" do
|
25
|
+
expect(logger).to receive(:debug) do |&block|
|
26
|
+
expect(block.call).to match(/applying remote settings/)
|
27
|
+
end
|
28
|
+
described_class.new(config).call(data)
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when the config disables error notifications" do
|
32
|
+
before do
|
33
|
+
config.error_notifications = false
|
34
|
+
allow(data).to receive(:error_notifications?).and_return(true)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "keeps the option disabled forever" do
|
38
|
+
callback = described_class.new(config)
|
39
|
+
|
40
|
+
callback.call(data)
|
41
|
+
expect(config.error_notifications).to eq(false)
|
42
|
+
|
43
|
+
callback.call(data)
|
44
|
+
expect(config.error_notifications).to eq(false)
|
45
|
+
|
46
|
+
callback.call(data)
|
47
|
+
expect(config.error_notifications).to eq(false)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when the config enables error notifications" do
|
52
|
+
before { config.error_notifications = true }
|
53
|
+
|
54
|
+
it "can disable and enable error notifications" do
|
55
|
+
expect(data).to receive(:error_notifications?).and_return(false)
|
56
|
+
|
57
|
+
callback = described_class.new(config)
|
58
|
+
callback.call(data)
|
59
|
+
expect(config.error_notifications).to eq(false)
|
60
|
+
|
61
|
+
expect(data).to receive(:error_notifications?).and_return(true)
|
62
|
+
callback.call(data)
|
63
|
+
expect(config.error_notifications).to eq(true)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context "when the config disables performance_stats" do
|
68
|
+
before do
|
69
|
+
config.performance_stats = false
|
70
|
+
allow(data).to receive(:performance_stats?).and_return(true)
|
71
|
+
end
|
72
|
+
|
73
|
+
it "keeps the option disabled forever" do
|
74
|
+
callback = described_class.new(config)
|
75
|
+
|
76
|
+
callback.call(data)
|
77
|
+
expect(config.performance_stats).to eq(false)
|
78
|
+
|
79
|
+
callback.call(data)
|
80
|
+
expect(config.performance_stats).to eq(false)
|
81
|
+
|
82
|
+
callback.call(data)
|
83
|
+
expect(config.performance_stats).to eq(false)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context "when the config enables performance stats" do
|
88
|
+
before { config.performance_stats = true }
|
89
|
+
|
90
|
+
it "can disable and enable performance_stats" do
|
91
|
+
expect(data).to receive(:performance_stats?).and_return(false)
|
92
|
+
|
93
|
+
callback = described_class.new(config)
|
94
|
+
callback.call(data)
|
95
|
+
expect(config.performance_stats).to eq(false)
|
96
|
+
|
97
|
+
expect(data).to receive(:performance_stats?).and_return(true)
|
98
|
+
callback.call(data)
|
99
|
+
expect(config.performance_stats).to eq(true)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context "when error_host returns a value" do
|
104
|
+
it "sets the error_host option" do
|
105
|
+
config.error_host = 'http://api.airbrake.io'
|
106
|
+
allow(data).to receive(:error_host).and_return('https://api.example.com')
|
107
|
+
|
108
|
+
described_class.new(config).call(data)
|
109
|
+
expect(config.error_host).to eq('https://api.example.com')
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "when error_host returns nil" do
|
114
|
+
it "doesn't modify the error_host option" do
|
115
|
+
config.error_host = 'http://api.airbrake.io'
|
116
|
+
allow(data).to receive(:error_host).and_return(nil)
|
117
|
+
|
118
|
+
described_class.new(config).call(data)
|
119
|
+
expect(config.error_host).to eq('http://api.airbrake.io')
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context "when apm_host returns a value" do
|
124
|
+
it "sets the apm_host option" do
|
125
|
+
config.apm_host = 'http://api.airbrake.io'
|
126
|
+
allow(data).to receive(:apm_host).and_return('https://api.example.com')
|
127
|
+
|
128
|
+
described_class.new(config).call(data)
|
129
|
+
expect(config.apm_host).to eq('https://api.example.com')
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context "when apm_host returns nil" do
|
134
|
+
it "doesn't modify the apm_host option" do
|
135
|
+
config.apm_host = 'http://api.airbrake.io'
|
136
|
+
allow(data).to receive(:apm_host).and_return(nil)
|
137
|
+
|
138
|
+
described_class.new(config).call(data)
|
139
|
+
expect(config.apm_host).to eq('http://api.airbrake.io')
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|