resque_spec 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -7
- data/lib/resque_spec/scheduler.rb +11 -1
- data/lib/resque_spec/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -27,7 +27,7 @@ your app's gem management)
|
|
27
27
|
end
|
28
28
|
|
29
29
|
Resque with Specs
|
30
|
-
|
30
|
+
=================
|
31
31
|
|
32
32
|
Given this scenario
|
33
33
|
|
@@ -81,7 +81,7 @@ Then I write some code to make it pass:
|
|
81
81
|
end
|
82
82
|
|
83
83
|
ResqueScheduler with Specs
|
84
|
-
|
84
|
+
==========================
|
85
85
|
|
86
86
|
To use with ResqueScheduler, add this require `require 'resque_spec/scheduler'`
|
87
87
|
|
@@ -126,7 +126,7 @@ Then I write some code to make it pass:
|
|
126
126
|
end
|
127
127
|
|
128
128
|
Queue Size Specs
|
129
|
-
|
129
|
+
================
|
130
130
|
|
131
131
|
You can check the size of the queue in your specs too.
|
132
132
|
|
@@ -142,14 +142,14 @@ You can check the size of the queue in your specs too.
|
|
142
142
|
end
|
143
143
|
|
144
144
|
Performing Jobs in Specs
|
145
|
-
|
145
|
+
========================
|
146
146
|
|
147
147
|
Normally, Resque does not perform queued jobs within tests. You may want to
|
148
148
|
make assertions based on the result of your jobs. ResqueSpec can process jobs
|
149
149
|
immediately as they are queued or under your control.
|
150
150
|
|
151
151
|
Performing jobs immediately
|
152
|
-
|
152
|
+
---------------------------
|
153
153
|
|
154
154
|
To perform jobs immediately, you can pass a block to the `with_resque` helper:
|
155
155
|
|
@@ -186,7 +186,7 @@ Or I write this spec using the `with_resque` helper
|
|
186
186
|
You can turn this behavior on by setting `ResqueSpec.inline = true`.
|
187
187
|
|
188
188
|
Performing jobs at your discretion
|
189
|
-
|
189
|
+
----------------------------------
|
190
190
|
|
191
191
|
You can perform the first job on a queue at a time, or perform all the jobs on
|
192
192
|
a queue. Use `ResqueSpec#perform_next(queue_name)` or
|
@@ -206,7 +206,7 @@ I might write this as a Cucumber step
|
|
206
206
|
end
|
207
207
|
|
208
208
|
Hooks
|
209
|
-
|
209
|
+
=====
|
210
210
|
|
211
211
|
Resque provides hooks at different points of the queueing lifecylce. ResqueSpec fires these hooks when appropriate.
|
212
212
|
|
@@ -9,6 +9,10 @@ module ResqueSpec
|
|
9
9
|
def enqueue_in(time, klass, *args)
|
10
10
|
ResqueSpec.enqueue_in(time, klass, *args)
|
11
11
|
end
|
12
|
+
|
13
|
+
def remove_delayed(klass, *args)
|
14
|
+
ResqueSpec.remove_delayed(klass, *args)
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
def enqueue_at(time, klass, *args)
|
@@ -18,7 +22,13 @@ module ResqueSpec
|
|
18
22
|
def enqueue_in(time, klass, *args)
|
19
23
|
enqueue_at(Time.now + time, klass, *args)
|
20
24
|
end
|
21
|
-
|
25
|
+
|
26
|
+
def remove_delayed(klass, *args)
|
27
|
+
queue_by_name(schedule_queue_name(klass)).delete_if do |job|
|
28
|
+
job[:class] == klass.to_s && job[:args] == args
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
def schedule_for(klass)
|
23
33
|
queues[schedule_queue_name(klass)]
|
24
34
|
end
|
data/lib/resque_spec/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: resque_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.8
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Les Hill
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-24 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|