resque_spec 0.14.4 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,7 +10,8 @@ on
10
10
 
11
11
  ResqueSpec will also fire Resque hooks if you are using them. See below.
12
12
 
13
- The current version works with `Resque v1.19.0` and up and `RSpec v2.5.0` and up.
13
+ The current version works with `Resque >~ v1.19` and up and `RSpec >= v2.5.0`
14
+ (including the RSpec 3 beta).
14
15
 
15
16
  Install
16
17
  -------
@@ -406,7 +407,7 @@ Contributors
406
407
  * (@dtsiknis) : Updated removed\_delayed
407
408
  * Li Ellis Gallardo (@lellisga) : fix inline/disable\_ext bug
408
409
  * Jeff Deville (@jeffdeville) : Resque.size
409
- * Frank Wambutt (@opinel) : Fix DST problem in `have\_scheduled`
410
+ * Frank Wambutt (@opinel) : Fix DST problem in `have_scheduled`
410
411
  * Luke Melia (@lukemelia) : Add `times` chained matcher
411
412
  * Pablo Fernandez (@heelhook) : Add `have_queue_size_of_at_least` and `have_schedule_size_of_at_least` matchers
412
413
  * (@k1w1) : Add support for enqueue\_at\_with\_queue/enqueue\_in\_with\_queue
@@ -415,9 +416,10 @@ Contributors
415
416
  * Andrés Bravo (@andresbravog) : Replace `rspec` dependency with explicit dependencies
416
417
  * Ben Woosley (@Empact) : Loosen rubygems version constraint
417
418
  * Jeff Dickey (@dickeyxxx) : Remove 2.0 warnings, added Travis
418
- * Earle Clubb (@eclubb) : `be\_queued` matcher
419
+ * Earle Clubb (@eclubb) : `be_queued` matcher
420
+ * Erkki Eilonen (@erkki) : RSpec 3 support
419
421
 
420
422
  Copyright
421
423
  =========
422
424
 
423
- Copyright (c) 2010-2013 Les Hill. See LICENSE for details.
425
+ Copyright (c) 2010-2014 Les Hill. See LICENSE for details.
@@ -3,18 +3,16 @@ require 'rspec/expectations'
3
3
  require 'rspec/mocks'
4
4
 
5
5
  module InQueueHelper
6
- def self.extended(klass)
7
- klass.instance_eval do
8
- self.queue_name = nil
9
- chain :in do |queue_name|
10
- self.queue_name = queue_name
11
- end
6
+ def self.included(klass)
7
+ klass.class_eval do
8
+ attr_accessor :queue_name
12
9
  end
13
10
  end
14
11
 
15
- private
16
-
17
- attr_accessor :queue_name
12
+ def in(queue_name)
13
+ self.queue_name = queue_name
14
+ self
15
+ end
18
16
 
19
17
  def queue(actual)
20
18
  if @queue_name
@@ -27,14 +25,14 @@ module InQueueHelper
27
25
  end
28
26
 
29
27
  RSpec::Matchers.define :be_queued do |*expected_args|
30
- extend InQueueHelper
28
+ include InQueueHelper
31
29
 
32
30
  chain :times do |num_times_queued|
33
31
  @times = num_times_queued
34
32
  @times_info = @times == 1 ? ' once' : " #{@times} times"
35
33
  end
36
34
 
37
- chain :once do |num_times_queued|
35
+ chain :once do
38
36
  @times = 1
39
37
  @times_info = ' once'
40
38
  end
@@ -67,14 +65,14 @@ RSpec::Matchers.define :be_queued do |*expected_args|
67
65
  end
68
66
 
69
67
  RSpec::Matchers.define :have_queued do |*expected_args|
70
- extend InQueueHelper
68
+ include InQueueHelper
71
69
 
72
70
  chain :times do |num_times_queued|
73
71
  @times = num_times_queued
74
72
  @times_info = @times == 1 ? ' once' : " #{@times} times"
75
73
  end
76
74
 
77
- chain :once do |num_times_queued|
75
+ chain :once do
78
76
  @times = 1
79
77
  @times_info = ' once'
80
78
  end
@@ -107,7 +105,7 @@ RSpec::Matchers.define :have_queued do |*expected_args|
107
105
  end
108
106
 
109
107
  RSpec::Matchers.define :have_queue_size_of do |size|
110
- extend InQueueHelper
108
+ include InQueueHelper
111
109
 
112
110
  match do |actual|
113
111
  queue(actual).size == size
@@ -127,7 +125,7 @@ RSpec::Matchers.define :have_queue_size_of do |size|
127
125
  end
128
126
 
129
127
  RSpec::Matchers.define :have_queue_size_of_at_least do |size|
130
- extend InQueueHelper
128
+ include InQueueHelper
131
129
 
132
130
  match do |actual|
133
131
  queue(actual).size >= size
@@ -147,18 +145,16 @@ RSpec::Matchers.define :have_queue_size_of_at_least do |size|
147
145
  end
148
146
 
149
147
  module ScheduleQueueHelper
150
- def self.extended(klass)
151
- klass.instance_eval do
152
- self.queue_name = nil
153
- chain :queue do |queue_name|
154
- self.queue_name = queue_name
155
- end
148
+ def self.included(klass)
149
+ klass.class_eval do
150
+ attr_accessor :queue_name
156
151
  end
157
152
  end
158
153
 
159
- private
160
-
161
- attr_accessor :queue_name
154
+ def queue(queue_name)
155
+ self.queue_name = queue_name
156
+ self
157
+ end
162
158
 
163
159
  def schedule_queue_for(actual)
164
160
  if @queue_name
@@ -171,7 +167,7 @@ module ScheduleQueueHelper
171
167
  end
172
168
 
173
169
  RSpec::Matchers.define :have_scheduled do |*expected_args|
174
- extend ScheduleQueueHelper
170
+ include ScheduleQueueHelper
175
171
 
176
172
  chain :at do |timestamp|
177
173
  @interval = nil
@@ -216,7 +212,7 @@ RSpec::Matchers.define :have_scheduled do |*expected_args|
216
212
  end
217
213
 
218
214
  RSpec::Matchers.define :have_scheduled_at do |*expected_args|
219
- extend ScheduleQueueHelper
215
+ include ScheduleQueueHelper
220
216
  warn "DEPRECATION WARNING: have_scheduled_at(time, *args) is deprecated and will be removed in future. Please use have_scheduled(*args).at(time) instead."
221
217
 
222
218
  match do |actual|
@@ -239,7 +235,7 @@ RSpec::Matchers.define :have_scheduled_at do |*expected_args|
239
235
  end
240
236
 
241
237
  RSpec::Matchers.define :have_schedule_size_of do |size|
242
- extend ScheduleQueueHelper
238
+ include ScheduleQueueHelper
243
239
 
244
240
  match do |actual|
245
241
  schedule_queue_for(actual).size == size
@@ -259,7 +255,7 @@ RSpec::Matchers.define :have_schedule_size_of do |size|
259
255
  end
260
256
 
261
257
  RSpec::Matchers.define :have_schedule_size_of_at_least do |size|
262
- extend ScheduleQueueHelper
258
+ include ScheduleQueueHelper
263
259
 
264
260
  match do |actual|
265
261
  schedule_queue_for(actual).size >= size
@@ -1,3 +1,3 @@
1
1
  module ResqueSpec
2
- VERSION = "0.14.4"
2
+ VERSION = "0.15.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.4
4
+ version: 0.15.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-20 00:00:00.000000000 Z
12
+ date: 2014-02-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: resque