Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Dump backend for immediate processing

  • Loading branch information...
commit a83987928a940b642bf5d26b3b675c5b04ec5d8d 1 parent d34907d
@sumskyi sumskyi authored
View
4 lib/qu-immediate.rb
@@ -0,0 +1,4 @@
+require 'qu'
+require 'qu/backend/immediate'
+
+Qu.backend = Qu::Backend::Immediate.new
View
13 lib/qu/backend/immediate.rb
@@ -0,0 +1,13 @@
+module Qu
+ module Backend
+ class Immediate < Base
+ def enqueue(payload)
+ payload.perform
+ end
+
+ def completed(payload); end
+ def release(payload); end
+ def failed(payload, error); end
+ end
+ end
+end
View
16 qu-immediate.gemspec
@@ -0,0 +1,16 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "qu/version"
+
+Gem::Specification.new do |s|
+ s.name = "qu-immediate"
+ s.version = Qu::VERSION
+ s.authors = ["Brandon Keepers"]
+ s.email = ["brandon@opensoul.org"]
+ s.homepage = "http://github.com/bkeepers/qu"
+ s.summary = 'Immediate "backend" for qu'
+ s.description = 'Immediate "backend" for qu'
+
+ s.files = `git ls-files -- lib | grep immediate`.split("\n")
+ s.require_paths = ["lib"]
+end
View
15 spec/qu/backend/immediate_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+require 'qu-immediate'
+
+describe Qu::Backend::Immediate do
+ let(:payload) { Qu::Payload.new(:klass => SimpleJob) }
+
+ before(:all) do
+ Qu.backend = described_class.new
+ end
+
+ it 'performs immediately' do
+ payload.should_receive(:perform)
+ subject.enqueue(payload)
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.