Sha256: f6859fa4fb478dbc15db775cc5839d530ee6e53a2b9cc07a8d84e053c3b7a5e4

Contents?: true

Size: 875 Bytes

Versions: 8

Compression:

Stored size: 875 Bytes

Contents

require File::expand_path('../../../spec_helper', __FILE__)
require 'time'
require 'delayed_job'
require 'opbeat/integrations/delayed_job'

# turtles, all the way down
# trying too hard
require 'active_support/core_ext/time/calculations.rb'
load File.join(
  Gem::Specification.find_by_name("delayed_job").gem_dir,
  "spec", "delayed", "backend", "test.rb"
)


class Bomb
  def blow_up ex
    raise ex
  end
end


Delayed::Worker.backend = Delayed::Backend::Test::Job

describe Delayed::Plugins::Opbeat do
  it 'should call Opbeat::capture_exception on erronous jobs' do
    test_exception = Exception.new("Test exception")
    expect(Opbeat).to receive(:capture_exception).with(test_exception)

    # Queue
    bomb = Bomb.new
    bomb.delay.blow_up test_exception

    expect {
      Delayed::Worker.new.work_off.should == [0, 1]
    }.to raise_error(Exception)
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
kuende-opbeat-2.0.4 spec/opbeat/integrations/delayed_job_spec.rb
kuende-opbeat-2.0.3 spec/opbeat/integrations/delayed_job_spec.rb
kuende-opbeat-2.0.2 spec/opbeat/integrations/delayed_job_spec.rb
kuende-opbeat-2.0.1 spec/opbeat/integrations/delayed_job_spec.rb
opbeat-2.0.0 spec/opbeat/integrations/delayed_job_spec.rb
opbeat-1.1.1 spec/opbeat/integrations/delayed_job_spec.rb
opbeat-1.1.0 spec/opbeat/integrations/delayed_job_spec.rb
opbeat-1.0.0 spec/opbeat/integrations/delayed_job_spec.rb