delayed_job_with_named_queues 2.0.7.3 → 2.0.7.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,8 @@ module Delayed
8
8
  def method_missing(method, *args)
9
9
  Job.create({
10
10
  :payload_object => PerformableMethod.new(@target, method.to_sym, args),
11
- :priority => ::Delayed::Worker.default_priority
11
+ :priority => ::Delayed::Worker.default_priority,
12
+ :queue => ::Delayed::Worker.default_queue
12
13
  }.merge(@options))
13
14
  end
14
15
  end
@@ -40,6 +40,28 @@ shared_examples_for 'a backend' do
40
40
  @job.priority.should == 99
41
41
  end
42
42
 
43
+ it "should not have a queue if not specified and default queue is not set" do
44
+ @job = @backend.enqueue SimpleJob.new
45
+ @job.queue.should be_nil
46
+ end
47
+
48
+ describe "when a default queue is set" do
49
+ before(:each) do
50
+ Delayed::Worker.default_queue = "default_queue"
51
+ end
52
+
53
+ it "should use default queue when queue is not specified" do
54
+ @job = @backend.enqueue SimpleJob.new
55
+ @job.queue.should == "default_queue"
56
+ end
57
+
58
+ it "should be able to set queue when enqueueing items" do
59
+ later = @backend.db_time_now + 5.minutes
60
+ @job = @backend.enqueue SimpleJob.new, 5, later, "override"
61
+ @job.queue.should == "override"
62
+ end
63
+ end
64
+
43
65
  it "should be able to set run_at when enqueuing items" do
44
66
  later = @backend.db_time_now + 5.minutes
45
67
  @job = @backend.enqueue SimpleJob.new, 5, later
@@ -79,6 +79,13 @@ describe Delayed::MessageSending do
79
79
  Delayed::Worker.default_priority = 0
80
80
  end
81
81
 
82
+ it "should set default queue" do
83
+ Delayed::Worker.default_queue = "default_queue"
84
+ job = Object.delay.to_s
85
+ job.queue.should == "default_queue"
86
+ Delayed::Worker.default_priority = 0
87
+ end
88
+
82
89
  it "should set job options" do
83
90
  run_at = Time.parse('2010-05-03 12:55 AM')
84
91
  job = Object.delay(:priority => 20, :run_at => run_at).to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_with_named_queues
3
3
  version: !ruby/object:Gem::Version
4
- hash: 117
4
+ hash: 123
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 7
10
- - 3
11
- version: 2.0.7.3
10
+ - 4
11
+ version: 2.0.7.4
12
12
  platform: ruby
13
13
  authors:
14
14
  - Ray Walters
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-01-06 00:00:00 -08:00
20
+ date: 2012-01-13 00:00:00 -08:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency