airbrake-ruby 4.8.0 → 4.10.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 +84 -5
- data/lib/airbrake-ruby/async_sender.rb +3 -3
- data/lib/airbrake-ruby/backtrace.rb +2 -2
- data/lib/airbrake-ruby/code_hunk.rb +1 -1
- data/lib/airbrake-ruby/config.rb +1 -1
- data/lib/airbrake-ruby/config/validator.rb +3 -3
- data/lib/airbrake-ruby/deploy_notifier.rb +1 -1
- data/lib/airbrake-ruby/filters/exception_attributes_filter.rb +2 -2
- data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +2 -2
- data/lib/airbrake-ruby/filters/keys_filter.rb +1 -1
- data/lib/airbrake-ruby/filters/sql_filter.rb +3 -3
- data/lib/airbrake-ruby/filters/thread_filter.rb +1 -1
- data/lib/airbrake-ruby/grouppable.rb +12 -0
- data/lib/airbrake-ruby/inspectable.rb +2 -2
- data/lib/airbrake-ruby/mergeable.rb +12 -0
- data/lib/airbrake-ruby/notice.rb +7 -7
- data/lib/airbrake-ruby/notice_notifier.rb +1 -1
- data/lib/airbrake-ruby/performance_breakdown.rb +2 -1
- data/lib/airbrake-ruby/performance_notifier.rb +42 -21
- data/lib/airbrake-ruby/query.rb +3 -5
- data/lib/airbrake-ruby/queue.rb +52 -0
- data/lib/airbrake-ruby/request.rb +3 -5
- data/lib/airbrake-ruby/stat.rb +1 -1
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/airbrake_spec.rb +135 -45
- data/spec/async_sender_spec.rb +4 -4
- data/spec/backtrace_spec.rb +18 -18
- data/spec/code_hunk_spec.rb +9 -9
- data/spec/config/validator_spec.rb +5 -5
- data/spec/config_spec.rb +5 -5
- data/spec/deploy_notifier_spec.rb +2 -2
- data/spec/filter_chain_spec.rb +1 -1
- data/spec/filters/dependency_filter_spec.rb +1 -1
- data/spec/filters/gem_root_filter_spec.rb +5 -5
- data/spec/filters/git_last_checkout_filter_spec.rb +1 -1
- data/spec/filters/git_repository_filter.rb +1 -1
- data/spec/filters/git_revision_filter_spec.rb +10 -10
- data/spec/filters/keys_blacklist_spec.rb +22 -22
- data/spec/filters/keys_whitelist_spec.rb +21 -21
- data/spec/filters/root_directory_filter_spec.rb +5 -5
- data/spec/filters/sql_filter_spec.rb +53 -53
- data/spec/filters/system_exit_filter_spec.rb +1 -1
- data/spec/filters/thread_filter_spec.rb +28 -28
- data/spec/fixtures/project_root/code.rb +9 -9
- data/spec/notice_notifier/options_spec.rb +12 -12
- data/spec/notice_notifier_spec.rb +17 -17
- data/spec/notice_spec.rb +5 -5
- data/spec/performance_notifier_spec.rb +171 -60
- data/spec/query_spec.rb +1 -1
- data/spec/queue_spec.rb +11 -0
- data/spec/request_spec.rb +1 -1
- data/spec/response_spec.rb +8 -8
- data/spec/spec_helper.rb +2 -2
- data/spec/stat_spec.rb +2 -2
- data/spec/sync_sender_spec.rb +12 -12
- data/spec/tdigest_spec.rb +6 -6
- data/spec/thread_pool_spec.rb +5 -5
- data/spec/timed_trace_spec.rb +1 -1
- data/spec/truncator_spec.rb +12 -12
- metadata +7 -2
data/spec/async_sender_spec.rb
CHANGED
@@ -8,7 +8,7 @@ RSpec.describe Airbrake::AsyncSender do
|
|
8
8
|
Airbrake::Config.instance = Airbrake::Config.new(
|
9
9
|
project_id: '1',
|
10
10
|
workers: 3,
|
11
|
-
queue_size: 10
|
11
|
+
queue_size: 10,
|
12
12
|
)
|
13
13
|
end
|
14
14
|
|
@@ -35,7 +35,7 @@ RSpec.describe Airbrake::AsyncSender do
|
|
35
35
|
Airbrake::Config.instance = Airbrake::Config.new(
|
36
36
|
project_id: '1',
|
37
37
|
workers: 0,
|
38
|
-
queue_size: 1
|
38
|
+
queue_size: 1,
|
39
39
|
)
|
40
40
|
end
|
41
41
|
|
@@ -55,13 +55,13 @@ RSpec.describe Airbrake::AsyncSender do
|
|
55
55
|
|
56
56
|
expect(promise).to be_rejected
|
57
57
|
expect(promise.value).to eq(
|
58
|
-
'error' => "AsyncSender has reached its capacity of 1"
|
58
|
+
'error' => "AsyncSender has reached its capacity of 1",
|
59
59
|
)
|
60
60
|
end
|
61
61
|
|
62
62
|
it "logs discarded notice" do
|
63
63
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
64
|
-
/reached its capacity
|
64
|
+
/reached its capacity/,
|
65
65
|
).at_least(:once)
|
66
66
|
|
67
67
|
15.times { subject.send(notice, Airbrake::Promise.new) }
|
data/spec/backtrace_spec.rb
CHANGED
@@ -172,13 +172,13 @@ RSpec.describe Airbrake::Backtrace do
|
|
172
172
|
|
173
173
|
it "returns array of hashes where each unknown frame is marked as 'function'" do
|
174
174
|
expect(
|
175
|
-
described_class.parse(ex)
|
175
|
+
described_class.parse(ex),
|
176
176
|
).to eq([file: nil, line: nil, function: 'a b c 1 23 321 .rb'])
|
177
177
|
end
|
178
178
|
|
179
179
|
it "logs frames that cannot be parsed" do
|
180
180
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
181
|
-
/can't parse 'a b c 1 23 321 .rb'
|
181
|
+
/can't parse 'a b c 1 23 321 .rb'/,
|
182
182
|
)
|
183
183
|
described_class.parse(ex)
|
184
184
|
end
|
@@ -280,18 +280,18 @@ RSpec.describe Airbrake::Backtrace do
|
|
280
280
|
# rubocop:disable Metrics/LineLength,Lint/InterpolationCheck
|
281
281
|
96 => ' @config.logger.debug("#{LOG_LABEL} `notice.to_json` failed: #{ex.class}: #{ex}")',
|
282
282
|
# rubocop:enable Metrics/LineLength,Lint/InterpolationCheck
|
283
|
-
}
|
283
|
+
},
|
284
284
|
},
|
285
285
|
{
|
286
286
|
file: fixture_path('notroot.txt'),
|
287
287
|
line: 3,
|
288
|
-
function: 'pineapple'
|
288
|
+
function: 'pineapple',
|
289
289
|
},
|
290
290
|
{
|
291
291
|
file: project_root_path('vendor/bundle/ignored_file.rb'),
|
292
292
|
line: 2,
|
293
|
-
function: 'ignore_me'
|
294
|
-
}
|
293
|
+
function: 'ignore_me',
|
294
|
+
},
|
295
295
|
]
|
296
296
|
end
|
297
297
|
|
@@ -300,7 +300,7 @@ RSpec.describe Airbrake::Backtrace do
|
|
300
300
|
backtrace = [
|
301
301
|
project_root_path('code.rb') + ":94:in `to_json'",
|
302
302
|
fixture_path('notroot.txt' + ":3:in `pineapple'"),
|
303
|
-
project_root_path('vendor/bundle/ignored_file.rb') + ":2:in `ignore_me'"
|
303
|
+
project_root_path('vendor/bundle/ignored_file.rb') + ":2:in `ignore_me'",
|
304
304
|
]
|
305
305
|
ex.set_backtrace(backtrace)
|
306
306
|
expect(described_class.parse(ex)).to eq(parsed_backtrace)
|
@@ -310,7 +310,7 @@ RSpec.describe Airbrake::Backtrace do
|
|
310
310
|
context "and when root_directory is a Pathname" do
|
311
311
|
before do
|
312
312
|
Airbrake::Config.instance.merge(
|
313
|
-
root_directory: Pathname.new(project_root_path(''))
|
313
|
+
root_directory: Pathname.new(project_root_path('')),
|
314
314
|
)
|
315
315
|
end
|
316
316
|
|
@@ -328,8 +328,8 @@ RSpec.describe Airbrake::Backtrace do
|
|
328
328
|
# rubocop:disable Metrics/LineLength,Lint/InterpolationCheck
|
329
329
|
96 => ' @config.logger.debug("#{LOG_LABEL} `notice.to_json` failed: #{ex.class}: #{ex}")',
|
330
330
|
# rubocop:enable Metrics/LineLength,Lint/InterpolationCheck
|
331
|
-
}
|
332
|
-
}
|
331
|
+
},
|
332
|
+
},
|
333
333
|
]
|
334
334
|
end
|
335
335
|
|
@@ -360,7 +360,7 @@ RSpec.describe Airbrake::Backtrace do
|
|
360
360
|
# rubocop:disable Metrics/LineLength,Lint/InterpolationCheck
|
361
361
|
96 => ' @config.logger.debug("#{LOG_LABEL} `notice.to_json` failed: #{ex.class}: #{ex}")',
|
362
362
|
# rubocop:enable Metrics/LineLength,Lint/InterpolationCheck
|
363
|
-
}
|
363
|
+
},
|
364
364
|
},
|
365
365
|
{
|
366
366
|
file: project_root_path('code.rb'),
|
@@ -373,14 +373,14 @@ RSpec.describe Airbrake::Backtrace do
|
|
373
373
|
# rubocop:disable Metrics/LineLength,Lint/InterpolationCheck
|
374
374
|
96 => ' @config.logger.debug("#{LOG_LABEL} `notice.to_json` failed: #{ex.class}: #{ex}")',
|
375
375
|
# rubocop:enable Metrics/LineLength,Lint/InterpolationCheck
|
376
|
-
97 => ' else'
|
377
|
-
}
|
376
|
+
97 => ' else',
|
377
|
+
},
|
378
378
|
},
|
379
379
|
{
|
380
380
|
file: project_root_path('code.rb'),
|
381
381
|
line: 96,
|
382
|
-
function: 'to_json'
|
383
|
-
}
|
382
|
+
function: 'to_json',
|
383
|
+
},
|
384
384
|
]
|
385
385
|
end
|
386
386
|
|
@@ -389,7 +389,7 @@ RSpec.describe Airbrake::Backtrace do
|
|
389
389
|
backtrace = [
|
390
390
|
project_root_path('code.rb') + ":94:in `to_json'",
|
391
391
|
project_root_path('code.rb') + ":95:in `to_json'",
|
392
|
-
project_root_path('code.rb') + ":96:in `to_json'"
|
392
|
+
project_root_path('code.rb') + ":96:in `to_json'",
|
393
393
|
]
|
394
394
|
ex.set_backtrace(backtrace)
|
395
395
|
expect(described_class.parse(ex)).to eq(parsed_backtrace)
|
@@ -410,8 +410,8 @@ RSpec.describe Airbrake::Backtrace do
|
|
410
410
|
{
|
411
411
|
file: project_root_path('code.rb'),
|
412
412
|
line: 94,
|
413
|
-
function: 'to_json'
|
414
|
-
}
|
413
|
+
function: 'to_json',
|
414
|
+
},
|
415
415
|
]
|
416
416
|
end
|
417
417
|
|
data/spec/code_hunk_spec.rb
CHANGED
@@ -37,7 +37,7 @@ RSpec.describe Airbrake::CodeHunk do
|
|
37
37
|
# rubocop:disable Metrics/LineLength
|
38
38
|
3 => ' # Represents a chunk of information that is meant to be either sent to',
|
39
39
|
# rubocop:enable Metrics/LineLength
|
40
|
-
)
|
40
|
+
),
|
41
41
|
)
|
42
42
|
end
|
43
43
|
end
|
@@ -49,8 +49,8 @@ RSpec.describe Airbrake::CodeHunk do
|
|
49
49
|
is_expected.to(
|
50
50
|
eq(
|
51
51
|
220 => ' end',
|
52
|
-
221 => 'end'
|
53
|
-
)
|
52
|
+
221 => 'end',
|
53
|
+
),
|
54
54
|
)
|
55
55
|
end
|
56
56
|
end
|
@@ -65,8 +65,8 @@ RSpec.describe Airbrake::CodeHunk do
|
|
65
65
|
eq(
|
66
66
|
1 => 'module Banana',
|
67
67
|
2 => ' attr_reader :bingo',
|
68
|
-
3 => 'end'
|
69
|
-
)
|
68
|
+
3 => 'end',
|
69
|
+
),
|
70
70
|
)
|
71
71
|
end
|
72
72
|
end
|
@@ -81,8 +81,8 @@ RSpec.describe Airbrake::CodeHunk do
|
|
81
81
|
99 => ' end',
|
82
82
|
100 => '',
|
83
83
|
101 => ' break if truncate == 0',
|
84
|
-
102 => ' end'
|
85
|
-
)
|
84
|
+
102 => ' end',
|
85
|
+
),
|
86
86
|
)
|
87
87
|
end
|
88
88
|
end
|
@@ -104,10 +104,10 @@ RSpec.describe Airbrake::CodeHunk do
|
|
104
104
|
|
105
105
|
it "logs error and returns nil" do
|
106
106
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
107
|
-
/can't read code hunk.+Permission denied
|
107
|
+
/can't read code hunk.+Permission denied/,
|
108
108
|
)
|
109
109
|
expect(subject.get(project_root_path('code.rb'), 1)).to(
|
110
|
-
eq(1 => '')
|
110
|
+
eq(1 => ''),
|
111
111
|
)
|
112
112
|
end
|
113
113
|
end
|
@@ -118,7 +118,7 @@ RSpec.describe Airbrake::Config::Validator do
|
|
118
118
|
promise = described_class.validate(config)
|
119
119
|
expect(promise.value).to eq(
|
120
120
|
'error' => "the 'environment' option must be configured with a " \
|
121
|
-
"Symbol (or String), but 'Float' was provided: 1.0"
|
121
|
+
"Symbol (or String), but 'Float' was provided: 1.0",
|
122
122
|
)
|
123
123
|
end
|
124
124
|
end
|
@@ -130,7 +130,7 @@ RSpec.describe Airbrake::Config::Validator do
|
|
130
130
|
{
|
131
131
|
project_id: valid_id,
|
132
132
|
project_key: valid_key,
|
133
|
-
environment: string_inquirer.new('test')
|
133
|
+
environment: string_inquirer.new('test'),
|
134
134
|
}
|
135
135
|
end
|
136
136
|
|
@@ -148,14 +148,14 @@ RSpec.describe Airbrake::Config::Validator do
|
|
148
148
|
project_id: valid_id,
|
149
149
|
project_key: valid_key,
|
150
150
|
environment: 'test',
|
151
|
-
ignore_environments: ['test']
|
151
|
+
ignore_environments: ['test'],
|
152
152
|
}
|
153
153
|
end
|
154
154
|
|
155
155
|
it "returns a rejected promise" do
|
156
156
|
promise = described_class.check_notify_ability(config)
|
157
157
|
expect(promise.value).to eq(
|
158
|
-
'error' => "current environment 'test' is ignored"
|
158
|
+
'error' => "current environment 'test' is ignored",
|
159
159
|
)
|
160
160
|
end
|
161
161
|
end
|
@@ -165,7 +165,7 @@ RSpec.describe Airbrake::Config::Validator do
|
|
165
165
|
{
|
166
166
|
project_id: valid_id,
|
167
167
|
project_key: valid_key,
|
168
|
-
ignore_environments: ['test']
|
168
|
+
ignore_environments: ['test'],
|
169
169
|
}
|
170
170
|
end
|
171
171
|
|
data/spec/config_spec.rb
CHANGED
@@ -111,7 +111,7 @@ RSpec.describe Airbrake::Config do
|
|
111
111
|
describe "#check_performance_options" do
|
112
112
|
it "returns a promise" do
|
113
113
|
resource = Airbrake::Query.new(
|
114
|
-
method: '', route: '', query: '', start_time: Time.now
|
114
|
+
method: '', route: '', query: '', start_time: Time.now,
|
115
115
|
)
|
116
116
|
expect(subject.check_performance_options(resource))
|
117
117
|
.to be_an(Airbrake::Promise)
|
@@ -122,14 +122,14 @@ RSpec.describe Airbrake::Config do
|
|
122
122
|
|
123
123
|
let(:resource) do
|
124
124
|
Airbrake::Request.new(
|
125
|
-
method: 'GET', route: '/foo', status_code: 200, start_time: Time.new
|
125
|
+
method: 'GET', route: '/foo', status_code: 200, start_time: Time.new,
|
126
126
|
)
|
127
127
|
end
|
128
128
|
|
129
129
|
it "returns a rejected promise" do
|
130
130
|
promise = subject.check_performance_options(resource)
|
131
131
|
expect(promise.value).to eq(
|
132
|
-
'error' => "The Performance Stats feature is disabled"
|
132
|
+
'error' => "The Performance Stats feature is disabled",
|
133
133
|
)
|
134
134
|
end
|
135
135
|
end
|
@@ -139,14 +139,14 @@ RSpec.describe Airbrake::Config do
|
|
139
139
|
|
140
140
|
let(:resource) do
|
141
141
|
Airbrake::Query.new(
|
142
|
-
method: 'GET', route: '/foo', query: '', start_time: Time.new
|
142
|
+
method: 'GET', route: '/foo', query: '', start_time: Time.new,
|
143
143
|
)
|
144
144
|
end
|
145
145
|
|
146
146
|
it "returns a rejected promise" do
|
147
147
|
promise = subject.check_performance_options(resource)
|
148
148
|
expect(promise.value).to eq(
|
149
|
-
'error' => "The Query Stats feature is disabled"
|
149
|
+
'error' => "The Query Stats feature is disabled",
|
150
150
|
)
|
151
151
|
end
|
152
152
|
end
|
@@ -26,7 +26,7 @@ RSpec.describe Airbrake::DeployNotifier do
|
|
26
26
|
expect_any_instance_of(Airbrake::SyncSender).to receive(:send).with(
|
27
27
|
{ environment: 'barenv' },
|
28
28
|
instance_of(Airbrake::Promise),
|
29
|
-
URI('https://api.airbrake.io/api/v4/projects/1/deploys')
|
29
|
+
URI('https://api.airbrake.io/api/v4/projects/1/deploys'),
|
30
30
|
)
|
31
31
|
subject.notify(environment: 'barenv')
|
32
32
|
end
|
@@ -39,7 +39,7 @@ RSpec.describe Airbrake::DeployNotifier do
|
|
39
39
|
expect_any_instance_of(Airbrake::SyncSender).to receive(:send).with(
|
40
40
|
{ environment: 'fooenv' },
|
41
41
|
instance_of(Airbrake::Promise),
|
42
|
-
URI('https://api.airbrake.io/api/v4/projects/1/deploys')
|
42
|
+
URI('https://api.airbrake.io/api/v4/projects/1/deploys'),
|
43
43
|
)
|
44
44
|
subject.notify({})
|
45
45
|
end
|
data/spec/filter_chain_spec.rb
CHANGED
@@ -67,7 +67,7 @@ RSpec.describe Airbrake::FilterChain do
|
|
67
67
|
|
68
68
|
foo_filter_mock = double
|
69
69
|
expect(foo_filter_mock).to(
|
70
|
-
receive(:name).at_least(:once).and_return('FooFilter')
|
70
|
+
receive(:name).at_least(:once).and_return('FooFilter'),
|
71
71
|
)
|
72
72
|
subject.delete_filter(foo_filter_mock)
|
73
73
|
|
@@ -5,7 +5,7 @@ RSpec.describe Airbrake::Filters::DependencyFilter do
|
|
5
5
|
it "attaches loaded dependencies to context/versions/dependencies" do
|
6
6
|
subject.call(notice)
|
7
7
|
expect(notice[:context][:versions][:dependencies]).to include(
|
8
|
-
'airbrake-ruby' => Airbrake::AIRBRAKE_RUBY_VERSION
|
8
|
+
'airbrake-ruby' => Airbrake::AIRBRAKE_RUBY_VERSION,
|
9
9
|
)
|
10
10
|
end
|
11
11
|
end
|
@@ -12,7 +12,7 @@ RSpec.describe Airbrake::Filters::GemRootFilter do
|
|
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
|
-
{ file: "#{root2}/gems/rspec-core-3.3.2/exe/rspec" }
|
15
|
+
{ file: "#{root2}/gems/rspec-core-3.3.2/exe/rspec" },
|
16
16
|
]
|
17
17
|
# rubocop:enable Metrics/LineLength
|
18
18
|
|
@@ -25,9 +25,9 @@ RSpec.describe Airbrake::Filters::GemRootFilter do
|
|
25
25
|
{ file: "/home/kyrylo/code/airbrake/ruby/spec/spec_helper.rb" },
|
26
26
|
{ file: "/GEM_ROOT/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb" },
|
27
27
|
{ file: "/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb" },
|
28
|
-
{ file: "/GEM_ROOT/gems/rspec-core-3.3.2/exe/rspec" }
|
29
|
-
]
|
30
|
-
)
|
28
|
+
{ file: "/GEM_ROOT/gems/rspec-core-3.3.2/exe/rspec" },
|
29
|
+
],
|
30
|
+
),
|
31
31
|
)
|
32
32
|
# rubocop:enable Metrics/LineLength
|
33
33
|
end
|
@@ -35,7 +35,7 @@ RSpec.describe Airbrake::Filters::GemRootFilter do
|
|
35
35
|
it "does not filter file when it is nil" do
|
36
36
|
expect(notice[:errors].first[:file]).to be_nil
|
37
37
|
expect { subject.call(notice) }.not_to(
|
38
|
-
change { notice[:errors].first[:file] }
|
38
|
+
change { notice[:errors].first[:file] },
|
39
39
|
)
|
40
40
|
end
|
41
41
|
end
|
@@ -46,7 +46,7 @@ RSpec.describe Airbrake::Filters::GitRepositoryFilter do
|
|
46
46
|
it "attaches context/repository" do
|
47
47
|
subject.call(notice)
|
48
48
|
expect(notice[:context][:repository]).to eq(
|
49
|
-
'ssh://git@github.com/airbrake/airbrake-ruby.git'
|
49
|
+
'ssh://git@github.com/airbrake/airbrake-ruby.git',
|
50
50
|
)
|
51
51
|
end
|
52
52
|
end
|
@@ -44,7 +44,7 @@ RSpec.describe Airbrake::Filters::GitRevisionFilter do
|
|
44
44
|
context "and also when HEAD doesn't start with 'ref: '" do
|
45
45
|
before do
|
46
46
|
expect(File).to(
|
47
|
-
receive(:read).with('root/dir/.git/HEAD').and_return('refs/foo')
|
47
|
+
receive(:read).with('root/dir/.git/HEAD').and_return('refs/foo'),
|
48
48
|
)
|
49
49
|
end
|
50
50
|
|
@@ -57,17 +57,17 @@ RSpec.describe Airbrake::Filters::GitRevisionFilter do
|
|
57
57
|
context "and also when HEAD starts with 'ref: " do
|
58
58
|
before do
|
59
59
|
expect(File).to(
|
60
|
-
receive(:read).with('root/dir/.git/HEAD').and_return("ref: refs/foo\n")
|
60
|
+
receive(:read).with('root/dir/.git/HEAD').and_return("ref: refs/foo\n"),
|
61
61
|
)
|
62
62
|
end
|
63
63
|
|
64
64
|
context "when the ref exists" do
|
65
65
|
before do
|
66
66
|
expect(File).to(
|
67
|
-
receive(:exist?).with('root/dir/.git/refs/foo').and_return(true)
|
67
|
+
receive(:exist?).with('root/dir/.git/refs/foo').and_return(true),
|
68
68
|
)
|
69
69
|
expect(File).to(
|
70
|
-
receive(:read).with('root/dir/.git/refs/foo').and_return("d34db33f\n")
|
70
|
+
receive(:read).with('root/dir/.git/refs/foo').and_return("d34db33f\n"),
|
71
71
|
)
|
72
72
|
end
|
73
73
|
|
@@ -80,14 +80,14 @@ RSpec.describe Airbrake::Filters::GitRevisionFilter do
|
|
80
80
|
context "when the ref doesn't exist" do
|
81
81
|
before do
|
82
82
|
expect(File).to(
|
83
|
-
receive(:exist?).with('root/dir/.git/refs/foo').and_return(false)
|
83
|
+
receive(:exist?).with('root/dir/.git/refs/foo').and_return(false),
|
84
84
|
)
|
85
85
|
end
|
86
86
|
|
87
87
|
context "and when '.git/packed-refs' exists" do
|
88
88
|
before do
|
89
89
|
expect(File).to(
|
90
|
-
receive(:exist?).with('root/dir/.git/packed-refs').and_return(true)
|
90
|
+
receive(:exist?).with('root/dir/.git/packed-refs').and_return(true),
|
91
91
|
)
|
92
92
|
expect(File).to(
|
93
93
|
receive(:readlines).with('root/dir/.git/packed-refs').and_return(
|
@@ -95,9 +95,9 @@ RSpec.describe Airbrake::Filters::GitRevisionFilter do
|
|
95
95
|
"# pack-refs with: peeled fully-peeled\n",
|
96
96
|
"ccb316eecff79c7528d1ad43e5fa165f7a44d52e refs/tags/v3.0.30\n",
|
97
97
|
"^d358900f73ee5bfd6ca3a592cf23ac6e82df83c1",
|
98
|
-
"d34db33f refs/foo\n"
|
99
|
-
]
|
100
|
-
)
|
98
|
+
"d34db33f refs/foo\n",
|
99
|
+
],
|
100
|
+
),
|
101
101
|
)
|
102
102
|
end
|
103
103
|
|
@@ -110,7 +110,7 @@ RSpec.describe Airbrake::Filters::GitRevisionFilter do
|
|
110
110
|
context "and when '.git/packed-refs' doesn't exist" do
|
111
111
|
before do
|
112
112
|
expect(File).to(
|
113
|
-
receive(:exist?).with('root/dir/.git/packed-refs').and_return(false)
|
113
|
+
receive(:exist?).with('root/dir/.git/packed-refs').and_return(false),
|
114
114
|
)
|
115
115
|
end
|
116
116
|
|
@@ -19,8 +19,8 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
19
19
|
[/\Abon/],
|
20
20
|
[
|
21
21
|
{ bongo: 'bango' },
|
22
|
-
{ bongo: '[Filtered]' }
|
23
|
-
]
|
22
|
+
{ bongo: '[Filtered]' },
|
23
|
+
],
|
24
24
|
)
|
25
25
|
|
26
26
|
context "and when a key is a hash" do
|
@@ -40,8 +40,8 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
40
40
|
[:bingo],
|
41
41
|
[
|
42
42
|
{ bingo: 'bango' },
|
43
|
-
{ bingo: '[Filtered]' }
|
44
|
-
]
|
43
|
+
{ bingo: '[Filtered]' },
|
44
|
+
],
|
45
45
|
)
|
46
46
|
end
|
47
47
|
|
@@ -51,8 +51,8 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
51
51
|
['bingo'],
|
52
52
|
[
|
53
53
|
{ bingo: 'bango' },
|
54
|
-
{ bingo: '[Filtered]' }
|
55
|
-
]
|
54
|
+
{ bingo: '[Filtered]' },
|
55
|
+
],
|
56
56
|
)
|
57
57
|
end
|
58
58
|
|
@@ -62,8 +62,8 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
62
62
|
['bingo'],
|
63
63
|
[
|
64
64
|
{ array: [{ bingo: 'bango' }, []] },
|
65
|
-
{ array: [{ bingo: '[Filtered]' }, []] }
|
66
|
-
]
|
65
|
+
{ array: [{ bingo: '[Filtered]' }, []] },
|
66
|
+
],
|
67
67
|
)
|
68
68
|
end
|
69
69
|
|
@@ -74,8 +74,8 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
74
74
|
[proc { 'bongo' }, :bash],
|
75
75
|
[
|
76
76
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
77
|
-
{ bingo: 'bango', bongo: '[Filtered]', bash: '[Filtered]' }
|
78
|
-
]
|
77
|
+
{ bingo: 'bango', bongo: '[Filtered]', bash: '[Filtered]' },
|
78
|
+
],
|
79
79
|
)
|
80
80
|
end
|
81
81
|
|
@@ -85,13 +85,13 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
85
85
|
[proc { Object.new }],
|
86
86
|
[
|
87
87
|
{ bingo: 'bango', bongo: 'bish' },
|
88
|
-
{ bingo: 'bango', bongo: 'bish' }
|
89
|
-
]
|
88
|
+
{ bingo: 'bango', bongo: 'bish' },
|
89
|
+
],
|
90
90
|
)
|
91
91
|
|
92
92
|
it "logs an error" do
|
93
93
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
94
|
-
/KeysBlacklist is invalid.+patterns: \[#<Object:.+>\]
|
94
|
+
/KeysBlacklist is invalid.+patterns: \[#<Object:.+>\]/,
|
95
95
|
)
|
96
96
|
keys_blacklist = described_class.new(patterns)
|
97
97
|
keys_blacklist.call(notice)
|
@@ -104,7 +104,7 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
104
104
|
context "and when the filter is called once" do
|
105
105
|
it "logs an error" do
|
106
106
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
107
|
-
/KeysBlacklist is invalid.+patterns: \[#<Proc:.+>\]
|
107
|
+
/KeysBlacklist is invalid.+patterns: \[#<Proc:.+>\]/,
|
108
108
|
)
|
109
109
|
keys_blacklist = described_class.new(patterns)
|
110
110
|
keys_blacklist.call(notice)
|
@@ -127,13 +127,13 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
127
127
|
[Object.new],
|
128
128
|
[
|
129
129
|
{ bingo: 'bango', bongo: 'bish' },
|
130
|
-
{ bingo: 'bango', bongo: 'bish' }
|
131
|
-
]
|
130
|
+
{ bingo: 'bango', bongo: 'bish' },
|
131
|
+
],
|
132
132
|
)
|
133
133
|
|
134
134
|
it "logs an error" do
|
135
135
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
136
|
-
/KeysBlacklist is invalid.+patterns: \[#<Object:.+>\]
|
136
|
+
/KeysBlacklist is invalid.+patterns: \[#<Object:.+>\]/,
|
137
137
|
)
|
138
138
|
keys_blacklist = described_class.new(patterns)
|
139
139
|
keys_blacklist.call(notice)
|
@@ -147,8 +147,8 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
147
147
|
['bish'],
|
148
148
|
[
|
149
149
|
{ bongo: { bish: 'bash' } },
|
150
|
-
{ bongo: { bish: '[Filtered]' } }
|
151
|
-
]
|
150
|
+
{ bongo: { bish: '[Filtered]' } },
|
151
|
+
],
|
152
152
|
)
|
153
153
|
end
|
154
154
|
|
@@ -161,8 +161,8 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
161
161
|
['bango'],
|
162
162
|
[
|
163
163
|
bongo,
|
164
|
-
{ bingo: { bango: '[Filtered]' } }
|
165
|
-
]
|
164
|
+
{ bingo: { bango: '[Filtered]' } },
|
165
|
+
],
|
166
166
|
)
|
167
167
|
end
|
168
168
|
end
|
@@ -177,7 +177,7 @@ RSpec.describe Airbrake::Filters::KeysBlacklist do
|
|
177
177
|
|
178
178
|
subject.call(notice)
|
179
179
|
expect(notice[:context][:url]).to(
|
180
|
-
eq
|
180
|
+
eq('http://localhost:3000/crash?foo=bar&baz=bongo&bish=[Filtered]&color=%23FFAAFF'),
|
181
181
|
)
|
182
182
|
end
|
183
183
|
end
|