resque_spec 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +241 -184
- data/lib/resque_spec/matchers.rb +4 -42
- data/lib/resque_spec/version.rb +1 -1
- metadata +32 -55
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5851f97704a23a220da8bdcef78b30cba194f350
|
4
|
+
data.tar.gz: 05b5b1028e62a7beaf9208b066c044dc97f09d29
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5914dad21263102011ea4c243958c64bde82fe1a413b88cae2145145eee6b10eac1eb7995cfe010156795e19897e062dda9dccd069cb9135b7927bf4c28117ed
|
7
|
+
data.tar.gz: e9b2a997a01428dd11661d88f96da48ccc9688e0abb42c810c53a3c6db794d9ab23c32fd6886a2d7ad1436a311de23a73b398addbf33e2cd29870eeb78427b47
|
data/README.md
CHANGED
@@ -13,6 +13,16 @@ ResqueSpec will also fire Resque hooks if you are using them. See below.
|
|
13
13
|
Version 0.16.0 works with `Resque >~ v1.19` and up and `rspec >= 3.0.0`.
|
14
14
|
Version 0.15.0 works with `Resque >~ v1.19` and up and `rspec >= v2.5.0`
|
15
15
|
|
16
|
+
Resque 2
|
17
|
+
========
|
18
|
+
|
19
|
+
Use the `resque_2` branch via your `Gemfile` to use with v2.0.0.pre.1+ of
|
20
|
+
`resque`.
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
gem 'resque', github: 'leshill/resque_spec', ref: 'resque_2'
|
24
|
+
```
|
25
|
+
|
16
26
|
Install
|
17
27
|
-------
|
18
28
|
|
@@ -21,9 +31,11 @@ using `bundler`? Do the necessary thing for your app's gem management and use
|
|
21
31
|
`bundler`. `resque_spec` monkey patches `resque` it should only be used with
|
22
32
|
your tests!)
|
23
33
|
|
24
|
-
|
25
|
-
|
26
|
-
|
34
|
+
```ruby
|
35
|
+
group :test do
|
36
|
+
gem 'resque_spec'
|
37
|
+
end
|
38
|
+
```
|
27
39
|
|
28
40
|
Cucumber
|
29
41
|
--------
|
@@ -32,8 +44,9 @@ By default, the above will add the `ResqueSpec` module and make it available in
|
|
32
44
|
Cucumber. If you want the `with_resque` and `without_resque` helpers, manually
|
33
45
|
require the `resque_spec/cucumber` module:
|
34
46
|
|
35
|
-
|
36
|
-
|
47
|
+
```ruby
|
48
|
+
require 'resque_spec/cucumber'
|
49
|
+
```
|
37
50
|
This can be done in `features/support/env.rb` or in a specific support file
|
38
51
|
such as `features/support/resque.rb`.
|
39
52
|
|
@@ -59,64 +72,72 @@ Given this scenario
|
|
59
72
|
|
60
73
|
And I write this spec using the `resque_spec` matcher
|
61
74
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
it "adds person.calculate to the Person queue" do
|
68
|
-
person.recalculate
|
69
|
-
Person.should have_queued(person.id, :calculate)
|
70
|
-
end
|
71
|
-
end
|
75
|
+
```ruby
|
76
|
+
describe "#recalculate" do
|
77
|
+
before do
|
78
|
+
ResqueSpec.reset!
|
79
|
+
end
|
72
80
|
|
81
|
+
it "adds person.calculate to the Person queue" do
|
82
|
+
person.recalculate
|
83
|
+
expect(Person).to have_queued(person.id, :calculate)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
```
|
73
87
|
|
74
88
|
And I see that the `have_queued` assertion is asserting that the `Person` queue has a job with arguments `person.id` and `:calculate`
|
75
89
|
|
76
90
|
And I take note of the `before` block that is calling `reset!` for every spec
|
77
91
|
|
78
92
|
And I might use the `in` statement to specify the queue:
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
93
|
+
```ruby
|
94
|
+
describe "#recalculate" do
|
95
|
+
before do
|
96
|
+
ResqueSpec.reset!
|
97
|
+
end
|
98
|
+
|
99
|
+
it "adds person.calculate to the Person queue" do
|
100
|
+
person.recalculate
|
101
|
+
expect(Person).to have_queued(person.id, :calculate).in(:people)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
```
|
90
105
|
|
91
106
|
And I might write this as a Cucumber step
|
92
107
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
108
|
+
```ruby
|
109
|
+
Then /the (\w?) has (\w?) queued/ do |thing, method|
|
110
|
+
thing_obj = instance_variable_get("@#{thing}")
|
111
|
+
expect(thing_obj.class).to have_queued(thing_obj.id, method.to_sym)
|
112
|
+
end
|
113
|
+
```
|
97
114
|
|
98
115
|
Then I write some code to make it pass:
|
99
116
|
|
100
|
-
|
101
|
-
|
117
|
+
```ruby
|
118
|
+
class Person
|
119
|
+
@queue = :people
|
102
120
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
121
|
+
def recalculate
|
122
|
+
Resque.enqueue(Person, id, :calculate)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
```
|
107
126
|
|
108
127
|
You can check the size of the queue in your specs too.
|
109
128
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
129
|
+
```ruby
|
130
|
+
describe "#recalculate" do
|
131
|
+
before do
|
132
|
+
ResqueSpec.reset!
|
133
|
+
end
|
114
134
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
135
|
+
it "adds an entry to the Person queue" do
|
136
|
+
person.recalculate
|
137
|
+
expect(Person).to have_queue_size_of(1)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
```
|
120
141
|
|
121
142
|
Turning off ResqueSpec and calling directly to Resque
|
122
143
|
-----------------------------------------------------
|
@@ -125,20 +146,24 @@ Occasionally, you want to run your specs directly against Resque instead of
|
|
125
146
|
ResqueSpec. For one at a time use, pass a block to the `without_resque_spec`
|
126
147
|
helper:
|
127
148
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
... assert recalculation after job done
|
134
|
-
end
|
149
|
+
```ruby
|
150
|
+
describe "#recalculate" do
|
151
|
+
it "recalculates the persons score" do
|
152
|
+
without_resque_spec do
|
153
|
+
person.recalculate
|
135
154
|
end
|
155
|
+
... assert recalculation after job done
|
156
|
+
end
|
157
|
+
end
|
158
|
+
```
|
136
159
|
|
137
160
|
Or you can manage when ResqueSpec is disabled by flipping the
|
138
161
|
`ResqueSpec.disable_ext` flag:
|
139
162
|
|
140
|
-
|
141
|
-
|
163
|
+
```ruby
|
164
|
+
# disable ResqueSpec
|
165
|
+
ResqueSpec.disable_ext = true
|
166
|
+
```
|
142
167
|
|
143
168
|
You will most likely (but not always, see the Resque docs) need to ensure that
|
144
169
|
you have `redis` running.
|
@@ -150,30 +175,36 @@ To use with [ResqueMailer](https://github.com/zapnap/resque_mailer) you should
|
|
150
175
|
have an initializer that does *not* exclude the `test` (or `cucumber`)
|
151
176
|
environment. Your initializer will probably end up looking like:
|
152
177
|
|
153
|
-
|
154
|
-
|
178
|
+
```ruby
|
179
|
+
# config/initializers/resque_mailer.rb
|
180
|
+
Resque::Mailer.excluded_environments = []
|
181
|
+
```
|
155
182
|
|
156
183
|
If you have a mailer like this:
|
157
184
|
|
158
|
-
|
159
|
-
|
185
|
+
```ruby
|
186
|
+
class ExampleMailer < ActionMailer::Base
|
187
|
+
include Resque::Mailer
|
160
188
|
|
161
|
-
|
162
|
-
|
163
|
-
|
189
|
+
def welcome_email(user_id)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
```
|
164
193
|
|
165
194
|
You can write a spec like this:
|
166
195
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
196
|
+
```ruby
|
197
|
+
describe "#welcome_email" do
|
198
|
+
before do
|
199
|
+
ResqueSpec.reset!
|
200
|
+
Examplemailer.welcome_email(user.id).deliver
|
201
|
+
end
|
172
202
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
203
|
+
subject { described_class }
|
204
|
+
it { should have_queue_size_of(1) }
|
205
|
+
it { should have_queued(:welcome_email, user.id) }
|
206
|
+
end
|
207
|
+
```
|
177
208
|
|
178
209
|
resque-scheduler with Specs
|
179
210
|
==========================
|
@@ -182,7 +213,9 @@ To use with resque-scheduler, add this require `require 'resque_spec/scheduler'`
|
|
182
213
|
|
183
214
|
*n.b.* Yes, you also need to require resque-scheduler, this works (check the docs for other ways):
|
184
215
|
|
185
|
-
|
216
|
+
```ruby
|
217
|
+
gem "resque-scheduler", :require => "resque_scheduler"
|
218
|
+
```
|
186
219
|
|
187
220
|
Given this scenario
|
188
221
|
|
@@ -192,98 +225,112 @@ Given this scenario
|
|
192
225
|
|
193
226
|
And I write this spec using the `resque_spec` matcher
|
194
227
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
228
|
+
```ruby
|
229
|
+
describe "#recalculate" do
|
230
|
+
before do
|
231
|
+
ResqueSpec.reset!
|
232
|
+
end
|
199
233
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
234
|
+
it "adds person.calculate to the Person queue" do
|
235
|
+
person.recalculate
|
236
|
+
expect(Person).to have_scheduled(person.id, :calculate)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
```
|
205
240
|
|
206
241
|
And I might use the `at` statement to specify the time:
|
207
242
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
243
|
+
```ruby
|
244
|
+
describe "#recalculate" do
|
245
|
+
before do
|
246
|
+
ResqueSpec.reset!
|
247
|
+
end
|
212
248
|
|
213
|
-
|
214
|
-
|
249
|
+
it "adds person.calculate to the Person queue" do
|
250
|
+
person.recalculate
|
215
251
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
252
|
+
# Is it scheduled to be executed at 2010-02-14 06:00:00 ?
|
253
|
+
expect(Person).to have_scheduled(person.id, :calculate).at(Time.mktime(2010,2,14,6,0,0))
|
254
|
+
end
|
255
|
+
end
|
256
|
+
```
|
220
257
|
|
221
258
|
And I might use the `in` statement to specify time interval (in seconds):
|
222
259
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
260
|
+
```ruby
|
261
|
+
describe "#recalculate" do
|
262
|
+
before do
|
263
|
+
ResqueSpec.reset!
|
264
|
+
end
|
227
265
|
|
228
|
-
|
229
|
-
|
266
|
+
it "adds person.calculate to the Person queue" do
|
267
|
+
person.recalculate
|
230
268
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
269
|
+
# Is it scheduled to be executed in 5 minutes?
|
270
|
+
expect(Person).to have_scheduled(person.id, :calculate).in(5 * 60)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
```
|
235
274
|
|
236
275
|
You can also check the size of the schedule:
|
237
276
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
277
|
+
```ruby
|
278
|
+
describe "#recalculate" do
|
279
|
+
before do
|
280
|
+
ResqueSpec.reset!
|
281
|
+
end
|
242
282
|
|
243
|
-
|
244
|
-
|
283
|
+
it "adds person.calculate to the Person queue" do
|
284
|
+
person.recalculate
|
245
285
|
|
246
|
-
|
247
|
-
|
248
|
-
|
286
|
+
expect(Person).to have_schedule_size_of(1)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
```
|
249
290
|
|
250
291
|
(And I take note of the `before` block that is calling `reset!` for every spec)
|
251
292
|
|
252
293
|
You can explicitly specify the queue when using enqueue_at_with_queue and
|
253
294
|
enqueue_in_with_queue:
|
254
295
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
296
|
+
```ruby
|
297
|
+
describe "#recalculate_in_future" do
|
298
|
+
before do
|
299
|
+
ResqueSpec.reset!
|
300
|
+
end
|
259
301
|
|
260
|
-
|
261
|
-
|
302
|
+
it "adds person.calculate to the :future queue" do
|
303
|
+
person.recalculate_in_future
|
262
304
|
|
263
|
-
|
264
|
-
|
265
|
-
|
305
|
+
Person.should have_schedule_size_of(1).queue(:future)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
```
|
266
309
|
|
267
310
|
And I might write this as a Cucumber step
|
268
311
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
312
|
+
```ruby
|
313
|
+
Then /the (\w?) has (\w?) scheduled/ do |thing, method|
|
314
|
+
thing_obj = instance_variable_get("@#{thing}")
|
315
|
+
expect(thing_obj.class).to have_scheduled(thing_obj.id, method.to_sym)
|
316
|
+
end
|
317
|
+
```
|
273
318
|
|
274
319
|
Then I write some code to make it pass:
|
275
320
|
|
276
|
-
|
277
|
-
|
321
|
+
```ruby
|
322
|
+
class Person
|
323
|
+
@queue = :people
|
278
324
|
|
279
|
-
|
280
|
-
|
281
|
-
|
325
|
+
def recalculate
|
326
|
+
Resque.enqueue_at(Time.now + 3600, Person, id, :calculate)
|
327
|
+
end
|
282
328
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
329
|
+
def recalculate_in_future
|
330
|
+
Resque.enqueue_at_with_queue(:future, Time.now + 3600, Person, id, :calculate)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
```
|
287
334
|
|
288
335
|
Performing Jobs in Specs
|
289
336
|
========================
|
@@ -305,27 +352,31 @@ Given this scenario
|
|
305
352
|
|
306
353
|
I might write this as a Cucumber step
|
307
354
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
355
|
+
```ruby
|
356
|
+
When /I score/ do
|
357
|
+
with_resque do
|
358
|
+
visit game_path
|
359
|
+
click_link 'Score!'
|
360
|
+
end
|
361
|
+
end
|
362
|
+
```
|
314
363
|
|
315
364
|
Or I write this spec using the `with_resque` helper
|
316
365
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
game.score.should == 10
|
327
|
-
end
|
366
|
+
```ruby
|
367
|
+
describe "#score!" do
|
368
|
+
before do
|
369
|
+
ResqueSpec.reset!
|
370
|
+
end
|
371
|
+
|
372
|
+
it "increases the score" do
|
373
|
+
with_resque do
|
374
|
+
game.score!
|
328
375
|
end
|
376
|
+
expect(game.score).to == 10
|
377
|
+
end
|
378
|
+
end
|
379
|
+
```
|
329
380
|
|
330
381
|
You can turn this behavior on by setting `ResqueSpec.inline = true`.
|
331
382
|
|
@@ -345,9 +396,11 @@ Given this scenario:
|
|
345
396
|
|
346
397
|
I might write this as a Cucumber step
|
347
398
|
|
348
|
-
|
349
|
-
|
350
|
-
|
399
|
+
```ruby
|
400
|
+
When /the (\w+) queue runs/ do |queue_name|
|
401
|
+
ResqueSpec.perform_all(queue_name)
|
402
|
+
end
|
403
|
+
```
|
351
404
|
|
352
405
|
Hooks
|
353
406
|
=====
|
@@ -387,40 +440,44 @@ Follow me on [Github](https://github.com/leshill) and
|
|
387
440
|
Contributors
|
388
441
|
============
|
389
442
|
|
390
|
-
* Kenneth Kalmer
|
391
|
-
* Brian Cardarella
|
392
|
-
* Joshua Davey
|
393
|
-
* Lar Van Der Jagt
|
394
|
-
* Evan Sagge
|
395
|
-
* Jon Larkowski
|
396
|
-
* James Conroy-Finn
|
397
|
-
* Dennis Walters
|
398
|
-
*
|
399
|
-
* Kurt Werle
|
400
|
-
*
|
401
|
-
* Marcin Balinski
|
402
|
-
*
|
403
|
-
*
|
404
|
-
* Mateusz Konikowski
|
405
|
-
* Mathieu Ravaux
|
406
|
-
* Arjan van der Gaag
|
407
|
-
*
|
408
|
-
* Li Ellis Gallardo
|
409
|
-
* Jeff Deville
|
410
|
-
* Frank Wambutt
|
411
|
-
* Luke Melia
|
412
|
-
* Pablo Fernandez
|
413
|
-
*
|
414
|
-
* Ozéias Sant'ana
|
415
|
-
* Yuya Kitajima
|
416
|
-
* Andrés Bravo
|
417
|
-
* Ben Woosley
|
418
|
-
* Jeff Dickey
|
419
|
-
* Earle Clubb
|
420
|
-
* Erkki Eilonen
|
421
|
-
* Gavin Heavyside
|
443
|
+
* Kenneth Kalmer (@kennethkalmer) : rspec dependency fix
|
444
|
+
* Brian Cardarella (@bcardarella) : fix mutation bug
|
445
|
+
* Joshua Davey (@joshdavey) : with\_resque helper
|
446
|
+
* Lar Van Der Jagt (@supaspoida) : with\_resque helper
|
447
|
+
* Evan Sagge (@evansagge) : Hook in via Job.create, have\_queued.in
|
448
|
+
* Jon Larkowski (@l4rk) : inline perform
|
449
|
+
* James Conroy-Finn (@jcf) : spec fix
|
450
|
+
* Dennis Walters (@ess) : enqueue\_in support
|
451
|
+
* (@RipTheJacker) : remove\_delayed support
|
452
|
+
* Kurt Werle (@kwerle) : explicit require spec for v020
|
453
|
+
* (@dwilkie) : initial before\_enqueue support
|
454
|
+
* Marcin Balinski (@marcinb) : have\_schedule\_size\_of matcher, schedule matcher at, in
|
455
|
+
* (@alexeits) : fix matcher in bug with RSpec 2.8.0
|
456
|
+
* (@ToadJamb) : encode/decode of Resque job arguments
|
457
|
+
* Mateusz Konikowski (@mkonikowski) : support for anything matcher
|
458
|
+
* Mathieu Ravaux (@mathieuravaux) : without\_resque\_spec support
|
459
|
+
* Arjan van der Gaag (@avdgaag) : peek support
|
460
|
+
* (@dtsiknis) : Updated removed\_delayed
|
461
|
+
* Li Ellis Gallardo (@lellisga) : fix inline/disable\_ext bug
|
462
|
+
* Jeff Deville (@jeffdeville) : Resque.size
|
463
|
+
* Frank Wambutt (@opinel) : Fix DST problem in `have_scheduled`
|
464
|
+
* Luke Melia (@lukemelia) : Add `times` chained matcher
|
465
|
+
* Pablo Fernandez (@heelhook) : Add `have_queue_size_of_at_least` and `have_schedule_size_of_at_least` matchers
|
466
|
+
* (@k1w1) : Add support for enqueue\_at\_with\_queue/enqueue\_in\_with\_queue
|
467
|
+
* Ozéias Sant'ana (@ozeias) : Update specs to RSpec 2.10
|
468
|
+
* Yuya Kitajima (@yuyak) : Add ResqueMailer examples to README
|
469
|
+
* Andrés Bravo (@andresbravog) : Replace `rspec` dependency with explicit dependencies
|
470
|
+
* Ben Woosley (@Empact) : Loosen rubygems version constraint
|
471
|
+
* Jeff Dickey (@dickeyxxx) : Remove 2.0 warnings, added Travis
|
472
|
+
* Earle Clubb (@eclubb) : `be_queued` matcher
|
473
|
+
* Erkki Eilonen (@erkki) : RSpec 3 support
|
474
|
+
* Gavin Heavyside (@gavinheavyside) : RSpec three warnings
|
475
|
+
* Pavel Khrulev (@PaulSchuher) : Resque 2 and RSpec 3 support
|
476
|
+
* Ilya Katz (@ilyakatz) : Cleanup README.md for RSpec 3
|
477
|
+
* (@addbrick) : Compare times as integers in `have_scheduled` matcher
|
478
|
+
* Serious Haircut (@serioushaircut) : Fix ArgumentListMatcher to make it work with any\_args
|
422
479
|
|
423
480
|
Copyright
|
424
481
|
=========
|
425
482
|
|
426
|
-
Copyright (c) 2010-
|
483
|
+
Copyright (c) 2010-2015 Les Hill. See LICENSE for details.
|
data/lib/resque_spec/matchers.rb
CHANGED
@@ -6,8 +6,8 @@ module ArgsHelper
|
|
6
6
|
private
|
7
7
|
|
8
8
|
def match_args(expected_args, args)
|
9
|
-
arg_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(expected_args)
|
10
|
-
arg_list_matcher.args_match?(args)
|
9
|
+
arg_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(*expected_args)
|
10
|
+
arg_list_matcher.args_match?(*args)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -75,45 +75,7 @@ RSpec::Matchers.define :be_queued do |*expected_args|
|
|
75
75
|
|
76
76
|
end
|
77
77
|
|
78
|
-
RSpec::Matchers.
|
79
|
-
include InQueueHelper
|
80
|
-
|
81
|
-
chain :times do |num_times_queued|
|
82
|
-
@times = num_times_queued
|
83
|
-
@times_info = @times == 1 ? ' once' : " #{@times} times"
|
84
|
-
end
|
85
|
-
|
86
|
-
chain :once do
|
87
|
-
@times = 1
|
88
|
-
@times_info = ' once'
|
89
|
-
end
|
90
|
-
|
91
|
-
match do |actual|
|
92
|
-
matched = queue(actual).select do |entry|
|
93
|
-
klass = entry.fetch(:class)
|
94
|
-
args = entry.fetch(:args)
|
95
|
-
klass.to_s == actual.to_s && match_args(expected_args, args)
|
96
|
-
end
|
97
|
-
|
98
|
-
if @times
|
99
|
-
matched.size == @times
|
100
|
-
else
|
101
|
-
matched.size > 0
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
failure_message do |actual|
|
106
|
-
"expected that #{actual} would have [#{expected_args.join(', ')}] queued#{@times_info}"
|
107
|
-
end
|
108
|
-
|
109
|
-
failure_message_when_negated do |actual|
|
110
|
-
"expected that #{actual} would not have [#{expected_args.join(', ')}] queued#{@times_info}"
|
111
|
-
end
|
112
|
-
|
113
|
-
description do
|
114
|
-
"have queued arguments of [#{expected_args.join(', ')}]#{@times_info}"
|
115
|
-
end
|
116
|
-
end
|
78
|
+
RSpec::Matchers.alias_matcher :have_queued, :be_queued
|
117
79
|
|
118
80
|
RSpec::Matchers.define :have_queue_size_of do |size|
|
119
81
|
include InQueueHelper
|
@@ -200,7 +162,7 @@ RSpec::Matchers.define :have_scheduled do |*expected_args|
|
|
200
162
|
args_match = match_args(expected_args, entry[:args])
|
201
163
|
|
202
164
|
time_matches = if @time
|
203
|
-
entry[:time] == @time
|
165
|
+
entry[:time].to_i == @time.to_i
|
204
166
|
elsif @interval
|
205
167
|
entry[:time].to_i == (entry[:stored_at] + @interval).to_i
|
206
168
|
else
|
data/lib/resque_spec/version.rb
CHANGED
metadata
CHANGED
@@ -1,174 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.17.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Les Hill
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-09-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: resque
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.19.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.19.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec-core
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 3.0.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 3.0.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec-expectations
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 3.0.0
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 3.0.0
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec-mocks
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 3.0.0
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 3.0.0
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: resque-scheduler
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: pry
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ">="
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ">="
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
|
-
name: pry-
|
98
|
+
name: pry-byebug
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - ">="
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: timecop
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - ">="
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: '0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - ">="
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: '0'
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: rake
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
|
-
- -
|
129
|
+
- - ">="
|
148
130
|
- !ruby/object:Gem::Version
|
149
131
|
version: '0'
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
|
-
- -
|
136
|
+
- - ">="
|
156
137
|
- !ruby/object:Gem::Version
|
157
138
|
version: '0'
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
140
|
name: rspec
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
142
|
requirements:
|
163
|
-
- -
|
143
|
+
- - ">="
|
164
144
|
- !ruby/object:Gem::Version
|
165
145
|
version: 3.0.0
|
166
146
|
type: :development
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
|
-
- -
|
150
|
+
- - ">="
|
172
151
|
- !ruby/object:Gem::Version
|
173
152
|
version: 3.0.0
|
174
153
|
description: RSpec matchers for Resque
|
@@ -177,40 +156,38 @@ executables: []
|
|
177
156
|
extensions: []
|
178
157
|
extra_rdoc_files: []
|
179
158
|
files:
|
159
|
+
- LICENSE
|
160
|
+
- README.md
|
161
|
+
- Rakefile
|
162
|
+
- lib/resque_spec.rb
|
180
163
|
- lib/resque_spec/cucumber.rb
|
181
164
|
- lib/resque_spec/ext.rb
|
182
165
|
- lib/resque_spec/helpers.rb
|
183
166
|
- lib/resque_spec/matchers.rb
|
184
167
|
- lib/resque_spec/scheduler.rb
|
185
168
|
- lib/resque_spec/version.rb
|
186
|
-
- lib/resque_spec.rb
|
187
|
-
- LICENSE
|
188
|
-
- README.md
|
189
|
-
- Rakefile
|
190
169
|
homepage: http://github.com/leshill/resque_spec
|
191
170
|
licenses:
|
192
171
|
- MIT
|
172
|
+
metadata: {}
|
193
173
|
post_install_message:
|
194
174
|
rdoc_options: []
|
195
175
|
require_paths:
|
196
176
|
- lib
|
197
177
|
required_ruby_version: !ruby/object:Gem::Requirement
|
198
|
-
none: false
|
199
178
|
requirements:
|
200
|
-
- -
|
179
|
+
- - ">="
|
201
180
|
- !ruby/object:Gem::Version
|
202
181
|
version: '0'
|
203
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
|
-
none: false
|
205
183
|
requirements:
|
206
|
-
- -
|
184
|
+
- - ">="
|
207
185
|
- !ruby/object:Gem::Version
|
208
186
|
version: 1.3.6
|
209
187
|
requirements: []
|
210
188
|
rubyforge_project:
|
211
|
-
rubygems_version:
|
189
|
+
rubygems_version: 2.4.5.1
|
212
190
|
signing_key:
|
213
|
-
specification_version:
|
191
|
+
specification_version: 4
|
214
192
|
summary: RSpec matchers for Resque
|
215
193
|
test_files: []
|
216
|
-
has_rdoc:
|