lib/resque_spec.rb in resque_spec-0.6.8 vs lib/resque_spec.rb in resque_spec-0.7.0
- old
+ new
@@ -12,11 +12,11 @@
job[:class] == klass.to_s && args.empty? || job[:args] == args
end
end
def enqueue(queue_name, klass, *args)
- store(queue_name, :class => klass.to_s, :args => args)
+ perform_or_store(queue_name, :class => klass.to_s, :args => args)
end
def perform_next(queue_name)
perform(queue_name, queue_by_name(queue_name).shift)
end
@@ -27,11 +27,11 @@
perform(queue_name, queue.shift)
end
end
def queue_by_name(name)
- queues[name]
+ queues[name.to_s]
end
def queue_for(klass)
queue_by_name(queue_name(klass))
end
@@ -67,15 +67,19 @@
def perform(queue_name, payload)
Resque::Job.new(queue_name, payload_with_string_keys(payload)).perform
end
- def store(queue_name, payload)
+ def perform_or_store(queue_name, payload)
if inline
perform(queue_name, payload)
else
- queue_by_name(queue_name) << payload
+ store(queue_name, payload)
end
+ end
+
+ def store(queue_name, payload)
+ queue_by_name(queue_name) << payload
end
def payload_with_string_keys(payload)
{
'class' => payload[:class],