Sha256: 62783d12b5560058c4b631bbf5beb7eab2367b9709900732d76d06968123c943

Contents?: true

Size: 1.08 KB

Versions: 20

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'
require 'rollbar/plugins/resque/failure'

describe Resque::Failure::Rollbar do
  let(:exception) { StandardError.new('BOOM') }
  let(:worker) { Resque::Worker.new(:test) }
  let(:queue) { 'test' }
  let(:payload) { { 'class' => Object, 'args' => 89 } }
  let(:backend) do
    Resque::Failure::Rollbar.new(exception, worker, queue, payload)
  end

  context 'with Rollbar version <= 1.3' do
    before do
      allow(backend).to receive(:rollbar_version).and_return('1.3.0')
    end

    it 'should be notified of an error' do
      expect_any_instance_of(Rollbar::Notifier).to receive(:log).with('error', exception, payload)
      backend.save
    end
  end

  context 'with Rollbar version > 1.3' do
    let(:payload_with_options) { payload.merge(:use_exception_level_filters => true) }

    before do
      allow(backend).to receive(:rollbar_version).and_return('1.4.0')
    end

    it 'sends the :use_exception_level_filters option' do
      expect_any_instance_of(Rollbar::Notifier).to receive(:error).with(exception, payload_with_options)
      backend.save
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rollbar-2.18.2 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.18.0 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.17.0 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.16.4 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.16.3 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.16.2 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.16.0 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.15.6 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.15.5 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.15.4 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.15.3 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.15.2 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.15.1 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.15.0 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.14.1 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.14.0 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.13.3 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.13.2 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.13.1 spec/rollbar/plugins/resque/failure_spec.rb
rollbar-2.13.0 spec/rollbar/plugins/resque/failure_spec.rb