rollbar 2.18.2 → 2.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +15 -0
  3. data/.travis.yml +155 -93
  4. data/Gemfile +19 -13
  5. data/README.md +12 -0
  6. data/gemfiles/rails30.gemfile +17 -10
  7. data/gemfiles/rails31.gemfile +20 -12
  8. data/gemfiles/rails32.gemfile +16 -7
  9. data/gemfiles/rails40.gemfile +16 -5
  10. data/gemfiles/rails41.gemfile +15 -5
  11. data/gemfiles/rails42.gemfile +25 -14
  12. data/gemfiles/rails50.gemfile +15 -8
  13. data/gemfiles/rails51.gemfile +15 -8
  14. data/gemfiles/rails52.gemfile +62 -0
  15. data/gemfiles/ruby_1_8_and_1_9_2.gemfile +2 -2
  16. data/lib/rails/rollbar_runner.rb +16 -1
  17. data/lib/rollbar/capistrano.rb +71 -39
  18. data/lib/rollbar/capistrano3.rb +53 -1
  19. data/lib/rollbar/capistrano_tasks.rb +131 -0
  20. data/lib/rollbar/configuration.rb +13 -4
  21. data/lib/rollbar/delay/active_job.rb +17 -0
  22. data/lib/rollbar/delay/sidekiq.rb +3 -1
  23. data/lib/rollbar/delay/thread.rb +1 -1
  24. data/lib/rollbar/deploy.rb +69 -0
  25. data/lib/rollbar/item.rb +17 -6
  26. data/lib/rollbar/middleware/js.rb +25 -3
  27. data/lib/rollbar/middleware/js/json_value.rb +26 -0
  28. data/lib/rollbar/notifier.rb +32 -13
  29. data/lib/rollbar/plugins/active_job.rb +3 -0
  30. data/lib/rollbar/plugins/rails/controller_methods.rb +2 -1
  31. data/lib/rollbar/plugins/rails/railtie_mixin.rb +7 -1
  32. data/lib/rollbar/rake_tasks.rb +126 -67
  33. data/lib/rollbar/scrubbers/params.rb +6 -0
  34. data/lib/rollbar/util.rb +75 -45
  35. data/lib/rollbar/util/hash.rb +15 -6
  36. data/lib/rollbar/version.rb +1 -1
  37. data/rollbar.gemspec +2 -3
  38. metadata +9 -261
  39. data/lib/rollbar/tasks/rollbar.cap +0 -47
  40. data/spec/cacert.pem +0 -3988
  41. data/spec/controllers/home_controller_spec.rb +0 -480
  42. data/spec/delay/sidekiq_spec.rb +0 -61
  43. data/spec/delay/sucker_punch_spec.rb +0 -25
  44. data/spec/delayed/backend/test.rb +0 -140
  45. data/spec/delayed/serialization/test.rb +0 -0
  46. data/spec/dummyapp/.gitignore +0 -73
  47. data/spec/dummyapp/Rakefile +0 -7
  48. data/spec/dummyapp/app/assets/javascripts/application.js +0 -3
  49. data/spec/dummyapp/app/assets/stylesheets/application.css.scss +0 -37
  50. data/spec/dummyapp/app/controllers/application_controller.rb +0 -3
  51. data/spec/dummyapp/app/controllers/home_controller.rb +0 -60
  52. data/spec/dummyapp/app/controllers/users_controller.rb +0 -17
  53. data/spec/dummyapp/app/helpers/.gitkeep +0 -0
  54. data/spec/dummyapp/app/mailers/.gitkeep +0 -0
  55. data/spec/dummyapp/app/models/.gitkeep +0 -0
  56. data/spec/dummyapp/app/models/book.rb +0 -5
  57. data/spec/dummyapp/app/models/post.rb +0 -9
  58. data/spec/dummyapp/app/models/user.rb +0 -9
  59. data/spec/dummyapp/app/views/devise/registrations/edit.html.erb +0 -27
  60. data/spec/dummyapp/app/views/devise/registrations/new.html.erb +0 -20
  61. data/spec/dummyapp/app/views/devise/shared/_links.html.erb +0 -25
  62. data/spec/dummyapp/app/views/home/cause_exception.html.erb +0 -1
  63. data/spec/dummyapp/app/views/home/index.html.erb +0 -4
  64. data/spec/dummyapp/app/views/home/report_exception.html.erb +0 -1
  65. data/spec/dummyapp/app/views/js/test.html.erb +0 -1
  66. data/spec/dummyapp/app/views/layouts/_messages.html.erb +0 -5
  67. data/spec/dummyapp/app/views/layouts/_navigation.html.erb +0 -21
  68. data/spec/dummyapp/app/views/layouts/application.html.erb +0 -25
  69. data/spec/dummyapp/app/views/layouts/simple.html.erb +0 -18
  70. data/spec/dummyapp/app/views/users/index.html.erb +0 -8
  71. data/spec/dummyapp/app/views/users/show.html.erb +0 -3
  72. data/spec/dummyapp/config.ru +0 -4
  73. data/spec/dummyapp/config/application.rb +0 -59
  74. data/spec/dummyapp/config/boot.rb +0 -10
  75. data/spec/dummyapp/config/database.yml +0 -25
  76. data/spec/dummyapp/config/environment.rb +0 -5
  77. data/spec/dummyapp/config/environments/development.rb +0 -37
  78. data/spec/dummyapp/config/environments/production.rb +0 -67
  79. data/spec/dummyapp/config/environments/test.rb +0 -37
  80. data/spec/dummyapp/config/initializers/backtrace_silencers.rb +0 -7
  81. data/spec/dummyapp/config/initializers/inflections.rb +0 -15
  82. data/spec/dummyapp/config/initializers/mime_types.rb +0 -5
  83. data/spec/dummyapp/config/initializers/rollbar.rb +0 -26
  84. data/spec/dummyapp/config/initializers/secret_token.rb +0 -7
  85. data/spec/dummyapp/config/initializers/session_store.rb +0 -8
  86. data/spec/dummyapp/config/initializers/wrap_parameters.rb +0 -16
  87. data/spec/dummyapp/config/locales/devise.en.yml +0 -58
  88. data/spec/dummyapp/config/locales/en.yml +0 -5
  89. data/spec/dummyapp/config/routes.rb +0 -17
  90. data/spec/dummyapp/config/secrets.yml +0 -2
  91. data/spec/dummyapp/db/migrate/20121121184652_devise_create_users.rb +0 -46
  92. data/spec/dummyapp/db/migrate/20121121184654_add_name_to_users.rb +0 -5
  93. data/spec/dummyapp/db/migrate/20161219184410_create_books.rb +0 -10
  94. data/spec/dummyapp/db/migrate/20161219185529_add_username_to_users.rb +0 -5
  95. data/spec/dummyapp/db/schema.rb +0 -41
  96. data/spec/dummyapp/db/seeds.rb +0 -12
  97. data/spec/dummyapp/lib/assets/.gitkeep +0 -0
  98. data/spec/dummyapp/public/404.html +0 -26
  99. data/spec/dummyapp/public/422.html +0 -26
  100. data/spec/dummyapp/public/500.html +0 -25
  101. data/spec/dummyapp/public/favicon.ico +0 -0
  102. data/spec/dummyapp/script/rails +0 -6
  103. data/spec/fixtures/file1 +0 -1
  104. data/spec/fixtures/file2 +0 -1
  105. data/spec/fixtures/payloads/message.json +0 -25
  106. data/spec/fixtures/payloads/sample.trace.json +0 -275
  107. data/spec/fixtures/payloads/sample.trace_chain.json +0 -530
  108. data/spec/fixtures/plugins/dummy1.rb +0 -5
  109. data/spec/fixtures/plugins/dummy2.rb +0 -5
  110. data/spec/generators/rollbar/rollbar_generator_rails30_spec.rb +0 -31
  111. data/spec/generators/rollbar/rollbar_generator_spec.rb +0 -51
  112. data/spec/requests/home_spec.rb +0 -49
  113. data/spec/rollbar/configuration_spec.rb +0 -74
  114. data/spec/rollbar/delay/delayed_job_spec.rb +0 -22
  115. data/spec/rollbar/delay/girl_friday_spec.rb +0 -41
  116. data/spec/rollbar/delay/resque_spec.rb +0 -37
  117. data/spec/rollbar/delay/shoryuken_spec.rb +0 -44
  118. data/spec/rollbar/delay/thread_spec.rb +0 -27
  119. data/spec/rollbar/encoding/encoder_spec.rb +0 -63
  120. data/spec/rollbar/item/backtrace_spec.rb +0 -26
  121. data/spec/rollbar/item/frame_spec.rb +0 -267
  122. data/spec/rollbar/item_spec.rb +0 -736
  123. data/spec/rollbar/json/oj_spec.rb +0 -18
  124. data/spec/rollbar/json_spec.rb +0 -110
  125. data/spec/rollbar/lazy_store_spec.rb +0 -99
  126. data/spec/rollbar/logger_proxy_spec.rb +0 -69
  127. data/spec/rollbar/logger_spec.rb +0 -124
  128. data/spec/rollbar/middleware/js_spec.rb +0 -428
  129. data/spec/rollbar/middleware/sinatra_spec.rb +0 -197
  130. data/spec/rollbar/notifier_spec.rb +0 -67
  131. data/spec/rollbar/plugin_spec.rb +0 -209
  132. data/spec/rollbar/plugins/active_job_spec.rb +0 -45
  133. data/spec/rollbar/plugins/delayed_job/job_data_spec.rb +0 -48
  134. data/spec/rollbar/plugins/delayed_job_spec.rb +0 -129
  135. data/spec/rollbar/plugins/rack_spec.rb +0 -152
  136. data/spec/rollbar/plugins/rails_js_spec.rb +0 -19
  137. data/spec/rollbar/plugins/rake_spec.rb +0 -34
  138. data/spec/rollbar/plugins/resque/failure_spec.rb +0 -36
  139. data/spec/rollbar/plugins/sidekiq_spec.rb +0 -169
  140. data/spec/rollbar/plugins/validations_spec.rb +0 -56
  141. data/spec/rollbar/plugins_spec.rb +0 -68
  142. data/spec/rollbar/request_data_extractor_spec.rb +0 -321
  143. data/spec/rollbar/scrubbers/params_spec.rb +0 -598
  144. data/spec/rollbar/scrubbers/url_spec.rb +0 -240
  145. data/spec/rollbar/scrubbers_spec.rb +0 -31
  146. data/spec/rollbar/sidekig/clear_scope_spec.rb +0 -19
  147. data/spec/rollbar/truncation/frames_strategy_spec.rb +0 -70
  148. data/spec/rollbar/truncation/min_body_strategy_spec.rb +0 -57
  149. data/spec/rollbar/truncation/strings_strategy_spec.rb +0 -89
  150. data/spec/rollbar/truncation_spec.rb +0 -27
  151. data/spec/rollbar/util/hash_spec.rb +0 -22
  152. data/spec/rollbar/util/ip_anonymizer_spec.rb +0 -30
  153. data/spec/rollbar/util_spec.rb +0 -80
  154. data/spec/rollbar_bc_spec.rb +0 -380
  155. data/spec/rollbar_spec.rb +0 -1737
  156. data/spec/spec_helper.rb +0 -84
  157. data/spec/support/cause_exception.rb +0 -1
  158. data/spec/support/encoding_helpers.rb +0 -8
  159. data/spec/support/encodings/iso_8859_9 +0 -1
  160. data/spec/support/fixture_helpers.rb +0 -10
  161. data/spec/support/get_ip_raising.rb +0 -7
  162. data/spec/support/helpers.rb +0 -5
  163. data/spec/support/matchers.rb +0 -23
  164. data/spec/support/notifier_helpers.rb +0 -57
  165. data/spec/support/rollbar_api.rb +0 -57
  166. data/spec/support/secure_headers_mocks.rb +0 -83
  167. data/spec/support/shared_contexts.rb +0 -12
@@ -1,598 +0,0 @@
1
- require 'spec_helper'
2
- require 'tempfile'
3
- require 'rollbar/scrubbers/params'
4
-
5
- require 'rspec/expectations'
6
-
7
- describe Rollbar::Scrubbers::Params do
8
- describe '.call' do
9
- it 'calls #call in a new instance' do
10
- arguments = [:foo, :bar]
11
- expect_any_instance_of(described_class).to receive(:call).with(*arguments)
12
-
13
- described_class.call(*arguments)
14
- end
15
- end
16
-
17
- describe '#call' do
18
- let(:options) do
19
- options = {
20
- :params => params,
21
- :config => scrub_config
22
- }
23
-
24
- if defined? whitelist
25
- options[:whitelist] = whitelist
26
- end
27
-
28
- options
29
- end
30
-
31
- context 'with scrub fields configured' do
32
- let(:scrub_config) do
33
- [:secret, :password]
34
- end
35
-
36
- context 'with Array object' do
37
- let(:params) do
38
- [
39
- {
40
- :foo => 'bar',
41
- :secret => 'the-secret',
42
- :password => 'the-password',
43
- :password_confirmation => 'the-password'
44
- }
45
- ]
46
- end
47
- let(:result) do
48
- [
49
- {
50
- :foo => 'bar',
51
- :secret => /\*+/,
52
- :password => /\*+/,
53
- :password_confirmation => /\*+/
54
- }
55
- ]
56
- end
57
-
58
- it 'scrubs the required parameters' do
59
- expect(subject.call(options).first).to be_eql_hash_with_regexes(result.first)
60
- end
61
- end
62
-
63
- context 'with simple Hash' do
64
- let(:params) do
65
- {
66
- :foo => 'bar',
67
- :secret => 'the-secret',
68
- :password => 'the-password',
69
- :password_confirmation => 'the-password'
70
- }
71
- end
72
- let(:result) do
73
- {
74
- :foo => 'bar',
75
- :secret => /\*+/,
76
- :password => /\*+/,
77
- :password_confirmation => /\*+/
78
- }
79
- end
80
-
81
- it 'scrubs the required parameters' do
82
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
83
- end
84
- end
85
-
86
- context 'with nested Hash' do
87
- let(:scrub_config) do
88
- super().push(:other)
89
- end
90
-
91
- let(:params) do
92
- {
93
- :foo => 'bar',
94
- :extra => {
95
- :secret => 'the-secret',
96
- :password => 'the-password',
97
- :password_confirmation => 'the-password'
98
- },
99
- :other => {
100
- :param => 'filtered'
101
- }
102
- }
103
- end
104
- let(:result) do
105
- {
106
- :foo => 'bar',
107
- :extra => {
108
- :secret => /\*+/,
109
- :password => /\*+/,
110
- :password_confirmation => /\*+/
111
- },
112
- :other => /\*+/
113
- }
114
- end
115
-
116
- it 'scrubs the required parameters' do
117
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
118
- end
119
- end
120
-
121
- context 'with nested Array' do
122
- let(:scrub_config) do
123
- super().push(:other)
124
- end
125
-
126
- let(:params) do
127
- {
128
- :foo => 'bar',
129
- :extra => [{
130
- :secret => 'the-secret',
131
- :password => 'the-password',
132
- :password_confirmation => 'the-password'
133
- }],
134
- :other => [{
135
- :param => 'filtered'
136
- }]
137
- }
138
- end
139
- let(:result) do
140
- {
141
- :foo => 'bar',
142
- :extra => [{
143
- :secret => /\*+/,
144
- :password => /\*+/,
145
- :password_confirmation => /\*+/
146
- }],
147
- :other => /\*+/
148
- }
149
- end
150
-
151
- it 'scrubs the required parameters' do
152
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
153
- end
154
- end
155
-
156
- context 'with skipped instance' do
157
- let(:tempfile) { Tempfile.new('foo') }
158
- let(:params) do
159
- {
160
- :foo => 'bar',
161
- :extra => [{
162
- :secret => 'the-secret',
163
- :password => 'the-password',
164
- :password_confirmation => 'the-password',
165
- :skipped => tempfile
166
- }]
167
- }
168
- end
169
- let(:result) do
170
- {
171
- :foo => 'bar',
172
- :extra => [{
173
- :secret => /\*+/,
174
- :password => /\*+/,
175
- :password_confirmation => /\*+/,
176
- :skipped => "Skipped value of class 'Tempfile'"
177
- }]
178
- }
179
- end
180
-
181
- after { tempfile.close }
182
-
183
- it 'scrubs the required parameters' do
184
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
185
- end
186
- end
187
-
188
- context 'with attachment instance' do
189
- let(:tempfile) { double(:size => 100) }
190
- let(:attachment) do
191
- double(:class => double(:name => 'ActionDispatch::Http::UploadedFile'),
192
- :tempfile => tempfile,
193
- :content_type => 'content-type',
194
- 'original_filename' => 'filename')
195
- end
196
- let(:params) do
197
- {
198
- :foo => 'bar',
199
- :extra => [{
200
- :secret => 'the-secret',
201
- :password => 'the-password',
202
- :password_confirmation => 'the-password',
203
- :attachment => attachment
204
- }]
205
- }
206
- end
207
- let(:result) do
208
- {
209
- :foo => 'bar',
210
- :extra => [{
211
- :secret => /\*+/,
212
- :password => /\*+/,
213
- :password_confirmation => /\*+/,
214
- :attachment => {
215
- :content_type => 'content-type',
216
- :original_filename => 'filename',
217
- :size => 100
218
- }
219
- }]
220
- }
221
- end
222
-
223
- it 'scrubs the required parameters' do
224
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
225
- end
226
-
227
- context 'if getting the attachment values fails' do
228
- let(:tempfile) { Object.new }
229
- let(:attachment) do
230
- double(:class => double(:name => 'ActionDispatch::Http::UploadedFile'),
231
- :tempfile => tempfile,
232
- :content_type => 'content-type',
233
- 'original_filename' => 'filename')
234
- end
235
- let(:params) do
236
- {
237
- :foo => 'bar',
238
- :extra => [{
239
- :secret => 'the-secret',
240
- :password => 'the-password',
241
- :password_confirmation => 'the-password',
242
- :attachment => attachment
243
- }]
244
- }
245
- end
246
- let(:result) do
247
- {
248
- :foo => 'bar',
249
- :extra => [{
250
- :secret => /\*+/,
251
- :password => /\*+/,
252
- :password_confirmation => /\*+/,
253
- :attachment => 'Uploaded file'
254
- }]
255
- }
256
- end
257
-
258
- it 'scrubs the required parameters' do
259
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
260
- end
261
- end
262
- end
263
-
264
- context 'without params' do
265
- let(:params) do
266
- nil
267
- end
268
- let(:result) do
269
- {}
270
- end
271
-
272
- it 'scrubs the required parameters' do
273
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
274
- end
275
- end
276
- end
277
-
278
- context 'with :scrub_all option' do
279
- let(:scrub_config) { :scrub_all }
280
-
281
- context 'with simple hash' do
282
- let(:params) do
283
- {
284
- :foo => 'bar',
285
- :password => 'the-password',
286
- :bar => 'foo',
287
- :extra => {
288
- :foo => 'more-foo',
289
- :bar => 'more-bar'
290
- }
291
- }
292
- end
293
- let(:result) do
294
- {
295
- :foo => /\*+/,
296
- :password => /\*+/,
297
- :bar => /\*+/,
298
- :extra => {
299
- :foo => /\*+/,
300
- :bar => /\*+/
301
- }
302
- }
303
- end
304
-
305
- it 'scrubs the required parameters' do
306
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
307
- end
308
- end
309
-
310
- context 'with nested arrays' do
311
- let(:params) do
312
- {
313
- :foo => 'bar',
314
- :password => 'the-password',
315
- :bar => 'foo',
316
- :extra => [
317
- 'hello world',
318
- {
319
- :foo => 'more-foo',
320
- :bar => 'more-bar'
321
- }
322
- ]
323
- }
324
- end
325
- let(:result) do
326
- {
327
- :foo => /\*+/,
328
- :password => /\*+/,
329
- :bar => /\*+/,
330
- :extra => /\*+/,
331
- }
332
- end
333
-
334
- it 'scrubs the required parameters' do
335
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
336
- end
337
- end
338
-
339
- context 'and with :whitelist option' do
340
- let (:whitelist) { [:foo, :buzz] }
341
-
342
- context 'with simple hash' do
343
- let(:params) do
344
- {
345
- :foo => 'bar',
346
- :password => 'the-password',
347
- :bar => 'foo',
348
- :extra => {
349
- :foo => 'more-foo',
350
- :bar => 'more-bar'
351
- }
352
- }
353
- end
354
- let(:result) do
355
- {
356
- :foo => 'bar',
357
- :password => /\*+/,
358
- :bar => /\*+/,
359
- :extra => {
360
- :foo => 'more-foo',
361
- :bar => /\*+/
362
- }
363
- }
364
- end
365
-
366
- it 'scrubs the required parameters' do
367
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
368
- end
369
- end
370
-
371
- context 'with nested arrays' do
372
- let(:params) do
373
- {
374
- :foo => 'bar',
375
- :password => 'the-password',
376
- :bar => 'foo',
377
- :extra => [
378
- 'hello world',
379
- {
380
- :foo => 'more-foo',
381
- :bar => 'more-bar'
382
- }
383
- ],
384
- :buzz => [
385
- 'fizzbuzz',
386
- {
387
- :a => 42,
388
- :foo => 'another-foo',
389
- :b => 'this should be scrubbed'
390
- }
391
- ]
392
- }
393
- end
394
- let(:result) do
395
- {
396
- :foo => 'bar',
397
- :password => /\*+/,
398
- :bar => /\*+/,
399
- :extra => /\*+/,
400
- :buzz => [
401
- 'fizzbuzz',
402
- {
403
- :a => /\*+/,
404
- :foo => 'another-foo',
405
- :b => /\*+/
406
- }
407
- ]
408
- }
409
- end
410
-
411
- it 'scrubs the required parameters' do
412
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
413
- end
414
- end
415
- end
416
- end
417
-
418
- context 'with :whitelist option' do
419
- let(:scrub_config) do
420
- [:secret, :password]
421
- end
422
-
423
- let(:whitelist) { [:password] }
424
-
425
- context 'with Array object' do
426
- let(:params) do
427
- [
428
- {
429
- :foo => 'bar',
430
- :secret => 'the-secret',
431
- :password => 'the-password',
432
- :password_confirmation => 'the-password'
433
- }
434
- ]
435
- end
436
- let(:result) do
437
- [
438
- {
439
- :foo => 'bar',
440
- :secret => /\*+/,
441
- :password => 'the-password',
442
- :password_confirmation => /\*+/
443
- }
444
- ]
445
- end
446
-
447
- it 'scrubs the required parameters' do
448
- expect(subject.call(options).first).to be_eql_hash_with_regexes(result.first)
449
- end
450
- end
451
-
452
- context 'with simple Hash' do
453
- let(:params) do
454
- {
455
- :foo => 'bar',
456
- :secret => 'the-secret',
457
- :password => 'the-password',
458
- :password_confirmation => 'the-password'
459
- }
460
- end
461
- let(:result) do
462
- {
463
- :foo => 'bar',
464
- :secret => /\*+/,
465
- :password => 'the-password',
466
- :password_confirmation => /\*+/
467
- }
468
- end
469
-
470
- it 'scrubs the required parameters' do
471
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
472
- end
473
- end
474
-
475
- context 'with nested Hash' do
476
- let(:scrub_config) do
477
- super().push(:param)
478
- end
479
-
480
- let(:params) do
481
- {
482
- :foo => 'bar',
483
- :extra => {
484
- :secret => 'the-secret',
485
- :password => 'the-password',
486
- :password_confirmation => 'the-password'
487
- },
488
- :other => {
489
- :param => 'filtered',
490
- :to_scrub => 'to_scrub'
491
- }
492
- }
493
- end
494
- let(:result) do
495
- {
496
- :foo => 'bar',
497
- :extra => {
498
- :secret => /\*+/,
499
- :password => 'the-password',
500
- :password_confirmation => /\*+/
501
- },
502
- :other => {
503
- :param => /\*+/,
504
- :to_scrub => 'to_scrub'
505
- }
506
- }
507
- end
508
-
509
- it 'scrubs the required parameters' do
510
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
511
- end
512
- end
513
-
514
- context 'with nested Array' do
515
- let(:scrub_config) do
516
- super().push(:param)
517
- end
518
-
519
- let(:params) do
520
- {
521
- :foo => 'bar',
522
- :extra => [{
523
- :secret => 'the-secret',
524
- :password => 'the-password',
525
- :password_confirmation => 'the-password'
526
- }],
527
- :other => [{
528
- :param => 'filtered',
529
- :to_scrub => 'to_scrub'
530
- }]
531
- }
532
- end
533
- let(:result) do
534
- {
535
- :foo => 'bar',
536
- :extra => [{
537
- :secret => /\*+/,
538
- :password => 'the-password',
539
- :password_confirmation => /\*+/
540
- }],
541
- :other => [{
542
- :param => /\*+/,
543
- :to_scrub => 'to_scrub'
544
- }]
545
- }
546
- end
547
-
548
- it 'scrubs the required parameters' do
549
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
550
- end
551
- end
552
-
553
- context 'with skipped instance' do
554
- let(:tempfile) { Tempfile.new('foo') }
555
- let(:params) do
556
- {
557
- :foo => 'bar',
558
- :extra => [{
559
- :secret => 'the-secret',
560
- :password => 'the-password',
561
- :password_confirmation => 'the-password',
562
- :skipped => tempfile
563
- }]
564
- }
565
- end
566
- let(:result) do
567
- {
568
- :foo => 'bar',
569
- :extra => [{
570
- :secret => /\*+/,
571
- :password => 'the-password',
572
- :password_confirmation => /\*+/,
573
- :skipped => "Skipped value of class 'Tempfile'"
574
- }]
575
- }
576
- end
577
-
578
- after { tempfile.close }
579
-
580
- it 'scrubs the required parameters' do
581
- expect(subject.call(options)).to be_eql_hash_with_regexes(result)
582
- end
583
- end
584
- end
585
- end
586
- end
587
-
588
- describe Rollbar::Scrubbers::Params::ATTACHMENT_CLASSES do
589
- it 'has the correct values' do
590
- expect(described_class).to be_eql(%w(ActionDispatch::Http::UploadedFile Rack::Multipart::UploadedFile).freeze)
591
- end
592
- end
593
-
594
- describe Rollbar::Scrubbers::Params::SKIPPED_CLASSES do
595
- it 'has the correct values' do
596
- expect(described_class).to be_eql([Tempfile])
597
- end
598
- end