Sha256: 83eda48cf4fb4cf40892f8a83eeaebb51f4bcfd20525a58543591bcd8c6f750d

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/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
      lambda{ @w.start }.should raise_exception
    end
    
    it "should intercept exceptions" do
      @q.put Exceptional
      @w.exception_handler = Proc.new{|e| e.should be_instance_of(Exception) }
      lambda{ @w.start }.should_not raise_exception
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quebert-0.0.1 spec/worker_spec.rb
quebert-0.0.0 spec/worker_spec.rb