Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.

Commit

Permalink
Qu doesn't support scheduling, so an exception is raised instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnando committed Dec 5, 2012
1 parent b203a90 commit e7fbe08
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/qe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,8 @@ module Qe
class << self
attr_accessor :adapter
end

# Error that is raised when trying to use a feature
# that isn't supported by some adapter.
UnsupportedFeatureError = Class.new(StandardError)
end
6 changes: 4 additions & 2 deletions lib/qe/qu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
module Qe
class Qu
class Worker
include ::Sidekiq::Worker

def self.perform(*args)
Qe::Worker.perform(*args)
end
Expand All @@ -15,6 +13,10 @@ def self.enqueue(worker, options = {})
Worker.instance_variable_set("@queue", worker.queue)
::Qu.enqueue Worker, worker.name, options
end

def self.schedule(*)
raise UnsupportedFeatureError, "scheduling isn't supported on Qu"
end
end

self.adapter = Qu
Expand Down
8 changes: 8 additions & 0 deletions spec/qe/qu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@
Qe::Qu.enqueue(worker, :a => 1)
end
end

context "scheduling" do
it "raises exception" do
expect {
Qe::Qu.schedule(stub, Time.now, :a => 1)
}.to raise_error(Qe::UnsupportedFeatureError)
end
end
end

0 comments on commit e7fbe08

Please sign in to comment.