Permalink
Browse files

* moving code from specs into main Job backend

  • Loading branch information...
1 parent 7ea606a commit 1a5c5d919921c715b6ca7d712a6c3b7185a8f3f7 @lpetre lpetre committed with bkeepers Mar 25, 2010
Showing with 13 additions and 19 deletions.
  1. +13 −2 lib/delayed/backend/data_mapper.rb
  2. +0 −17 spec/datamapper_job_spec.rb
@@ -40,7 +40,7 @@ class Job
def self.db_time_now
Time.now.utc
end
-
+
def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)
# not yet running
running = all(:run_at.lte => db_time_now)
@@ -85,7 +85,18 @@ def lock_exclusively!(max_run_time, worker = worker_name)
else
return false
end
- end
+ end
+
+ # FIMXE - shouldn't the spec call load_for_delayed_job?
+ def self.find id
+ get id
+ end
+
+ # I guess Mongo and AR both have this function
+ def update_attributes(attributes)
+ self.update attributes
+ self.save
+ end
end
class JobObserver
@@ -5,23 +5,6 @@
DataMapper.logger = ActiveRecord::Base.logger
DataMapper.setup(:default, "sqlite3::memory:")
-module Delayed
- module Backend
- module DataMapper
- class Job
- def self.find id
- get id
- end
-
- def update_attributes(attributes)
- self.update attributes
- self.save
- end
- end
- end
- end
-end
-
describe Delayed::Backend::DataMapper::Job do
before(:all) do
@backend = Delayed::Backend::DataMapper::Job

0 comments on commit 1a5c5d9

Please sign in to comment.