resque-approval 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +13 -0
- data/lib/resque-approval.rb +1 -1
- data/lib/resque-approval/version.rb +1 -1
- data/spec/lib/resque-approval_spec.rb +25 -0
- metadata +14 -14
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,21 @@
|
|
1
|
+
## 1.2.1 (2012-06-19)
|
2
|
+
|
3
|
+
* Bug fixes:
|
4
|
+
* Only schedule job if timeout > 0.
|
5
|
+
|
6
|
+
|
7
|
+
## 1.2.0 (2012-06-14)
|
8
|
+
|
9
|
+
* Enhancements:
|
10
|
+
* Add ability to approve/reject jobs queued by resque-scheduler.
|
11
|
+
|
12
|
+
|
1
13
|
## 1.0.1 (2012-06-06)
|
2
14
|
|
3
15
|
* Bug fixes:
|
4
16
|
* Make return values from .approve and .reject more explicit.
|
5
17
|
|
18
|
+
|
6
19
|
## 1.0.0 (2012-06-06)
|
7
20
|
|
8
21
|
* Initial release
|
data/lib/resque-approval.rb
CHANGED
@@ -38,7 +38,7 @@ module Resque
|
|
38
38
|
id = Resque.redis.hlen('pending_jobs')
|
39
39
|
key = build_key(id, message, timeout)
|
40
40
|
|
41
|
-
if timeout && Resque.respond_to?(:enqueue_in)
|
41
|
+
if timeout.kind_of?(Numeric) && timeout > 0 && Resque.respond_to?(:enqueue_in)
|
42
42
|
approval_args = args.merge(:approval_key => key)
|
43
43
|
Resque.enqueue_in(timeout, self, approval_args)
|
44
44
|
|
@@ -106,6 +106,31 @@ describe "Resque::Plugins::Approval" do
|
|
106
106
|
Resque.size(:approval_required).should == 0
|
107
107
|
end
|
108
108
|
end
|
109
|
+
|
110
|
+
context "with a disabled timeout" do
|
111
|
+
it "includes the timeout in the 'pending_jobs' hash entry" do
|
112
|
+
Job.enqueue_for_approval(:approval_timeout => 0)
|
113
|
+
|
114
|
+
key = '{"id":0,"approval_timeout":0}'
|
115
|
+
value = { :class => Job, :args => [{}] }
|
116
|
+
value = Resque.encode(value)
|
117
|
+
|
118
|
+
Resque.redis.hget('pending_jobs', key).should == value
|
119
|
+
end
|
120
|
+
|
121
|
+
it "does not schedule the job" do
|
122
|
+
Resque.count_all_scheduled_jobs.should == 0
|
123
|
+
|
124
|
+
Job.enqueue_for_approval(:approval_timeout => 0)
|
125
|
+
|
126
|
+
Resque.count_all_scheduled_jobs.should == 0
|
127
|
+
end
|
128
|
+
|
129
|
+
it "adds the job to the appoval queue" do
|
130
|
+
Job.enqueue_for_approval(:approval_timeout => 0)
|
131
|
+
Resque.size(:approval_required).should == 1
|
132
|
+
end
|
133
|
+
end
|
109
134
|
end
|
110
135
|
|
111
136
|
describe ".approve" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-approval
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: resque
|
16
|
-
requirement: &
|
16
|
+
requirement: &12894400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *12894400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &12893520 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *12893520
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &12892100 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *12892100
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard
|
49
|
-
requirement: &
|
49
|
+
requirement: &12891220 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *12891220
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard-rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &12890660 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *12890660
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: resque-scheduler
|
71
|
-
requirement: &
|
71
|
+
requirement: &12890100 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *12890100
|
80
80
|
description: ! "A Resque plugin allowing jobs to be sent to a temporary\n queue
|
81
81
|
to await approval. Once the job is approved, it\n is placed
|
82
82
|
on its normal queue."
|