resque_unit 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/resque_unit/resque.rb +6 -0
- data/test/resque_unit_test.rb +8 -0
- metadata +11 -4
data/lib/resque_unit/resque.rb
CHANGED
@@ -27,6 +27,12 @@ module Resque
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
# Returns the size of the given queue
|
31
|
+
def self.size(queue)
|
32
|
+
self.reset! unless @queue
|
33
|
+
@queue[queue].length
|
34
|
+
end
|
35
|
+
|
30
36
|
# :nodoc:
|
31
37
|
def self.enqueue(klass, *args)
|
32
38
|
queue(queue_for(klass)) << {:klass => klass, :args => args}
|
data/test/resque_unit_test.rb
CHANGED
@@ -31,6 +31,10 @@ class ResqueUnitTest < Test::Unit::TestCase
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
should "should be size 1" do
|
35
|
+
assert_equal 1, Resque.size(:low)
|
36
|
+
end
|
37
|
+
|
34
38
|
context ", when Resque.run! is called," do
|
35
39
|
setup do
|
36
40
|
assert !LowPriorityJob.run?, "The job should not have been run yet"
|
@@ -63,6 +67,10 @@ class ResqueUnitTest < Test::Unit::TestCase
|
|
63
67
|
assert_queued(LowPriorityJob)
|
64
68
|
end
|
65
69
|
end
|
70
|
+
|
71
|
+
should "be size 0 when empty" do
|
72
|
+
assert_equal 0, Resque.size(:low)
|
73
|
+
end
|
66
74
|
end
|
67
75
|
|
68
76
|
context "A task that schedules a resque job with arguments" do
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque_unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Justin Weiss
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-07-22 00:00:00 -07:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: shoulda
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -59,23 +62,27 @@ rdoc_options: []
|
|
59
62
|
require_paths:
|
60
63
|
- lib
|
61
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
62
66
|
requirements:
|
63
67
|
- - ">="
|
64
68
|
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
65
70
|
segments:
|
66
71
|
- 0
|
67
72
|
version: "0"
|
68
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
69
75
|
requirements:
|
70
76
|
- - ">="
|
71
77
|
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
72
79
|
segments:
|
73
80
|
- 0
|
74
81
|
version: "0"
|
75
82
|
requirements: []
|
76
83
|
|
77
84
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.3.
|
85
|
+
rubygems_version: 1.3.7
|
79
86
|
signing_key:
|
80
87
|
specification_version: 3
|
81
88
|
summary: Test::Unit support for resque job queueing
|