rollbar 2.9.1 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rollbar/scrubbers'
4
+
5
+ describe Rollbar::Scrubbers do
6
+ describe '.scrub_value' do
7
+ context 'with random scrub length' do
8
+ before do
9
+ allow(Rollbar.configuration).to receive(:randomize_scrub_length).and_return(true)
10
+ end
11
+
12
+ let(:value) { 'herecomesaverylongvalue' }
13
+
14
+ it 'randomizes the scrubbed string' do
15
+ expect(described_class.scrub_value(value)).to match(/\*{3,8}/)
16
+ end
17
+ end
18
+
19
+ context 'with no-random scrub length' do
20
+ before do
21
+ allow(Rollbar.configuration).to receive(:randomize_scrub_length).and_return(false)
22
+ end
23
+
24
+ let(:value) { 'herecomesaverylongvalue' }
25
+
26
+ it 'randomizes the scrubbed string' do
27
+ expect(described_class.scrub_value(value)).to match(/\*{#{value.length}}/)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -10,13 +10,18 @@ describe Rollbar::Sidekiq, :reconfigure_notifier => false do
10
10
  let(:msg_or_context) { ['hello', 'error_backtrace', 'backtrace', 'goodbye'] }
11
11
  let(:exception) { StandardError.new('oh noes') }
12
12
  let(:rollbar) { double }
13
- let(:expected_args) { { :request => { :params => ['hello', 'goodbye'] } } }
13
+ let(:expected_args) do
14
+ {
15
+ :request => { :params => ['hello', 'goodbye'] },
16
+ :framework => "Sidekiq: #{Sidekiq::VERSION}"
17
+ }
18
+ end
14
19
 
15
20
  subject { described_class }
16
21
 
17
22
  it 'constructs scope from filtered params' do
18
23
  allow(rollbar).to receive(:error)
19
- expect(Rollbar).to receive(:scope).with(expected_args) {rollbar}
24
+ expect(Rollbar).to receive(:scope).with(expected_args) { rollbar }
20
25
 
21
26
  described_class.handle_exception(msg_or_context, exception)
22
27
  end
@@ -28,6 +33,22 @@ describe Rollbar::Sidekiq, :reconfigure_notifier => false do
28
33
  described_class.handle_exception(msg_or_context, exception)
29
34
  end
30
35
 
36
+ context 'when a sidekiq worker class is set' do
37
+ it 'adds the sidekiq#queue-name to the error report context' do
38
+ msg_or_context = {"retry" => true, "retry_count" => 1, 'queue' => 'default', 'class' => 'MyWorkerClass'}
39
+ expected_args = {
40
+ :request => { :params => msg_or_context },
41
+ :framework => "Sidekiq: #{Sidekiq::VERSION}",
42
+ :context => 'MyWorkerClass',
43
+ :queue => 'default'
44
+ }
45
+
46
+ allow(rollbar).to receive(:error)
47
+ allow(Rollbar).to receive(:scope).with(expected_args).and_return(rollbar)
48
+ described_class.handle_exception(msg_or_context, exception)
49
+ end
50
+ end
51
+
31
52
  context 'when set a sidekiq_threshold' do
32
53
  before do
33
54
  Rollbar.configuration.sidekiq_threshold = 2
data/spec/rollbar_spec.rb CHANGED
@@ -234,6 +234,7 @@ describe Rollbar do
234
234
  let(:configuration) do
235
235
  config = Rollbar::Configuration.new
236
236
  config.enabled = true
237
+ config.access_token = test_access_token
237
238
  config
238
239
  end
239
240
  let(:message) { 'message' }
@@ -1756,9 +1757,10 @@ describe Rollbar do
1756
1757
  config.project_gems = gems
1757
1758
  end
1758
1759
 
1759
- gems.each {|gem|
1760
- gem_paths.push(Gem::Specification.find_by_name(gem).gem_dir)
1761
- }
1760
+ gem_paths = gems.map do |gem|
1761
+ gem_spec = Gem::Specification.find_all_by_name(gem)[0]
1762
+ gem_spec.gem_dir if gem_spec
1763
+ end.compact
1762
1764
 
1763
1765
  data = notifier.send(:build_payload, 'info', 'test', nil, {})['data']
1764
1766
  data[:project_package_paths].kind_of?(Array).should == true
data/spec/spec_helper.rb CHANGED
@@ -44,6 +44,13 @@ RSpec.configure do |config|
44
44
 
45
45
  config.use_transactional_fixtures = true
46
46
  config.order = 'random'
47
+ config.expect_with(:rspec) do |c|
48
+ c.syntax = [:should, :expect]
49
+ end
50
+
51
+ config.mock_with :rspec do |mocks|
52
+ mocks.syntax = [:should, :expect]
53
+ end
47
54
 
48
55
  config.before(:suite) do
49
56
  DatabaseCleaner.strategy = :truncation
@@ -0,0 +1,23 @@
1
+ RSpec::Matchers.define :be_eql_hash_with_regexes do |expected|
2
+ def check_value(actual_value, expected_value)
3
+ if expected_value.is_a?(Hash)
4
+ expected_value.all? { |k, _| check_value(actual_value[k], expected_value[k]) }
5
+ elsif expected_value.is_a?(Array)
6
+ expected_value.each_with_index.map do |v, i|
7
+ check_value(actual_value[i], v)
8
+ end.all?
9
+ elsif expected_value.is_a?(Regexp)
10
+ actual_value.match(expected_value)
11
+ else
12
+ actual_value == expected_value
13
+ end
14
+ end
15
+
16
+ match do |actual|
17
+ expected.all? do |key, expected_value|
18
+ actual_value = actual[key]
19
+
20
+ check_value(actual_value, expected_value)
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rollbar, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-09 00:00:00.000000000 Z
11
+ date: 2016-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -55,6 +55,7 @@ files:
55
55
  - gemfiles/rails40.gemfile
56
56
  - gemfiles/rails41.gemfile
57
57
  - gemfiles/rails42.gemfile
58
+ - gemfiles/rails50.gemfile
58
59
  - lib/generators/rollbar/rollbar_generator.rb
59
60
  - lib/generators/rollbar/templates/initializer.rb
60
61
  - lib/rails/rollbar_runner.rb
@@ -66,6 +67,7 @@ files:
66
67
  - lib/rollbar/configuration.rb
67
68
  - lib/rollbar/core_ext/basic_socket.rb
68
69
  - lib/rollbar/core_ext/thread.rb
70
+ - lib/rollbar/delay/delayed_job.rb
69
71
  - lib/rollbar/delay/girl_friday.rb
70
72
  - lib/rollbar/delay/resque.rb
71
73
  - lib/rollbar/delay/sidekiq.rb
@@ -103,6 +105,7 @@ files:
103
105
  - lib/rollbar/rake_tasks.rb
104
106
  - lib/rollbar/request_data_extractor.rb
105
107
  - lib/rollbar/scrubbers.rb
108
+ - lib/rollbar/scrubbers/params.rb
106
109
  - lib/rollbar/scrubbers/url.rb
107
110
  - lib/rollbar/sidekiq.rb
108
111
  - lib/rollbar/tasks/rollbar.cap
@@ -166,6 +169,7 @@ files:
166
169
  - spec/dummyapp/config/locales/devise.en.yml
167
170
  - spec/dummyapp/config/locales/en.yml
168
171
  - spec/dummyapp/config/routes.rb
172
+ - spec/dummyapp/config/secrets.yml
169
173
  - spec/dummyapp/db/migrate/20121121184652_devise_create_users.rb
170
174
  - spec/dummyapp/db/migrate/20121121184654_add_name_to_users.rb
171
175
  - spec/dummyapp/db/schema.rb
@@ -186,6 +190,7 @@ files:
186
190
  - spec/requests/home_spec.rb
187
191
  - spec/rollbar/active_job_spec.rb
188
192
  - spec/rollbar/configuration_spec.rb
193
+ - spec/rollbar/delay/delayed_job_spec.rb
189
194
  - spec/rollbar/delay/girl_friday_spec.rb
190
195
  - spec/rollbar/delay/resque_spec.rb
191
196
  - spec/rollbar/delay/thread_spec.rb
@@ -203,7 +208,9 @@ files:
203
208
  - spec/rollbar/middleware/sinatra_spec.rb
204
209
  - spec/rollbar/rake_spec.rb
205
210
  - spec/rollbar/request_data_extractor_spec.rb
211
+ - spec/rollbar/scrubbers/params_spec.rb
206
212
  - spec/rollbar/scrubbers/url_spec.rb
213
+ - spec/rollbar/scrubbers_spec.rb
207
214
  - spec/rollbar/sidekig/clear_scope_spec.rb
208
215
  - spec/rollbar/sidekiq_spec.rb
209
216
  - spec/rollbar/truncation/frames_strategy_spec.rb
@@ -221,6 +228,7 @@ files:
221
228
  - spec/support/fixture_helpers.rb
222
229
  - spec/support/get_ip_raising.rb
223
230
  - spec/support/helpers.rb
231
+ - spec/support/matchers.rb
224
232
  - spec/support/notifier_helpers.rb
225
233
  - spec/support/shared_contexts.rb
226
234
  homepage: https://rollbar.com
@@ -296,6 +304,7 @@ test_files:
296
304
  - spec/dummyapp/config/locales/devise.en.yml
297
305
  - spec/dummyapp/config/locales/en.yml
298
306
  - spec/dummyapp/config/routes.rb
307
+ - spec/dummyapp/config/secrets.yml
299
308
  - spec/dummyapp/db/migrate/20121121184652_devise_create_users.rb
300
309
  - spec/dummyapp/db/migrate/20121121184654_add_name_to_users.rb
301
310
  - spec/dummyapp/db/schema.rb
@@ -316,6 +325,7 @@ test_files:
316
325
  - spec/requests/home_spec.rb
317
326
  - spec/rollbar/active_job_spec.rb
318
327
  - spec/rollbar/configuration_spec.rb
328
+ - spec/rollbar/delay/delayed_job_spec.rb
319
329
  - spec/rollbar/delay/girl_friday_spec.rb
320
330
  - spec/rollbar/delay/resque_spec.rb
321
331
  - spec/rollbar/delay/thread_spec.rb
@@ -333,7 +343,9 @@ test_files:
333
343
  - spec/rollbar/middleware/sinatra_spec.rb
334
344
  - spec/rollbar/rake_spec.rb
335
345
  - spec/rollbar/request_data_extractor_spec.rb
346
+ - spec/rollbar/scrubbers/params_spec.rb
336
347
  - spec/rollbar/scrubbers/url_spec.rb
348
+ - spec/rollbar/scrubbers_spec.rb
337
349
  - spec/rollbar/sidekig/clear_scope_spec.rb
338
350
  - spec/rollbar/sidekiq_spec.rb
339
351
  - spec/rollbar/truncation/frames_strategy_spec.rb
@@ -351,5 +363,6 @@ test_files:
351
363
  - spec/support/fixture_helpers.rb
352
364
  - spec/support/get_ip_raising.rb
353
365
  - spec/support/helpers.rb
366
+ - spec/support/matchers.rb
354
367
  - spec/support/notifier_helpers.rb
355
368
  - spec/support/shared_contexts.rb