airbrake-ruby 4.8.0 → 4.11.1
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 +101 -25
- data/lib/airbrake-ruby/async_sender.rb +3 -3
- data/lib/airbrake-ruby/backtrace.rb +2 -2
- data/lib/airbrake-ruby/benchmark.rb +1 -1
- 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 +3 -2
- data/lib/airbrake-ruby/performance_breakdown.rb +12 -6
- data/lib/airbrake-ruby/performance_notifier.rb +69 -22
- data/lib/airbrake-ruby/query.rb +15 -11
- data/lib/airbrake-ruby/queue.rb +56 -0
- data/lib/airbrake-ruby/request.rb +14 -12
- 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 -9
- 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 -55
- 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 +18 -18
- data/spec/notice_spec.rb +5 -5
- data/spec/performance_breakdown_spec.rb +11 -0
- data/spec/performance_notifier_spec.rb +243 -72
- data/spec/query_spec.rb +11 -1
- data/spec/queue_spec.rb +21 -0
- data/spec/request_spec.rb +11 -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
@@ -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
@@ -110,9 +110,7 @@ RSpec.describe Airbrake::Config do
|
|
110
110
|
|
111
111
|
describe "#check_performance_options" do
|
112
112
|
it "returns a promise" do
|
113
|
-
resource = Airbrake::Query.new(
|
114
|
-
method: '', route: '', query: '', start_time: Time.now
|
115
|
-
)
|
113
|
+
resource = Airbrake::Query.new(method: '', route: '', query: '', timing: 1)
|
116
114
|
expect(subject.check_performance_options(resource))
|
117
115
|
.to be_an(Airbrake::Promise)
|
118
116
|
end
|
@@ -122,14 +120,14 @@ RSpec.describe Airbrake::Config do
|
|
122
120
|
|
123
121
|
let(:resource) do
|
124
122
|
Airbrake::Request.new(
|
125
|
-
method: 'GET', route: '/foo', status_code: 200,
|
123
|
+
method: 'GET', route: '/foo', status_code: 200, timing: 1,
|
126
124
|
)
|
127
125
|
end
|
128
126
|
|
129
127
|
it "returns a rejected promise" do
|
130
128
|
promise = subject.check_performance_options(resource)
|
131
129
|
expect(promise.value).to eq(
|
132
|
-
'error' => "The Performance Stats feature is disabled"
|
130
|
+
'error' => "The Performance Stats feature is disabled",
|
133
131
|
)
|
134
132
|
end
|
135
133
|
end
|
@@ -138,15 +136,13 @@ RSpec.describe Airbrake::Config do
|
|
138
136
|
before { subject.query_stats = false }
|
139
137
|
|
140
138
|
let(:resource) do
|
141
|
-
Airbrake::Query.new(
|
142
|
-
method: 'GET', route: '/foo', query: '', start_time: Time.new
|
143
|
-
)
|
139
|
+
Airbrake::Query.new(method: 'GET', route: '/foo', query: '', timing: 1)
|
144
140
|
end
|
145
141
|
|
146
142
|
it "returns a rejected promise" do
|
147
143
|
promise = subject.check_performance_options(resource)
|
148
144
|
expect(promise.value).to eq(
|
149
|
-
'error' => "The Query Stats feature is disabled"
|
145
|
+
'error' => "The Query Stats feature is disabled",
|
150
146
|
)
|
151
147
|
end
|
152
148
|
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
|
@@ -19,8 +19,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
19
19
|
[/\Abin/],
|
20
20
|
[
|
21
21
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
22
|
-
{ bingo: 'bango', bongo: '[Filtered]', bash: '[Filtered]' }
|
23
|
-
]
|
22
|
+
{ bingo: 'bango', bongo: '[Filtered]', bash: '[Filtered]' },
|
23
|
+
],
|
24
24
|
)
|
25
25
|
end
|
26
26
|
|
@@ -30,8 +30,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
30
30
|
[:bongo],
|
31
31
|
[
|
32
32
|
{ bongo: 'bish', bash: 'bosh', bbashh: 'bboshh' },
|
33
|
-
{ bongo: 'bish', bash: '[Filtered]', bbashh: '[Filtered]' }
|
34
|
-
]
|
33
|
+
{ bongo: 'bish', bash: '[Filtered]', bbashh: '[Filtered]' },
|
34
|
+
],
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
@@ -41,8 +41,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
41
41
|
['bash'],
|
42
42
|
[
|
43
43
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
44
|
-
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: 'bosh' }
|
45
|
-
]
|
44
|
+
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: 'bosh' },
|
45
|
+
],
|
46
46
|
)
|
47
47
|
end
|
48
48
|
|
@@ -53,8 +53,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
53
53
|
[proc { 'bongo' }, :bash],
|
54
54
|
[
|
55
55
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
56
|
-
{ bingo: '[Filtered]', bongo: 'bish', bash: 'bosh' }
|
57
|
-
]
|
56
|
+
{ bingo: '[Filtered]', bongo: 'bish', bash: 'bosh' },
|
57
|
+
],
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
@@ -64,13 +64,13 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
64
64
|
[proc { Object.new }],
|
65
65
|
[
|
66
66
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
67
|
-
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' }
|
68
|
-
]
|
67
|
+
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' },
|
68
|
+
],
|
69
69
|
)
|
70
70
|
|
71
71
|
it "logs an error" do
|
72
72
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
73
|
-
/KeysWhitelist is invalid.+patterns: \[#<Object:.+>\]
|
73
|
+
/KeysWhitelist is invalid.+patterns: \[#<Object:.+>\]/,
|
74
74
|
)
|
75
75
|
keys_whitelist = described_class.new(patterns)
|
76
76
|
keys_whitelist.call(notice)
|
@@ -83,7 +83,7 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
83
83
|
context "and when the filter is called once" do
|
84
84
|
it "logs an error" do
|
85
85
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
86
|
-
/KeysWhitelist is invalid.+patterns: \[#<Proc:.+>\]
|
86
|
+
/KeysWhitelist is invalid.+patterns: \[#<Proc:.+>\]/,
|
87
87
|
)
|
88
88
|
keys_whitelist = described_class.new(patterns)
|
89
89
|
keys_whitelist.call(notice)
|
@@ -94,8 +94,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
94
94
|
[proc { proc { ['bingo'] } }],
|
95
95
|
[
|
96
96
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
97
|
-
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' }
|
98
|
-
]
|
97
|
+
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' },
|
98
|
+
],
|
99
99
|
)
|
100
100
|
end
|
101
101
|
end
|
@@ -107,13 +107,13 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
107
107
|
[Object.new],
|
108
108
|
[
|
109
109
|
{ bingo: 'bango', bongo: 'bish', bash: 'bosh' },
|
110
|
-
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' }
|
111
|
-
]
|
110
|
+
{ bingo: '[Filtered]', bongo: '[Filtered]', bash: '[Filtered]' },
|
111
|
+
],
|
112
112
|
)
|
113
113
|
|
114
114
|
it "logs an error" do
|
115
115
|
expect(Airbrake::Loggable.instance).to receive(:error).with(
|
116
|
-
/KeysWhitelist is invalid.+patterns: \[#<Object:.+>\]
|
116
|
+
/KeysWhitelist is invalid.+patterns: \[#<Object:.+>\]/,
|
117
117
|
)
|
118
118
|
keys_whitelist = described_class.new(patterns)
|
119
119
|
keys_whitelist.call(notice)
|
@@ -127,8 +127,8 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
127
127
|
%w[bongo bish],
|
128
128
|
[
|
129
129
|
{ bingo: 'bango', bongo: { bish: 'bash' } },
|
130
|
-
{ bingo: '[Filtered]', bongo: { bish: 'bash' } }
|
131
|
-
]
|
130
|
+
{ bingo: '[Filtered]', bongo: { bish: 'bash' } },
|
131
|
+
],
|
132
132
|
)
|
133
133
|
end
|
134
134
|
|
@@ -166,7 +166,7 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
166
166
|
notice[:context][:url] = 'http://localhost:3000/crash?foo=bar&baz=bongo&bish=bash'
|
167
167
|
subject.call(notice)
|
168
168
|
expect(notice[:context][:url]).to(
|
169
|
-
eq('http://localhost:3000/crash?foo=[Filtered]&baz=[Filtered]&bish=bash')
|
169
|
+
eq('http://localhost:3000/crash?foo=[Filtered]&baz=[Filtered]&bish=bash'),
|
170
170
|
)
|
171
171
|
end
|
172
172
|
end
|
@@ -177,7 +177,7 @@ RSpec.describe Airbrake::Filters::KeysWhitelist do
|
|
177
177
|
'http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash'
|
178
178
|
subject.call(notice)
|
179
179
|
expect(notice[:context][:url]).to(
|
180
|
-
eq('http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash')
|
180
|
+
eq('http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash'),
|
181
181
|
)
|
182
182
|
end
|
183
183
|
end
|