airbrake-ruby 5.2.0 → 5.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/airbrake-ruby.rb +3 -2
  3. data/lib/airbrake-ruby/async_sender.rb +3 -1
  4. data/lib/airbrake-ruby/context.rb +51 -0
  5. data/lib/airbrake-ruby/filter_chain.rb +2 -0
  6. data/lib/airbrake-ruby/filters/context_filter.rb +4 -5
  7. data/lib/airbrake-ruby/filters/exception_attributes_filter.rb +1 -1
  8. data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +1 -1
  9. data/lib/airbrake-ruby/filters/git_revision_filter.rb +1 -1
  10. data/lib/airbrake-ruby/filters/keys_filter.rb +2 -2
  11. data/lib/airbrake-ruby/filters/sql_filter.rb +2 -2
  12. data/lib/airbrake-ruby/filters/thread_filter.rb +1 -1
  13. data/lib/airbrake-ruby/ignorable.rb +0 -2
  14. data/lib/airbrake-ruby/notice_notifier.rb +3 -4
  15. data/lib/airbrake-ruby/performance_notifier.rb +1 -2
  16. data/lib/airbrake-ruby/remote_settings/settings_data.rb +1 -1
  17. data/lib/airbrake-ruby/tdigest.rb +7 -6
  18. data/lib/airbrake-ruby/thread_pool.rb +5 -3
  19. data/lib/airbrake-ruby/timed_trace.rb +1 -3
  20. data/lib/airbrake-ruby/version.rb +1 -1
  21. data/spec/airbrake_spec.rb +139 -76
  22. data/spec/async_sender_spec.rb +10 -8
  23. data/spec/backtrace_spec.rb +13 -10
  24. data/spec/benchmark_spec.rb +5 -3
  25. data/spec/code_hunk_spec.rb +24 -15
  26. data/spec/config/processor_spec.rb +12 -4
  27. data/spec/config/validator_spec.rb +5 -2
  28. data/spec/config_spec.rb +24 -16
  29. data/spec/context_spec.rb +54 -0
  30. data/spec/deploy_notifier_spec.rb +6 -4
  31. data/spec/file_cache_spec.rb +1 -0
  32. data/spec/filter_chain_spec.rb +29 -24
  33. data/spec/filters/context_filter_spec.rb +14 -5
  34. data/spec/filters/dependency_filter_spec.rb +3 -1
  35. data/spec/filters/exception_attributes_filter_spec.rb +5 -3
  36. data/spec/filters/gem_root_filter_spec.rb +5 -2
  37. data/spec/filters/git_last_checkout_filter_spec.rb +10 -12
  38. data/spec/filters/git_repository_filter.rb +9 -9
  39. data/spec/filters/git_revision_filter_spec.rb +19 -19
  40. data/spec/filters/keys_allowlist_spec.rb +25 -16
  41. data/spec/filters/keys_blocklist_spec.rb +25 -18
  42. data/spec/filters/root_directory_filter_spec.rb +3 -3
  43. data/spec/filters/sql_filter_spec.rb +26 -26
  44. data/spec/filters/system_exit_filter_spec.rb +4 -2
  45. data/spec/filters/thread_filter_spec.rb +15 -13
  46. data/spec/loggable_spec.rb +2 -2
  47. data/spec/monotonic_time_spec.rb +8 -6
  48. data/spec/nested_exception_spec.rb +46 -46
  49. data/spec/notice_notifier/options_spec.rb +23 -13
  50. data/spec/notice_notifier_spec.rb +52 -47
  51. data/spec/notice_spec.rb +6 -2
  52. data/spec/performance_notifier_spec.rb +67 -60
  53. data/spec/promise_spec.rb +38 -32
  54. data/spec/remote_settings/callback_spec.rb +27 -8
  55. data/spec/remote_settings/settings_data_spec.rb +4 -4
  56. data/spec/remote_settings_spec.rb +18 -8
  57. data/spec/response_spec.rb +34 -12
  58. data/spec/stashable_spec.rb +5 -5
  59. data/spec/stat_spec.rb +7 -5
  60. data/spec/sync_sender_spec.rb +49 -16
  61. data/spec/tdigest_spec.rb +60 -55
  62. data/spec/thread_pool_spec.rb +65 -55
  63. data/spec/time_truncate_spec.rb +4 -2
  64. data/spec/timed_trace_spec.rb +32 -30
  65. data/spec/truncator_spec.rb +72 -43
  66. metadata +51 -48
@@ -1,5 +1,5 @@
1
1
  RSpec.describe Airbrake::Filters::KeysAllowlist do
2
- subject { described_class.new(patterns) }
2
+ subject(:keys_allowlist_filter) { described_class.new(patterns) }
3
3
 
4
4
  let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) }
5
5
 
@@ -8,11 +8,15 @@ RSpec.describe Airbrake::Filters::KeysAllowlist do
8
8
 
9
9
  it "filters out the matching values" do
10
10
  notice[:params] = params.first
11
- subject.call(notice)
11
+ keys_allowlist_filter.call(notice)
12
12
  expect(notice[:params]).to eq(params.last)
13
13
  end
14
14
  end
15
15
 
16
+ before do
17
+ allow(Airbrake::Loggable.instance).to receive(:error)
18
+ end
19
+
16
20
  context "when a pattern is a Regexp" do
17
21
  include_examples(
18
22
  'pattern matching',
@@ -69,11 +73,12 @@ RSpec.describe Airbrake::Filters::KeysAllowlist do
69
73
  )
70
74
 
71
75
  it "logs an error" do
72
- expect(Airbrake::Loggable.instance).to receive(:error).with(
73
- /KeysAllowlist is invalid.+patterns: \[#<Object:.+>\]/,
74
- )
75
76
  keys_allowlist = described_class.new(patterns)
76
77
  keys_allowlist.call(notice)
78
+
79
+ expect(Airbrake::Loggable.instance).to have_received(:error).with(
80
+ /KeysAllowlist is invalid.+patterns: \[#<Object:.+>\]/,
81
+ )
77
82
  end
78
83
  end
79
84
 
@@ -82,11 +87,12 @@ RSpec.describe Airbrake::Filters::KeysAllowlist do
82
87
 
83
88
  context "and when the filter is called once" do
84
89
  it "logs an error" do
85
- expect(Airbrake::Loggable.instance).to receive(:error).with(
86
- /KeysAllowlist is invalid.+patterns: \[#<Proc:.+>\]/,
87
- )
88
90
  keys_allowlist = described_class.new(patterns)
89
91
  keys_allowlist.call(notice)
92
+
93
+ expect(Airbrake::Loggable.instance).to have_received(:error).with(
94
+ /KeysAllowlist is invalid.+patterns: \[#<Proc:.+>\]/,
95
+ )
90
96
  end
91
97
 
92
98
  include_examples(
@@ -112,11 +118,12 @@ RSpec.describe Airbrake::Filters::KeysAllowlist do
112
118
  )
113
119
 
114
120
  it "logs an error" do
115
- expect(Airbrake::Loggable.instance).to receive(:error).with(
116
- /KeysAllowlist is invalid.+patterns: \[#<Object:.+>\]/,
117
- )
118
121
  keys_allowlist = described_class.new(patterns)
119
122
  keys_allowlist.call(notice)
123
+
124
+ expect(Airbrake::Loggable.instance).to have_received(:error).with(
125
+ /KeysAllowlist is invalid.+patterns: \[#<Object:.+>\]/,
126
+ )
120
127
  end
121
128
  end
122
129
 
@@ -145,14 +152,16 @@ RSpec.describe Airbrake::Filters::KeysAllowlist do
145
152
  notice[:params] = bongo
146
153
 
147
154
  begin
148
- expect { subject.call(notice) }.to raise_error(SystemStackError)
155
+ expect { keys_allowlist_filter.call(notice) }.to raise_error(SystemStackError)
149
156
  rescue RSpec::Expectations::ExpectationNotMetError => ex
150
157
  # JRuby might raise two different exceptions, which represent the same
151
158
  # thing. One is a Java exception, the other is a Ruby exception.
152
159
  # Likely a bug: https://github.com/jruby/jruby/issues/1903
153
160
  raise ex unless RUBY_ENGINE == 'jruby'
154
161
 
155
- expect { subject.call(notice) }.to raise_error(java.lang.StackOverflowError)
162
+ expect do
163
+ keys_allowlist_filter.call(notice)
164
+ end.to raise_error(java.lang.StackOverflowError)
156
165
  end
157
166
  end
158
167
  end
@@ -165,7 +174,7 @@ RSpec.describe Airbrake::Filters::KeysAllowlist do
165
174
  context "when it contains query params" do
166
175
  it "filters the params" do
167
176
  notice[:context][:url] = 'http://localhost:3000/crash?foo=bar&baz=bongo&bish=bash'
168
- subject.call(notice)
177
+ keys_allowlist_filter.call(notice)
169
178
  expect(notice[:context][:url]).to(
170
179
  eq('http://localhost:3000/crash?foo=[Filtered]&baz=[Filtered]&bish=bash'),
171
180
  )
@@ -176,7 +185,7 @@ RSpec.describe Airbrake::Filters::KeysAllowlist do
176
185
  it "leaves the URL unfiltered" do
177
186
  notice[:context][:url] =
178
187
  'http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash'
179
- subject.call(notice)
188
+ keys_allowlist_filter.call(notice)
180
189
  expect(notice[:context][:url]).to(
181
190
  eq('http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash'),
182
191
  )
@@ -186,7 +195,7 @@ RSpec.describe Airbrake::Filters::KeysAllowlist do
186
195
  context "when it is without a query" do
187
196
  it "leaves the URL untouched" do
188
197
  notice[:context][:url] = 'http://localhost:3000/crash'
189
- subject.call(notice)
198
+ keys_allowlist_filter.call(notice)
190
199
  expect(notice[:context][:url]).to(eq('http://localhost:3000/crash'))
191
200
  end
192
201
  end
@@ -1,5 +1,5 @@
1
1
  RSpec.describe Airbrake::Filters::KeysBlocklist do
2
- subject { described_class.new(patterns) }
2
+ subject(:keys_blocklist_filter) { described_class.new(patterns) }
3
3
 
4
4
  let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) }
5
5
 
@@ -8,11 +8,15 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
8
8
 
9
9
  it "filters out the matching values" do
10
10
  notice[:params] = params.first
11
- subject.call(notice)
11
+ keys_blocklist_filter.call(notice)
12
12
  expect(notice[:params]).to eq(params.last)
13
13
  end
14
14
  end
15
15
 
16
+ before do
17
+ allow(Airbrake::Loggable.instance).to receive(:error)
18
+ end
19
+
16
20
  context "when a pattern is a Regexp" do
17
21
  include_examples(
18
22
  'pattern matching',
@@ -29,7 +33,7 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
29
33
  # https://github.com/airbrake/airbrake/issues/739
30
34
  it "doesn't fail" do
31
35
  notice[:params] = { bingo: { {} => 'unfiltered' } }
32
- expect { subject.call(notice) }.not_to raise_error
36
+ expect { keys_blocklist_filter.call(notice) }.not_to raise_error
33
37
  end
34
38
  end
35
39
  end
@@ -90,11 +94,12 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
90
94
  )
91
95
 
92
96
  it "logs an error" do
93
- expect(Airbrake::Loggable.instance).to receive(:error).with(
94
- /KeysBlocklist is invalid.+patterns: \[#<Object:.+>\]/,
95
- )
96
97
  keys_blocklist = described_class.new(patterns)
97
98
  keys_blocklist.call(notice)
99
+
100
+ expect(Airbrake::Loggable.instance).to have_received(:error).with(
101
+ /KeysBlocklist is invalid.+patterns: \[#<Object:.+>\]/,
102
+ )
98
103
  end
99
104
  end
100
105
 
@@ -103,18 +108,19 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
103
108
 
104
109
  context "and when the filter is called once" do
105
110
  it "logs an error" do
106
- expect(Airbrake::Loggable.instance).to receive(:error).with(
107
- /KeysBlocklist is invalid.+patterns: \[#<Proc:.+>\]/,
108
- )
109
111
  keys_blocklist = described_class.new(patterns)
110
112
  keys_blocklist.call(notice)
113
+
114
+ expect(Airbrake::Loggable.instance).to have_received(:error).with(
115
+ /KeysBlocklist is invalid.+patterns: \[#<Proc:.+>\]/,
116
+ )
111
117
  end
112
118
  end
113
119
 
114
120
  context "and when the filter is called twice" do
115
121
  it "unwinds procs and filters keys" do
116
122
  notice[:params] = { bingo: 'bango', bongo: 'bish' }
117
- 2.times { subject.call(notice) }
123
+ 2.times { keys_blocklist_filter.call(notice) }
118
124
  expect(notice[:params]).to eq(bingo: '[Filtered]', bongo: 'bish')
119
125
  end
120
126
  end
@@ -132,11 +138,12 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
132
138
  )
133
139
 
134
140
  it "logs an error" do
135
- expect(Airbrake::Loggable.instance).to receive(:error).with(
136
- /KeysBlocklist is invalid.+patterns: \[#<Object:.+>\]/,
137
- )
138
141
  keys_blocklist = described_class.new(patterns)
139
142
  keys_blocklist.call(notice)
143
+
144
+ expect(Airbrake::Loggable.instance).to have_received(:error).with(
145
+ /KeysBlocklist is invalid.+patterns: \[#<Object:.+>\]/,
146
+ )
140
147
  end
141
148
  end
142
149
 
@@ -185,7 +192,7 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
185
192
  notice[:context][:url] =
186
193
  'http://localhost:3000/crash?foo=bar&baz=bongo&bish=bash&color=%23FFAAFF'
187
194
 
188
- subject.call(notice)
195
+ keys_blocklist_filter.call(notice)
189
196
  expect(notice[:context][:url]).to(
190
197
  eq('http://localhost:3000/crash?foo=bar&baz=bongo&bish=[Filtered]&color=%23FFAAFF'),
191
198
  )
@@ -197,7 +204,7 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
197
204
 
198
205
  it "filters out the user" do
199
206
  notice[:context][:user] = { id: 1337, name: 'Bingo Bango' }
200
- subject.call(notice)
207
+ keys_blocklist_filter.call(notice)
201
208
  expect(notice[:context][:user]).to eq('[Filtered]')
202
209
  end
203
210
  end
@@ -207,7 +214,7 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
207
214
 
208
215
  it "filters out individual user fields" do
209
216
  notice[:context][:user] = { id: 1337, name: 'Bingo Bango' }
210
- subject.call(notice)
217
+ keys_blocklist_filter.call(notice)
211
218
  expect(notice[:context][:user][:name]).to eq('[Filtered]')
212
219
  end
213
220
  end
@@ -218,7 +225,7 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
218
225
 
219
226
  it "filters out the headers" do
220
227
  notice[:context][:headers] = { 'HTTP_COOKIE' => 'banana' }
221
- subject.call(notice)
228
+ keys_blocklist_filter.call(notice)
222
229
  expect(notice[:context][:headers]).to eq('[Filtered]')
223
230
  end
224
231
 
@@ -227,7 +234,7 @@ RSpec.describe Airbrake::Filters::KeysBlocklist do
227
234
 
228
235
  it "filters out individual header fields" do
229
236
  notice[:context][:headers] = { 'HTTP_COOKIE' => 'banana' }
230
- subject.call(notice)
237
+ keys_blocklist_filter.call(notice)
231
238
  expect(notice[:context][:headers]['HTTP_COOKIE']).to eq('[Filtered]')
232
239
  end
233
240
  end
@@ -1,5 +1,5 @@
1
1
  RSpec.describe Airbrake::Filters::RootDirectoryFilter do
2
- subject { described_class.new(root_directory) }
2
+ subject(:root_directory_filter) { described_class.new(root_directory) }
3
3
 
4
4
  let(:root_directory) { '/var/www/project' }
5
5
  let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) }
@@ -14,7 +14,7 @@ RSpec.describe Airbrake::Filters::RootDirectoryFilter do
14
14
  ]
15
15
  # rubocop:enable Layout/LineLength
16
16
 
17
- subject.call(notice)
17
+ root_directory_filter.call(notice)
18
18
 
19
19
  # rubocop:disable Layout/LineLength
20
20
  expect(notice[:errors].first[:backtrace]).to(
@@ -32,7 +32,7 @@ RSpec.describe Airbrake::Filters::RootDirectoryFilter do
32
32
 
33
33
  it "does not filter file when it is nil" do
34
34
  expect(notice[:errors].first[:file]).to be_nil
35
- expect { subject.call(notice) }.not_to(
35
+ expect { root_directory_filter.call(notice) }.not_to(
36
36
  change { notice[:errors].first[:file] },
37
37
  )
38
38
  end
@@ -20,14 +20,14 @@ RSpec.describe Airbrake::Filters::SqlFilter do
20
20
  end
21
21
  end
22
22
 
23
- ALL_DIALECTS = %i[mysql postgres sqlite cassandra oracle].freeze
23
+ all_dialects = %i[mysql postgres sqlite cassandra oracle].freeze
24
24
 
25
25
  # rubocop:disable Layout/LineLength
26
26
  [
27
27
  {
28
28
  input: 'SELECT * FROM things;',
29
29
  output: 'SELECT * FROM things;',
30
- dialects: ALL_DIALECTS,
30
+ dialects: all_dialects,
31
31
  }, {
32
32
  input: "SELECT `t001`.`c2` FROM `t001` WHERE `t001`.`c2` = 'value' AND c3=\"othervalue\" LIMIT ?",
33
33
  output: "SELECT `t001`.`c2` FROM `t001` WHERE `t001`.`c2` = ? AND c3=? LIMIT ?",
@@ -39,7 +39,7 @@ RSpec.describe Airbrake::Filters::SqlFilter do
39
39
  }, {
40
40
  input: "SELECT * FROM t WHERE foo='bar/*' AND baz='whatever */qux'",
41
41
  output: "SELECT * FROM t WHERE foo=? AND baz=?",
42
- dialects: ALL_DIALECTS,
42
+ dialects: all_dialects,
43
43
  }, {
44
44
  input: "SELECT \"t001\".\"c2\" FROM \"t001\" WHERE \"t001\".\"c2\" = 'value' AND c3=1234 LIMIT 1",
45
45
  output: "SELECT \"t001\".\"c2\" FROM \"t001\" WHERE \"t001\".\"c2\" = ? AND c3=? LIMIT ?",
@@ -51,19 +51,19 @@ RSpec.describe Airbrake::Filters::SqlFilter do
51
51
  }, {
52
52
  input: "SELECT * FROM t WHERE foo='bar--' AND\n baz='qux--'",
53
53
  output: "SELECT * FROM t WHERE foo=? AND\n baz=?",
54
- dialects: ALL_DIALECTS,
54
+ dialects: all_dialects,
55
55
  }, {
56
56
  input: "SELECT * FROM foo WHERE bar='baz' /* Hide Me */",
57
57
  output: "SELECT * FROM foo WHERE bar=? ?",
58
- dialects: ALL_DIALECTS,
58
+ dialects: all_dialects,
59
59
  }, {
60
60
  input: "SELECT * FROM foobar WHERE password='hunter2'\n-- No peeking!",
61
61
  output: "SELECT * FROM foobar WHERE password=?\n?",
62
- dialects: ALL_DIALECTS,
62
+ dialects: all_dialects,
63
63
  }, {
64
64
  input: "SELECT foo, bar FROM baz WHERE password='hunter2' # Secret",
65
65
  output: "SELECT foo, bar FROM baz WHERE password=? ?",
66
- dialects: ALL_DIALECTS,
66
+ dialects: all_dialects,
67
67
  }, {
68
68
  input: "SELECT \"col1\", \"col2\" from \"table\" WHERE \"col3\"=E'foo\\'bar\\\\baz' AND country=e'foo\\'bar\\\\baz'",
69
69
  output: "SELECT \"col1\", \"col2\" from \"table\" WHERE \"col3\"=E?",
@@ -79,11 +79,11 @@ RSpec.describe Airbrake::Filters::SqlFilter do
79
79
  }, {
80
80
  input: "SELECT c11.col1, c22.col2 FROM table c11, table c22 WHERE value='nothing'",
81
81
  output: "SELECT c11.col1, c22.col2 FROM table c11, table c22 WHERE value=?",
82
- dialects: ALL_DIALECTS,
82
+ dialects: all_dialects,
83
83
  }, {
84
84
  input: "INSERT INTO X VALUES(1, 23456, 123.456, 99+100)",
85
85
  output: "INSERT INTO X VALUES(?)",
86
- dialects: ALL_DIALECTS,
86
+ dialects: all_dialects,
87
87
  }, {
88
88
  input: "SELECT * FROM table WHERE name=\"foo\" AND value=\"don't\"",
89
89
  output: "SELECT * FROM table WHERE name=? AND value=?",
@@ -91,19 +91,19 @@ RSpec.describe Airbrake::Filters::SqlFilter do
91
91
  }, {
92
92
  input: "SELECT * FROM table WHERE name='foo' AND value = 'bar'",
93
93
  output: "SELECT * FROM table WHERE name=? AND value = ?",
94
- dialects: ALL_DIALECTS,
94
+ dialects: all_dialects,
95
95
  }, {
96
96
  input: "SELECT * FROM table WHERE col='foo\\''bar'",
97
97
  output: "SELECT * FROM table WHERE col=?",
98
- dialects: ALL_DIALECTS,
98
+ dialects: all_dialects,
99
99
  }, {
100
100
  input: "SELECT * FROM table WHERE col1='foo\"bar' AND col2='what\"ever'",
101
101
  output: "SELECT * FROM table WHERE col1=? AND col2=?",
102
- dialects: ALL_DIALECTS,
102
+ dialects: all_dialects,
103
103
  }, {
104
104
  input: "select * from accounts where accounts.name != 'dude\n newline' order by accounts.name",
105
105
  output: "select * from accounts where accounts.name != ? order by accounts.name",
106
- dialects: ALL_DIALECTS,
106
+ dialects: all_dialects,
107
107
  }, {
108
108
  input: "SELECT * FROM table WHERE col1=\"don't\" AND col2=\"won't\"",
109
109
  output: "SELECT * FROM table WHERE col1=? AND col2=?",
@@ -115,7 +115,7 @@ RSpec.describe Airbrake::Filters::SqlFilter do
115
115
  }, {
116
116
  input: "SELECT * FROM table WHERE name='foo\\' AND color='blue'",
117
117
  output: "SELECT * FROM table WHERE name=?",
118
- dialects: ALL_DIALECTS,
118
+ dialects: all_dialects,
119
119
  }, {
120
120
  input: "SELECT * FROM table WHERE foo=\"this string ends with a backslash\\\\\"",
121
121
  output: "SELECT * FROM table WHERE foo=?",
@@ -123,36 +123,36 @@ RSpec.describe Airbrake::Filters::SqlFilter do
123
123
  }, {
124
124
  input: "SELECT * FROM table WHERE foo='this string ends with a backslash\\\\'",
125
125
  output: "SELECT * FROM table WHERE foo=?",
126
- dialects: ALL_DIALECTS,
126
+ dialects: all_dialects,
127
127
  }, {
128
128
  # TODO: fix this example.
129
129
  input: "SELECT * FROM table WHERE name='foo\'' AND color='blue'",
130
130
  output: "Error: Airbrake::Query was not filtered",
131
- dialects: ALL_DIALECTS,
131
+ dialects: all_dialects,
132
132
  }, {
133
133
  input: "INSERT INTO X values('', 'a''b c',0, 1 , 'd''e f''s h')",
134
134
  output: "INSERT INTO X values(?)",
135
- dialects: ALL_DIALECTS,
135
+ dialects: all_dialects,
136
136
  }, {
137
137
  input: "SELECT * FROM t WHERE -- '\n bar='baz' -- '",
138
138
  output: "SELECT * FROM t WHERE ?\n bar=? ?",
139
- dialects: ALL_DIALECTS,
139
+ dialects: all_dialects,
140
140
  }, {
141
141
  input: "SELECT * FROM t WHERE /* ' */\n bar='baz' -- '",
142
142
  output: "SELECT * FROM t WHERE ?\n bar=? ?",
143
- dialects: ALL_DIALECTS,
143
+ dialects: all_dialects,
144
144
  }, {
145
145
  input: "SELECT * FROM t WHERE -- '\n /* ' */ c2='xxx' /* ' */\n c='x\n xx' -- '",
146
146
  output: "SELECT * FROM t WHERE ?\n ? c2=? ?\n c=? ?",
147
- dialects: ALL_DIALECTS,
147
+ dialects: all_dialects,
148
148
  }, {
149
149
  input: "SELECT * FROM t WHERE -- '\n c='x\n xx' -- '",
150
150
  output: "SELECT * FROM t WHERE ?\n c=? ?",
151
- dialects: ALL_DIALECTS,
151
+ dialects: all_dialects,
152
152
  }, {
153
153
  input: "SELECT * FROM foo WHERE col='value1' AND /* don't */ col2='value1' /* won't */",
154
154
  output: "SELECT * FROM foo WHERE col=? AND ? col2=? ?",
155
- dialects: ALL_DIALECTS,
155
+ dialects: all_dialects,
156
156
  }, {
157
157
  input: "SELECT * FROM table WHERE foo='bar' AND baz=\"nothing to see here'",
158
158
  output: "Error: Airbrake::Query was not filtered",
@@ -160,7 +160,7 @@ RSpec.describe Airbrake::Filters::SqlFilter do
160
160
  }, {
161
161
  input: "SELECT * FROM table WHERE foo='bar' AND baz='nothing to see here",
162
162
  output: "Error: Airbrake::Query was not filtered",
163
- dialects: ALL_DIALECTS,
163
+ dialects: all_dialects,
164
164
  }, {
165
165
  input: "SELECT * FROM \"foo\" WHERE \"foo\" = $a$dollar quotes can be $b$nested$b$$a$ and bar = 'baz'",
166
166
  output: "SELECT * FROM \"foo\" WHERE \"foo\" = ? and bar = ?",
@@ -172,11 +172,11 @@ RSpec.describe Airbrake::Filters::SqlFilter do
172
172
  }, {
173
173
  input: "select * from foo where bar = 'some\\tthing' and baz = 10",
174
174
  output: "select * from foo where bar = ? and baz = ?",
175
- dialects: ALL_DIALECTS,
175
+ dialects: all_dialects,
176
176
  }, {
177
177
  input: "select * from users where user = 'user1\\' password = 'hunter 2' -- ->don't count this quote",
178
178
  output: "select * from users where user = ?",
179
- dialects: ALL_DIALECTS,
179
+ dialects: all_dialects,
180
180
  }, {
181
181
  input: "select * from foo where bar=q'[baz's]' and x=5",
182
182
  output: "select * from foo where bar=? and x=?",
@@ -204,7 +204,7 @@ RSpec.describe Airbrake::Filters::SqlFilter do
204
204
  }, {
205
205
  input: "select * from foo where bar=1.234e-5 and x=5",
206
206
  output: "select * from foo where bar=? and x=?",
207
- dialects: ALL_DIALECTS,
207
+ dialects: all_dialects,
208
208
  }, {
209
209
  input: "select * from foo where bar=01234567-89ab-cdef-0123-456789abcdef and x=5",
210
210
  output: "select * from foo where bar=? and x=?",
@@ -1,7 +1,9 @@
1
1
  RSpec.describe Airbrake::Filters::SystemExitFilter do
2
+ subject(:system_exit_filter) { described_class.new }
3
+
2
4
  it "marks SystemExit exceptions as ignored" do
3
5
  notice = Airbrake::Notice.new(SystemExit.new)
4
- expect { subject.call(notice) }.to(
6
+ expect { system_exit_filter.call(notice) }.to(
5
7
  change { notice.ignored? }.from(false).to(true),
6
8
  )
7
9
  end
@@ -9,6 +11,6 @@ RSpec.describe Airbrake::Filters::SystemExitFilter do
9
11
  it "doesn't mark non SystemExit exceptions as ignored" do
10
12
  notice = Airbrake::Notice.new(AirbrakeTestError.new)
11
13
  expect(notice).not_to be_ignored
12
- expect { subject.call(notice) }.not_to(change { notice.ignored? })
14
+ expect { system_exit_filter.call(notice) }.not_to(change { notice.ignored? })
13
15
  end
14
16
  end