lib/resque_spec.rb in resque_spec-0.7.0 vs lib/resque_spec.rb in resque_spec-0.8.0

- old
+ new

@@ -26,10 +26,15 @@ until queue.empty? perform(queue_name, queue.shift) end end + def pop(queue_name) + return unless payload = queue_by_name(queue_name).shift + new_job(queue_name, payload) + end + def queue_by_name(name) queues[name.to_s] end def queue_for(klass) @@ -63,11 +68,15 @@ def name_from_queue_accessor(klass) klass.respond_to?(:queue) and klass.queue end + def new_job(queue_name, payload) + Resque::Job.new(queue_name, payload_with_string_keys(payload)) + end + def perform(queue_name, payload) - Resque::Job.new(queue_name, payload_with_string_keys(payload)).perform + new_job(queue_name, payload).perform end def perform_or_store(queue_name, payload) if inline perform(queue_name, payload)