airbrake-ruby 4.8.0 → 5.2.0
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 +132 -57
- data/lib/airbrake-ruby/async_sender.rb +7 -30
- data/lib/airbrake-ruby/backtrace.rb +8 -7
- data/lib/airbrake-ruby/benchmark.rb +1 -1
- data/lib/airbrake-ruby/code_hunk.rb +1 -1
- data/lib/airbrake-ruby/config.rb +59 -15
- data/lib/airbrake-ruby/config/processor.rb +71 -0
- data/lib/airbrake-ruby/config/validator.rb +9 -3
- data/lib/airbrake-ruby/deploy_notifier.rb +1 -1
- data/lib/airbrake-ruby/file_cache.rb +1 -1
- data/lib/airbrake-ruby/filter_chain.rb +16 -1
- data/lib/airbrake-ruby/filters/dependency_filter.rb +1 -0
- data/lib/airbrake-ruby/filters/exception_attributes_filter.rb +2 -2
- data/lib/airbrake-ruby/filters/gem_root_filter.rb +1 -0
- data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +5 -5
- 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_whitelist.rb → keys_allowlist.rb} +3 -3
- data/lib/airbrake-ruby/filters/{keys_blacklist.rb → keys_blocklist.rb} +3 -3
- data/lib/airbrake-ruby/filters/keys_filter.rb +39 -20
- data/lib/airbrake-ruby/filters/root_directory_filter.rb +1 -0
- data/lib/airbrake-ruby/filters/sql_filter.rb +7 -7
- data/lib/airbrake-ruby/filters/system_exit_filter.rb +1 -0
- data/lib/airbrake-ruby/filters/thread_filter.rb +5 -4
- data/lib/airbrake-ruby/grouppable.rb +12 -0
- data/lib/airbrake-ruby/ignorable.rb +1 -0
- data/lib/airbrake-ruby/inspectable.rb +2 -2
- data/lib/airbrake-ruby/loggable.rb +1 -1
- data/lib/airbrake-ruby/mergeable.rb +12 -0
- data/lib/airbrake-ruby/monotonic_time.rb +5 -0
- data/lib/airbrake-ruby/notice.rb +7 -14
- data/lib/airbrake-ruby/notice_notifier.rb +11 -3
- data/lib/airbrake-ruby/performance_breakdown.rb +16 -10
- data/lib/airbrake-ruby/performance_notifier.rb +80 -58
- data/lib/airbrake-ruby/promise.rb +1 -0
- data/lib/airbrake-ruby/query.rb +20 -15
- data/lib/airbrake-ruby/queue.rb +65 -0
- data/lib/airbrake-ruby/remote_settings.rb +105 -0
- data/lib/airbrake-ruby/remote_settings/callback.rb +44 -0
- data/lib/airbrake-ruby/remote_settings/settings_data.rb +116 -0
- data/lib/airbrake-ruby/request.rb +14 -12
- data/lib/airbrake-ruby/stat.rb +26 -33
- data/lib/airbrake-ruby/sync_sender.rb +3 -2
- data/lib/airbrake-ruby/tdigest.rb +43 -58
- data/lib/airbrake-ruby/thread_pool.rb +11 -1
- data/lib/airbrake-ruby/truncator.rb +10 -4
- data/lib/airbrake-ruby/version.rb +11 -1
- data/spec/airbrake_spec.rb +206 -71
- data/spec/async_sender_spec.rb +3 -12
- data/spec/backtrace_spec.rb +44 -44
- data/spec/code_hunk_spec.rb +11 -11
- data/spec/config/processor_spec.rb +143 -0
- data/spec/config/validator_spec.rb +23 -6
- data/spec/config_spec.rb +40 -14
- data/spec/deploy_notifier_spec.rb +2 -2
- data/spec/filter_chain_spec.rb +28 -1
- data/spec/filters/dependency_filter_spec.rb +1 -1
- data/spec/filters/gem_root_filter_spec.rb +9 -9
- data/spec/filters/git_last_checkout_filter_spec.rb +21 -4
- data/spec/filters/git_repository_filter.rb +1 -1
- data/spec/filters/git_revision_filter_spec.rb +10 -10
- data/spec/filters/{keys_whitelist_spec.rb → keys_allowlist_spec.rb} +29 -28
- data/spec/filters/{keys_blacklist_spec.rb → keys_blocklist_spec.rb} +39 -29
- data/spec/filters/root_directory_filter_spec.rb +9 -9
- data/spec/filters/sql_filter_spec.rb +58 -60
- data/spec/filters/system_exit_filter_spec.rb +1 -1
- data/spec/filters/thread_filter_spec.rb +32 -30
- data/spec/fixtures/project_root/code.rb +9 -9
- data/spec/loggable_spec.rb +17 -0
- data/spec/monotonic_time_spec.rb +11 -0
- data/spec/notice_notifier/options_spec.rb +17 -17
- data/spec/notice_notifier_spec.rb +20 -20
- data/spec/notice_spec.rb +6 -6
- data/spec/performance_breakdown_spec.rb +0 -1
- data/spec/performance_notifier_spec.rb +220 -73
- data/spec/query_spec.rb +1 -1
- data/spec/queue_spec.rb +18 -0
- data/spec/remote_settings/callback_spec.rb +143 -0
- data/spec/remote_settings/settings_data_spec.rb +348 -0
- data/spec/remote_settings_spec.rb +187 -0
- data/spec/request_spec.rb +1 -3
- data/spec/response_spec.rb +8 -8
- data/spec/spec_helper.rb +6 -6
- data/spec/stat_spec.rb +2 -12
- data/spec/sync_sender_spec.rb +14 -12
- data/spec/tdigest_spec.rb +7 -7
- data/spec/thread_pool_spec.rb +39 -10
- data/spec/timed_trace_spec.rb +1 -1
- data/spec/truncator_spec.rb +12 -12
- metadata +32 -14
@@ -2,7 +2,7 @@ RSpec.describe Airbrake::Filters::SystemExitFilter do
|
|
2
2
|
it "marks SystemExit exceptions as ignored" do
|
3
3
|
notice = Airbrake::Notice.new(SystemExit.new)
|
4
4
|
expect { subject.call(notice) }.to(
|
5
|
-
change { notice.ignored? }.from(false).to(true)
|
5
|
+
change { notice.ignored? }.from(false).to(true),
|
6
6
|
)
|
7
7
|
end
|
8
8
|
|
@@ -77,13 +77,13 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
|
|
77
77
|
{
|
78
78
|
bish: {
|
79
79
|
bash: 'foo',
|
80
|
-
bosh: Object.new
|
81
|
-
}
|
82
|
-
}
|
83
|
-
]
|
84
|
-
}
|
80
|
+
bosh: Object.new,
|
81
|
+
},
|
82
|
+
},
|
83
|
+
],
|
84
|
+
},
|
85
85
|
},
|
86
|
-
123
|
86
|
+
123,
|
87
87
|
]
|
88
88
|
end
|
89
89
|
|
@@ -103,15 +103,15 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
|
|
103
103
|
{
|
104
104
|
bish: {
|
105
105
|
bash: 'foo',
|
106
|
-
bosh: /\A#<Object:.+>\z
|
107
|
-
}
|
108
|
-
}
|
109
|
-
]
|
110
|
-
}
|
106
|
+
bosh: /\A#<Object:.+>\z/,
|
107
|
+
},
|
108
|
+
},
|
109
|
+
],
|
110
|
+
},
|
111
111
|
},
|
112
|
-
123
|
113
|
-
]
|
114
|
-
)
|
112
|
+
123,
|
113
|
+
],
|
114
|
+
),
|
115
115
|
)
|
116
116
|
end
|
117
117
|
end
|
@@ -194,13 +194,13 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
|
|
194
194
|
{
|
195
195
|
bish: {
|
196
196
|
bash: 'foo',
|
197
|
-
bosh: Object.new
|
198
|
-
}
|
199
|
-
}
|
200
|
-
]
|
201
|
-
}
|
197
|
+
bosh: Object.new,
|
198
|
+
},
|
199
|
+
},
|
200
|
+
],
|
201
|
+
},
|
202
202
|
},
|
203
|
-
123
|
203
|
+
123,
|
204
204
|
]
|
205
205
|
end
|
206
206
|
|
@@ -220,21 +220,21 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
|
|
220
220
|
{
|
221
221
|
bish: {
|
222
222
|
bash: 'foo',
|
223
|
-
bosh: /\A#<Object:.+>\z
|
224
|
-
}
|
225
|
-
}
|
226
|
-
]
|
227
|
-
}
|
223
|
+
bosh: /\A#<Object:.+>\z/,
|
224
|
+
},
|
225
|
+
},
|
226
|
+
],
|
227
|
+
},
|
228
228
|
},
|
229
|
-
123
|
230
|
-
]
|
231
|
-
)
|
229
|
+
123,
|
230
|
+
],
|
231
|
+
),
|
232
232
|
)
|
233
233
|
end
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
237
|
-
it "appends name"
|
237
|
+
it "appends name" do
|
238
238
|
new_thread do |th|
|
239
239
|
th.name = 'bingo'
|
240
240
|
subject.call(notice)
|
@@ -258,7 +258,9 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
|
|
258
258
|
expect(notice[:params][:thread][:priority]).to eq(0)
|
259
259
|
end
|
260
260
|
|
261
|
-
it "appends safe_level", skip:
|
261
|
+
it "appends safe_level", skip: (
|
262
|
+
"Not supported on this version of Ruby." unless Airbrake::HAS_SAFE_LEVEL
|
263
|
+
) do
|
262
264
|
subject.call(notice)
|
263
265
|
expect(notice[:params][:thread][:safe_level]).to eq(0)
|
264
266
|
end
|
@@ -10,7 +10,7 @@ module Airbrake
|
|
10
10
|
NOTIFIER = {
|
11
11
|
name: 'airbrake-ruby'.freeze,
|
12
12
|
version: Airbrake::AIRBRAKE_RUBY_VERSION,
|
13
|
-
url: 'https://github.com/airbrake/airbrake-ruby'.freeze
|
13
|
+
url: 'https://github.com/airbrake/airbrake-ruby'.freeze,
|
14
14
|
}.freeze
|
15
15
|
|
16
16
|
##
|
@@ -19,7 +19,7 @@ module Airbrake
|
|
19
19
|
CONTEXT = {
|
20
20
|
os: RUBY_PLATFORM,
|
21
21
|
language: "#{RUBY_ENGINE}/#{RUBY_VERSION}".freeze,
|
22
|
-
notifier: NOTIFIER
|
22
|
+
notifier: NOTIFIER,
|
23
23
|
}.freeze
|
24
24
|
|
25
25
|
##
|
@@ -38,7 +38,7 @@ module Airbrake
|
|
38
38
|
IOError,
|
39
39
|
NotImplementedError,
|
40
40
|
JSON::GeneratorError,
|
41
|
-
Encoding::UndefinedConversionError
|
41
|
+
Encoding::UndefinedConversionError,
|
42
42
|
].freeze
|
43
43
|
|
44
44
|
# @return [Array<Symbol>] the list of keys that can be be overwritten with
|
@@ -71,10 +71,10 @@ module Airbrake
|
|
71
71
|
errors: NestedException.new(config, exception).as_json,
|
72
72
|
context: context,
|
73
73
|
environment: {
|
74
|
-
program_name: $PROGRAM_NAME
|
74
|
+
program_name: $PROGRAM_NAME,
|
75
75
|
},
|
76
76
|
session: {},
|
77
|
-
params: params
|
77
|
+
params: params,
|
78
78
|
}
|
79
79
|
@stash = { exception: exception }
|
80
80
|
@truncator = Airbrake::Truncator.new(PAYLOAD_MAX_SIZE)
|
@@ -170,7 +170,7 @@ module Airbrake
|
|
170
170
|
# Make sure we always send hostname.
|
171
171
|
hostname: HOSTNAME,
|
172
172
|
|
173
|
-
severity: DEFAULT_SEVERITY
|
173
|
+
severity: DEFAULT_SEVERITY,
|
174
174
|
}.merge(CONTEXT).delete_if { |_key, val| val.nil? || val.empty? }
|
175
175
|
end
|
176
176
|
|
@@ -187,7 +187,7 @@ module Airbrake
|
|
187
187
|
@config.logger.error(
|
188
188
|
"#{LOG_LABEL} truncation failed. File an issue at " \
|
189
189
|
"https://github.com/airbrake/airbrake-ruby " \
|
190
|
-
"and attach the following payload: #{@payload}"
|
190
|
+
"and attach the following payload: #{@payload}",
|
191
191
|
)
|
192
192
|
end
|
193
193
|
|
@@ -202,7 +202,7 @@ module Airbrake
|
|
202
202
|
attributes = exception.to_airbrake
|
203
203
|
rescue StandardError => ex
|
204
204
|
@config.logger.error(
|
205
|
-
"#{LOG_LABEL} #{exception.class}#to_airbrake failed: #{ex.class}: #{ex}"
|
205
|
+
"#{LOG_LABEL} #{exception.class}#to_airbrake failed: #{ex.class}: #{ex}",
|
206
206
|
)
|
207
207
|
end
|
208
208
|
|
@@ -213,7 +213,7 @@ module Airbrake
|
|
213
213
|
rescue TypeError
|
214
214
|
@config.logger.error(
|
215
215
|
"#{LOG_LABEL} #{exception.class}#to_airbrake failed:" \
|
216
|
-
" #{attributes} must be a Hash"
|
216
|
+
" #{attributes} must be a Hash",
|
217
217
|
)
|
218
218
|
end
|
219
219
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
RSpec.describe Airbrake::Loggable do
|
2
|
+
describe ".instance" do
|
3
|
+
it "returns a logger" do
|
4
|
+
expect(described_class.instance).to be_a(Logger)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#logger" do
|
9
|
+
let(:subject) do
|
10
|
+
Class.new { include Airbrake::Loggable }.new
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns a logger that has Logger::WARN severity" do
|
14
|
+
expect(subject.logger.level).to eq(Logger::WARN)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/monotonic_time_spec.rb
CHANGED
@@ -9,4 +9,15 @@ RSpec.describe Airbrake::MonotonicTime do
|
|
9
9
|
expect(subject.time_in_ms).to be > old_time
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
describe ".time_in_s" do
|
14
|
+
it "returns monotonic time in seconds" do
|
15
|
+
expect(subject.time_in_s).to be_a(Float)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "always returns time in the future" do
|
19
|
+
old_time = subject.time_in_s
|
20
|
+
expect(subject.time_in_s).to be > old_time
|
21
|
+
end
|
22
|
+
end
|
12
23
|
end
|
@@ -15,7 +15,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
15
15
|
|
16
16
|
Airbrake::Config.instance = Airbrake::Config.new(
|
17
17
|
project_id: project_id,
|
18
|
-
project_key: project_key
|
18
|
+
project_key: project_key,
|
19
19
|
)
|
20
20
|
end
|
21
21
|
|
@@ -64,7 +64,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
64
64
|
describe ":root_directory" do
|
65
65
|
before do
|
66
66
|
subject.add_filter(
|
67
|
-
Airbrake::Filters::RootDirectoryFilter.new('/home/kyrylo/code')
|
67
|
+
Airbrake::Filters::RootDirectoryFilter.new('/home/kyrylo/code'),
|
68
68
|
)
|
69
69
|
end
|
70
70
|
|
@@ -73,7 +73,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
73
73
|
|
74
74
|
expect(
|
75
75
|
a_request(:post, endpoint)
|
76
|
-
.with(body: %r|{"file":"/PROJECT_ROOT/airbrake/ruby/spec/airbrake_spec.+|)
|
76
|
+
.with(body: %r|{"file":"/PROJECT_ROOT/airbrake/ruby/spec/airbrake_spec.+|),
|
77
77
|
).to have_been_made.once
|
78
78
|
end
|
79
79
|
|
@@ -85,7 +85,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
85
85
|
subject.notify_sync(ex)
|
86
86
|
expect(
|
87
87
|
a_request(:post, endpoint)
|
88
|
-
.with(body: %r{"rootDirectory":"/bingo/bango"})
|
88
|
+
.with(body: %r{"rootDirectory":"/bingo/bango"}),
|
89
89
|
).to have_been_made.once
|
90
90
|
end
|
91
91
|
end
|
@@ -105,7 +105,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
105
105
|
WEBrick::HTTPServer.new(
|
106
106
|
Port: 0,
|
107
107
|
Logger: WEBrick::Log.new('/dev/null'),
|
108
|
-
AccessLog: []
|
108
|
+
AccessLog: [],
|
109
109
|
)
|
110
110
|
end
|
111
111
|
|
@@ -121,7 +121,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
121
121
|
before do
|
122
122
|
Airbrake::Config.instance.merge(
|
123
123
|
proxy: proxy_params,
|
124
|
-
host: "http://localhost:#{proxy.config[:Port]}"
|
124
|
+
host: "http://localhost:#{proxy.config[:Port]}",
|
125
125
|
)
|
126
126
|
|
127
127
|
proxy.mount_proc '/' do |req, res|
|
@@ -139,7 +139,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
139
139
|
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
|
140
140
|
skip(
|
141
141
|
"We use Webmock 2, which doesn't support Ruby 2.6+. It's " \
|
142
|
-
"safe to run this test on 2.6+ once we upgrade to Webmock 3.5+"
|
142
|
+
"safe to run this test on 2.6+ once we upgrade to Webmock 3.5+",
|
143
143
|
)
|
144
144
|
end
|
145
145
|
subject.notify_sync(ex)
|
@@ -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
|
|
@@ -164,7 +164,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
164
164
|
subject.notify_sync(ex)
|
165
165
|
expect(
|
166
166
|
a_request(:post, endpoint)
|
167
|
-
.with(body: /"context":{.*"environment":"production".*}/)
|
167
|
+
.with(body: /"context":{.*"environment":"production".*}/),
|
168
168
|
).to have_been_made.once
|
169
169
|
end
|
170
170
|
end
|
@@ -192,7 +192,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
192
192
|
context "when env is set and ignore_environments doesn't mention it" do
|
193
193
|
params = {
|
194
194
|
environment: :development,
|
195
|
-
ignore_environments: [:production]
|
195
|
+
ignore_environments: [:production],
|
196
196
|
}
|
197
197
|
|
198
198
|
include_examples 'sent notice', params
|
@@ -201,7 +201,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
201
201
|
context "when the current env and notify envs are the same" do
|
202
202
|
params = {
|
203
203
|
environment: :development,
|
204
|
-
ignore_environments: %i[production development]
|
204
|
+
ignore_environments: %i[production development],
|
205
205
|
}
|
206
206
|
|
207
207
|
include_examples 'ignored notice', params
|
@@ -227,21 +227,21 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
227
227
|
context "when ignore_environments specifies a Regexp pattern" do
|
228
228
|
params = {
|
229
229
|
environment: :testing,
|
230
|
-
ignore_environments: ['staging', /test.+/]
|
230
|
+
ignore_environments: ['staging', /test.+/],
|
231
231
|
}
|
232
232
|
|
233
233
|
include_examples 'ignored notice', params
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
237
|
-
describe ":
|
237
|
+
describe ":blocklist_keys" do
|
238
238
|
# Fixes https://github.com/airbrake/airbrake-ruby/issues/276
|
239
|
-
context "when specified along with :
|
239
|
+
context "when specified along with :allowlist_keys" do
|
240
240
|
context "and when context payload is present" do
|
241
241
|
before do
|
242
242
|
Airbrake::Config.instance.merge(
|
243
|
-
|
244
|
-
|
243
|
+
blocklist_keys: %i[password password_confirmation],
|
244
|
+
allowlist_keys: [:email, /user/i, 'account_id'],
|
245
245
|
)
|
246
246
|
end
|
247
247
|
|
@@ -4,7 +4,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
4
4
|
project_id: 1,
|
5
5
|
project_key: 'abc',
|
6
6
|
logger: Logger.new('/dev/null'),
|
7
|
-
performance_stats: true
|
7
|
+
performance_stats: true,
|
8
8
|
)
|
9
9
|
end
|
10
10
|
|
@@ -32,7 +32,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
32
32
|
let(:body) do
|
33
33
|
{
|
34
34
|
'id' => '00054414-b147-6ffa-85d6-1524d83362a6',
|
35
|
-
'url' => 'http://localhost/locate/00054414-b147-6ffa-85d6-1524d83362a6'
|
35
|
+
'url' => 'http://localhost/locate/00054414-b147-6ffa-85d6-1524d83362a6',
|
36
36
|
}.to_json
|
37
37
|
end
|
38
38
|
|
@@ -110,7 +110,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
110
110
|
before do
|
111
111
|
Airbrake::Config.instance.merge(
|
112
112
|
environment: 'test',
|
113
|
-
ignore_environments: %w[test]
|
113
|
+
ignore_environments: %w[test],
|
114
114
|
)
|
115
115
|
end
|
116
116
|
|
@@ -132,7 +132,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
132
132
|
let(:body) do
|
133
133
|
{
|
134
134
|
'id' => '00054414-b147-6ffa-85d6-1524d83362a6',
|
135
|
-
'url' => 'http://localhost/locate/00054414-b147-6ffa-85d6-1524d83362a6'
|
135
|
+
'url' => 'http://localhost/locate/00054414-b147-6ffa-85d6-1524d83362a6',
|
136
136
|
}
|
137
137
|
end
|
138
138
|
|
@@ -153,8 +153,8 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
153
153
|
subject.notify_sync('foo', bingo: 'bango')
|
154
154
|
expect(
|
155
155
|
a_request(:post, endpoint).with(
|
156
|
-
body: /"params":{.*"bingo":"bango".*}
|
157
|
-
)
|
156
|
+
body: /"params":{.*"bingo":"bango".*}/,
|
157
|
+
),
|
158
158
|
).to have_been_made.once
|
159
159
|
end
|
160
160
|
|
@@ -190,7 +190,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
190
190
|
context "when the provided environment is ignored" do
|
191
191
|
before do
|
192
192
|
Airbrake::Config.instance.merge(
|
193
|
-
environment: 'test', ignore_environments: %w[test]
|
193
|
+
environment: 'test', ignore_environments: %w[test],
|
194
194
|
)
|
195
195
|
end
|
196
196
|
|
@@ -256,7 +256,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
256
256
|
it "returns the full generated backtrace" do
|
257
257
|
backtrace = [
|
258
258
|
"/lib/airbrake-ruby/a.rb:84:in `build_notice'",
|
259
|
-
"/lib/airbrake-ruby/b.rb:124:in `send_notice'"
|
259
|
+
"/lib/airbrake-ruby/b.rb:124:in `send_notice'",
|
260
260
|
]
|
261
261
|
allow(Kernel).to receive(:caller).and_return(backtrace)
|
262
262
|
|
@@ -265,8 +265,8 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
265
265
|
expect(notice[:errors].first[:backtrace]).to eq(
|
266
266
|
[
|
267
267
|
{ file: '/lib/airbrake-ruby/a.rb', line: 84, function: 'build_notice' },
|
268
|
-
{ file: '/lib/airbrake-ruby/b.rb', line: 124, function: 'send_notice' }
|
269
|
-
]
|
268
|
+
{ file: '/lib/airbrake-ruby/b.rb', line: 124, function: 'send_notice' },
|
269
|
+
],
|
270
270
|
)
|
271
271
|
end
|
272
272
|
end
|
@@ -276,7 +276,7 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
276
276
|
backtrace = [
|
277
277
|
"/airbrake-ruby/lib/airbrake-ruby/a.rb:84:in `b'",
|
278
278
|
"/airbrake-ruby/lib/foo/b.rb:84:in `build'",
|
279
|
-
"/airbrake-ruby/lib/bar/c.rb:124:in `send'"
|
279
|
+
"/airbrake-ruby/lib/bar/c.rb:124:in `send'",
|
280
280
|
]
|
281
281
|
allow(Kernel).to receive(:caller).and_return(backtrace)
|
282
282
|
|
@@ -285,8 +285,8 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
285
285
|
expect(notice[:errors].first[:backtrace]).to eq(
|
286
286
|
[
|
287
287
|
{ file: '/airbrake-ruby/lib/foo/b.rb', line: 84, function: 'build' },
|
288
|
-
{ file: '/airbrake-ruby/lib/bar/c.rb', line: 124, function: 'send' }
|
289
|
-
]
|
288
|
+
{ file: '/airbrake-ruby/lib/bar/c.rb', line: 124, function: 'send' },
|
289
|
+
],
|
290
290
|
)
|
291
291
|
end
|
292
292
|
end
|
@@ -303,21 +303,21 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
303
303
|
backtrace = [
|
304
304
|
"org/jruby/RubyKernel.java:998:in `eval'",
|
305
305
|
"/ruby/stdlib/irb/workspace.rb:87:in `evaluate'",
|
306
|
-
"/ruby/stdlib/irb.rb:489:in `block in eval_input'"
|
306
|
+
"/ruby/stdlib/irb.rb:489:in `block in eval_input'",
|
307
307
|
]
|
308
308
|
allow(Kernel).to receive(:caller).and_return(backtrace)
|
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' },
|
316
316
|
{ file: '/ruby/stdlib/irb/workspace.rb', line: 87, function: 'evaluate' },
|
317
|
-
{ file: '/ruby/stdlib/irb.rb:489', line: 489, function: 'block in eval_input' }
|
318
|
-
]
|
317
|
+
{ file: '/ruby/stdlib/irb.rb:489', line: 489, function: 'block in eval_input' },
|
318
|
+
],
|
319
319
|
)
|
320
|
-
# rubocop:enable
|
320
|
+
# rubocop:enable Layout/LineLength
|
321
321
|
end
|
322
322
|
end
|
323
323
|
|
@@ -328,9 +328,9 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
328
328
|
end
|
329
329
|
|
330
330
|
it "raises error" do
|
331
|
-
expect { subject.build_notice(Exception.new) }.to raise_error(
|
331
|
+
expect { subject.build_notice(Exception.new('oops')) }.to raise_error(
|
332
332
|
Airbrake::Error,
|
333
|
-
|
333
|
+
"Airbrake is closed; can't build exception: Exception: oops",
|
334
334
|
)
|
335
335
|
end
|
336
336
|
end
|