Skip to content

Commit

Permalink
* moving code from specs into main Job backend
Browse files Browse the repository at this point in the history
  • Loading branch information
lpetre authored and bkeepers committed Mar 26, 2010
1 parent 7ea606a commit 1a5c5d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
15 changes: 13 additions & 2 deletions lib/delayed/backend/data_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
17 changes: 0 additions & 17 deletions spec/datamapper_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1a5c5d9

Please sign in to comment.