Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
Merge branch 'development' into job_retry
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Kreeftmeijer committed Jan 29, 2010
2 parents 7bbc93f + 0a61f68 commit 516817b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/navvy/job/active_record.rb
Expand Up @@ -49,6 +49,7 @@ def self.enqueue(object, method_name, *args)
options = {}
if args.last.is_a?(Hash)
options = args.last.delete(:job_options) || {}
args.pop if args.last.empty?
end

create(
Expand Down
1 change: 1 addition & 0 deletions lib/navvy/job/data_mapper.rb
Expand Up @@ -66,6 +66,7 @@ def self.enqueue(object, method_name, *args)
options = {}
if args.last.is_a?(Hash)
options = args.last.delete(:job_options) || {}
args.pop if args.last.empty?
end

new_job = self.new
Expand Down
1 change: 1 addition & 0 deletions lib/navvy/job/mongo_mapper.rb
Expand Up @@ -65,6 +65,7 @@ def self.enqueue(object, method_name, *args)
options = {}
if args.last.is_a?(Hash)
options = args.last.delete(:job_options) || {}
args.pop if args.last.empty?
end

create(
Expand Down
1 change: 1 addition & 0 deletions lib/navvy/job/sequel.rb
Expand Up @@ -52,6 +52,7 @@ def self.enqueue(object, method_name, *args)
options = {}
if args.last.is_a?(Hash)
options = args.last.delete(:job_options) || {}
args.pop if args.last.empty?
end

create(
Expand Down
15 changes: 14 additions & 1 deletion spec/job_spec.rb
Expand Up @@ -71,7 +71,20 @@
Navvy::Job.enqueue(Cow, :speak)
first_job.priority.should == 0
end


it 'should set the options without messing up the arguments' do
job = Navvy::Job.enqueue(
Cow,
:speak,
true,
false,
:job_options => {
:run_at => Time.now
}
)
job.args.should == [true, false]
end

it 'should set the priority' do
Navvy::Job.enqueue(
Cow,
Expand Down

0 comments on commit 516817b

Please sign in to comment.