resque_unit 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ module Resque
14
14
  # +klass+ is the job's class and +args+ is an array of the arguments
15
15
  # passed to the job.
16
16
  def self.queue(queue)
17
- self.reset unless @queue
17
+ self.reset! unless @queue
18
18
  @queue[queue]
19
19
  end
20
20
 
@@ -34,7 +34,7 @@ module Resque
34
34
 
35
35
  # :nodoc:
36
36
  def self.queue_for(klass)
37
- klass.instance_variable_get(:@queue)
37
+ klass.instance_variable_get(:@queue) || (klass.respond_to?(:queue) && klass.queue)
38
38
  end
39
39
 
40
40
  end
@@ -7,6 +7,14 @@ class ResqueUnitTest < ActiveSupport::TestCase
7
7
  # good way to hook setup() yet.
8
8
  Resque.reset!
9
9
  end
10
+
11
+ context "A task that schedules a resque job implementing self.queue" do
12
+ setup { Resque.enqueue(MediumPriorityJob) }
13
+ should "pass the assert_queued(job) assertion" do
14
+ assert_queued(MediumPriorityJob)
15
+ assert_equal 1, Resque.queue(MediumPriorityJob.queue).length
16
+ end
17
+ end
10
18
 
11
19
  context "A task that schedules a resque job" do
12
20
  setup do
@@ -15,6 +15,12 @@ class LowPriorityJob
15
15
 
16
16
  end
17
17
 
18
+ class MediumPriorityJob
19
+ def self.queue
20
+ :medium
21
+ end
22
+ end
23
+
18
24
  class JobWithArguments
19
25
  @queue = :medium
20
26
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque_unit
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Justin Weiss
@@ -9,19 +14,21 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-05-04 00:00:00 -07:00
17
+ date: 2010-05-06 00:00:00 -07:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: shoulda
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :development
31
+ version_requirements: *id001
25
32
  description:
26
33
  email: justin@uberweiss.org
27
34
  executables: []
@@ -51,18 +58,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
58
  requirements:
52
59
  - - ">="
53
60
  - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
54
63
  version: "0"
55
- version:
56
64
  required_rubygems_version: !ruby/object:Gem::Requirement
57
65
  requirements:
58
66
  - - ">="
59
67
  - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
60
70
  version: "0"
61
- version:
62
71
  requirements: []
63
72
 
64
73
  rubyforge_project:
65
- rubygems_version: 1.3.5
74
+ rubygems_version: 1.3.6
66
75
  signing_key:
67
76
  specification_version: 3
68
77
  summary: Test::Unit support for resque job queueing