Sha256: 8ca123fb9f2108353c2d00b139e8599920d3bfb9ae5053c5ef6b51df2e54df94

Contents?: true

Size: 677 Bytes

Versions: 2

Compression:

Stored size: 677 Bytes

Contents

require 'spec_helper'

class LoggedDummy
  extend ResqueMods::LoggedJob 

  class << self 
    def perform(a, b, c)
    end 
  end 
end 

class DummyExcepion < RuntimeError
end 


describe ResqueMods::LoggedJob do 
  def do_job 
    Resque::Job.new(:jobs, {'class' => "LoggedDummy", 'args' => [1, 2, 3]}).perform
  end 
  it "should call the nested perform method" do 
    LoggedDummy.should_receive(:perform).with(1, 2, 3) 
    do_job
  end 
  context "when an error occurs" do 
    it "should not swallow the error" do 
      LoggedDummy.stub(:perform).and_raise(DummyExcepion.new)
      lambda {
        do_job
      }.should raise_error(DummyExcepion)
    end 
  end 
end 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resque-mods-1.0.1 spec/resque-mods/logged_job_spec.rb
resque-mods-1.0.0 spec/resque-mods/logged_job_spec.rb