lib/resque_spec/ext.rb in resque_spec-0.12.3 vs lib/resque_spec/ext.rb in resque_spec-0.12.4

- old
+ new

@@ -31,10 +31,11 @@ alias :enqueue_without_resque_spec :enqueue alias :enqueue_to_without_resque_spec :enqueue_to if Resque.respond_to? :enqueue_to alias :reserve_without_resque_spec :reserve alias :peek_without_resque_spec :peek + alias :size_without_resque_spec :size def enqueue(klass, *args) return enqueue_without_resque_spec(klass, *args) if ResqueSpec.disable_ext enqueue_to(queue_from_class(klass), klass, *args) @@ -64,9 +65,15 @@ def reserve(queue_name) return reserve_without_resque_spec(queue_name) if ResqueSpec.disable_ext ResqueSpec.pop(queue_name) + end + + def size(queue_name) + return size_without_resque_spec(queue_name) if ResqueSpec.disable_ext + + ResqueSpec.queue_by_name(queue_name).count end private def run_after_enqueue(klass, *args)