Sha256: 00bb5b9bef4b02f48d5dc5a5597dd0000b7cea5f16113a97ccd342602fcb30bb

Contents?: true

Size: 882 Bytes

Versions: 7

Compression:

Stored size: 882 Bytes

Contents

require 'spec_helper'

describe Worker do
  before(:each) do
    @q = Backend::InProcess.new
    @w = Worker.new do |w|
      w.backend = @q
    end
  end

  it "should start" do
    @w.start
  end

  context "pluggable exception handler" do
    it "should raise exception if nothing is provided" do
      @q.put Exceptional.new
      lambda{ @w.start }.should raise_exception
    end

    it "should default to Quebert.config.worker.exception_handler handler" do
      @q.put Exceptional.new
      Quebert.config.worker.exception_handler = Proc.new{|e, opts| e.should be_instance_of(Exception) }
      lambda{ @w.start }.should_not raise_exception
    end

    it "should intercept exceptions" do
      @q.put Exceptional.new
      @w.exception_handler = Proc.new{|e, opts| e.should be_instance_of(Exception) }
      lambda{ @w.start }.should_not raise_exception
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
quebert-2.0.4 spec/worker_spec.rb
quebert-2.0.3 spec/worker_spec.rb
quebert-2.0.2 spec/worker_spec.rb
quebert-2.0.1 spec/worker_spec.rb
quebert-2.0.0 spec/worker_spec.rb
quebert-1.12.0 spec/worker_spec.rb
quebert-1.11.0 spec/worker_spec.rb