resque-rollbar 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9867e45d627b476ba6a4244486ec5bc98a795592
4
- data.tar.gz: c1bb95961a1c03b393e7147de1e52f9a170981cb
3
+ metadata.gz: d42e55fb54188844e7c6278bcd7728f1dbb30ab5
4
+ data.tar.gz: cd09e85b423ea665987019f71b2cbb7b490681f4
5
5
  SHA512:
6
- metadata.gz: 2ac607df979f3441193b3c468d28fc4b128097b7702682f46ebc6e2ffff6c4727e8e4cdf8fa52cc8cbb90775fbd48dfe8c929afc8a6b80a6043c7905f95f656c
7
- data.tar.gz: becf1781bc0d1c8f3aa8e95cd58fd1e91bf8d926a8d3354519fa647ff7cf522f403711d17e7f66dbdad8a3a19665bec69eb114634581b393cf66a1b10ccac4e0
6
+ metadata.gz: ad1c6b0b53114fbc7f1da98fd46f5302eb41f2dad4869feb518b8181d93e9cd61862fd66498670eeb772c4119992fd636410595a493e5a9d011c06e5a815435d
7
+ data.tar.gz: 600b9f04a759d0ff42bba7f746eba7be62d874eb67587cdcdd52becb4d54d3687ec586d3ab0aca2e5a3c6b22be4327e8c2619e2bf19cdf56bea922ecb4309608
@@ -5,7 +5,23 @@ module Resque
5
5
  module Failure
6
6
  class Rollbar < Base
7
7
  def save
8
- ::Rollbar.error(exception, payload)
8
+ ::Rollbar.error(exception, rollbar_payload)
9
+ end
10
+
11
+ def rollbar_payload
12
+ if use_exception_level_filters?
13
+ payload.merge(:use_exception_level_filters => true)
14
+ else
15
+ payload
16
+ end
17
+ end
18
+
19
+ def use_exception_level_filters?
20
+ rollbar_version.split('.')[1].to_i > 3
21
+ end
22
+
23
+ def rollbar_version
24
+ ::Rollbar::VERSION
9
25
  end
10
26
  end
11
27
  end
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module Rollbar
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -1,14 +1,29 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Resque::Failure::Rollbar do
4
- it 'should be notified of an error' do
5
- exception = StandardError.new('BOOM')
6
- worker = Resque::Worker.new(:test)
7
- queue = 'test'
8
- payload = { 'class' => Object, 'args' => 89 }
4
+ let(:exception) { StandardError.new('BOOM') }
5
+ let(:worker) { Resque::Worker.new(:test) }
6
+ let(:queue) { 'test' }
7
+ let(:payload) { { 'class' => Object, 'args' => 89 } }
8
+ let(:backend) do
9
+ Resque::Failure::Rollbar.new(exception, worker, queue, payload)
10
+ end
9
11
 
12
+ it 'should be notified of an error' do
10
13
  expect(Rollbar.notifier).to receive(:log).with('error', exception, payload)
11
- backend = Resque::Failure::Rollbar.new(exception, worker, queue, payload)
12
14
  backend.save
13
15
  end
16
+
17
+ context 'with Rollbar version > 1.3' do
18
+ let(:rollbar_payload) { payload.merge(:use_exception_level_filters => true) }
19
+
20
+ before do
21
+ allow(backend).to receive(:rollbar_version).and_return('1.4.0')
22
+ end
23
+
24
+ it 'sends the :use_exception_level_filters option' do
25
+ expect(Rollbar.notifier).to receive(:error).with(exception, rollbar_payload)
26
+ backend.save
27
+ end
28
+ end
14
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-16 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque