Sha256: 470cf6d6bbe16c23d7b30da8c44f5ba90f332b035814f312ea2e1750bfb6dc46
Contents?: true
Size: 922 Bytes
Versions: 3
Compression:
Stored size: 922 Bytes
Contents
require 'spec_helper' describe Rabbithole::Worker do before :each do subject.listen_to_queue(Rabbithole::Connection::DEFAULT_QUEUE) end after :each do subject.stop_listening end it 'invokes the perform action' do class InvokeTestJob def self.perform; end end InvokeTestJob.should_receive(:perform) Rabbithole.enqueue(InvokeTestJob) sleep 0.5 end it 'passes the correct arguments to the perform action' do class ArgumentsTestJob def self.perform(arg1, arg2); end end ArgumentsTestJob.should_receive(:perform).with(1, 'a').once Rabbithole.enqueue(ArgumentsTestJob, 1, 'a') sleep 1 end it 'gracefully handles failing jobs' do class HandlingFailsJob def self.perform raise 'hell' end end Rabbithole::ErrorHandler.should_receive(:handle).twice Rabbithole.enqueue(HandlingFailsJob) sleep 0.5 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rabbithole-0.0.3 | spec/lib/rabbithole/worker_spec.rb |
rabbithole-0.0.2 | spec/lib/rabbithole/worker_spec.rb |
rabbithole-0.0.1 | spec/lib/rabbithole/worker_spec.rb |