resque_unit 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/resque_unit/resque.rb +2 -2
- data/test/resque_unit_test.rb +8 -0
- data/test/sample_jobs.rb +6 -0
- metadata +18 -9
data/lib/resque_unit/resque.rb
CHANGED
@@ -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
|
data/test/resque_unit_test.rb
CHANGED
@@ -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
|
data/test/sample_jobs.rb
CHANGED
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
|
-
|
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-
|
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
|
-
|
18
|
-
|
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
|
-
|
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.
|
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
|