Permalink
Browse files

Merge remote branch 'collectiveidea/master' into delayed_job_daemon

  • Loading branch information...
2 parents 4c3e1c9 + 77b0482 commit ec9423d09e57f5975ade51724498995f0e469691 guns committed Sep 6, 2010
Showing with 23 additions and 5 deletions.
  1. +1 −1 README.textile
  2. +2 −2 delayed_job.gemspec
  3. +1 −1 lib/delayed/worker.rb
  4. +19 −1 spec/worker_spec.rb
View
@@ -40,7 +40,7 @@ After delayed_job is installed, you will need to setup the backend.
h2. Backends
-delayed_job supports multiple backends for storing the job queue. There are currently implementations for Active Record, MongoMapper, and DataMapper.
+delayed_job supports multiple backends for storing the job queue. "See the wiki for other backends":http://wiki.github.com/collectiveidea/delayed_job/backends besides Active Record.
h3. Active Record
View
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = 'delayed_job'
- s.version = '2.1.0.pre'
+ s.version = '2.1.0.pre2'
s.authors = ["Brandon Keepers", "Tobias L\303\274tke"]
s.summary = 'Database-backed asynchronous priority queue system -- Extracted from Shopify'
s.description = "Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.
@@ -18,7 +18,7 @@ This gem is collectiveidea's fork (http://github.com/collectiveidea/delayed_job)
s.test_files = Dir.glob('spec/**/*')
s.add_runtime_dependency 'daemons'
- s.add_runtime_dependency 'activesupport' '~>3'
+ s.add_runtime_dependency 'activesupport', '~>3.0'
s.add_development_dependency 'rspec'
s.add_development_dependency 'sqlite3-ruby'
s.add_development_dependency 'activerecord'
@@ -38,7 +38,7 @@ def self.backend=(backend)
end
def self.guess_backend
- self.backend = :active_record if defined?(ActiveRecord)
+ self.backend ||= :active_record if defined?(ActiveRecord)
end
def initialize(options={})
View
@@ -10,10 +10,28 @@
it "should set the Delayed::Job constant to the backend" do
Delayed::Job.should == @clazz
end
-
+
it "should set backend with a symbol" do
Delayed::Worker.backend = :active_record
Delayed::Worker.backend.should == Delayed::Backend::ActiveRecord::Job
end
end
+
+ describe "guess_backend" do
+ after do
+ Delayed::Worker.backend = :active_record
+ end
+
+ it "should set to active_record if nil" do
+ Delayed::Worker.backend = nil
+ lambda {
+ Delayed::Worker.guess_backend
+ }.should change { Delayed::Worker.backend }.to(Delayed::Backend::ActiveRecord::Job)
+ end
+
+ it "should not override the existing backend" do
+ Delayed::Worker.backend = Class.new
+ lambda { Delayed::Worker.guess_backend }.should_not change { Delayed::Worker.backend }
+ end
+ end
end

0 comments on commit ec9423d

Please sign in to comment.