Sha256: 1184cb1921f0d4b1e7718eb797421dbdb87667e1f5cb5a2527e1b3290862171f
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'ruby-debug' describe Controller::Base do it "should perform job" do Controller::Base.new(Adder.new(1,2)).perform.should eql(3) end it "should rescue all raised job actions" do [ReleaseJob, DeleteJob, BuryJob].each do |job| lambda{ Controller::Base.new(job.new).perform }.should_not raise_exception end end end describe Controller::Beanstalk do before(:all) do @q = Backend::Beanstalk.configure(:host => 'localhost:11300', :tube => 'quebert-test-jobs-actions') end before(:each) do @q.drain! end it "should delete job off queue after succesful run" do @q.put Adder.new(1, 2) @q.peek_ready.should_not be_nil @q.reserve.perform.should eql(3) @q.peek_ready.should be_nil end it "should bury job if an exception occurs in job" do @q.put Exceptional.new @q.peek_ready.should_not be_nil lambda{ @q.reserve.perform }.should raise_exception @q.peek_buried.should_not be_nil end context "job actions" do it "should delete job" do @q.put DeleteJob.new @q.peek_ready.should_not be_nil @q.reserve.perform @q.peek_ready.should be_nil end it "should release job" do @q.put ReleaseJob.new @q.peek_ready.should_not be_nil @q.reserve.perform @q.peek_ready.should_not be_nil end it "should bury job" do @q.put BuryJob.new @q.peek_ready.should_not be_nil @q.peek_buried.should be_nil @q.reserve.perform @q.peek_ready.should be_nil @q.peek_buried.should_not be_nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quebert-0.0.6 | spec/consumer_spec.rb |