Sha256: 889c484944556163cd1e67b72c6d42d6e1ce1dc2497873c859000600487614f5

Contents?: true

Size: 940 Bytes

Versions: 9

Compression:

Stored size: 940 Bytes

Contents

require 'spec_helper'
require 'delayed_job'
require 'rollbar/delayed_job'

describe Rollbar::Delayed, :reconfigure_notifier => true do
  class FailingJob
    class TestException < Exception; end

    def perform
      fail(TestException, 'failing')
    end
  end

  module DummyBackend
    class Job
      include Delayed::Backend::Base

      attr_accessor :handler, :attempts

      def initialize(options = {})
        @payload_object = options[:payload_object]
        @attempts = 0
      end
    end
  end

  let(:logger) { Rollbar.logger }

  before do
    Rollbar::Delayed.wrap_worker
    Delayed::Worker.delay_jobs = false
    Delayed::Worker.backend = DummyBackend::Job
  end

  it 'sends the exception' do
    expect_any_instance_of(Rollbar::Notifier).to receive(:error).with(kind_of(FailingJob::TestException))

    expect do
      Delayed::Job.enqueue(FailingJob.new)
    end.to raise_error(FailingJob::TestException)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rollbar-1.3.2 spec/rollbar/delayed_job_spec.rb
rollbar-1.3.1 spec/rollbar/delayed_job_spec.rb
rollbar-1.3.0 spec/rollbar/delayed_job_spec.rb
rollbar-1.2.13 spec/rollbar/delayed_job_spec.rb
rollbar-1.2.12 spec/rollbar/delayed_job_spec.rb
rollbar-1.2.11 spec/rollbar/delayed_job_spec.rb
rollbar-1.2.10 spec/rollbar/delayed_job_spec.rb
rollbar-1.2.9 spec/rollbar/delayed_job_spec.rb
rollbar-1.2.8 spec/rollbar/delayed_job_spec.rb