Skip to content

Commit

Permalink
Merge remote branch 'collectiveidea/master' into delayed_job_daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
guns committed Sep 6, 2010
2 parents 4c3e1c9 + 77b0482 commit ec9423d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.textile
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions delayed_job.gemspec
Expand Up @@ -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.
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion lib/delayed/worker.rb
Expand Up @@ -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={})
Expand Down
20 changes: 19 additions & 1 deletion spec/worker_spec.rb
Expand Up @@ -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.