resque_spec 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,8 +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` and up and `RSpec >= v2.5.0`
14
- (including the RSpec 3 beta).
13
+ Version 0.16.0 works with `Resque >~ v1.19` and up and `rspec >= 3.0.0`.
14
+ Version 0.15.0 works with `Resque >~ v1.19` and up and `rspec >= v2.5.0`
15
15
 
16
16
  Install
17
17
  -------
@@ -387,37 +387,38 @@ Follow me on [Github](https://github.com/leshill) and
387
387
  Contributors
388
388
  ============
389
389
 
390
- * Kenneth Kalmer (@kennethkalmer) : rspec dependency fix
391
- * Brian Cardarella (@bcardarella) : fix mutation bug
392
- * Joshua Davey (@joshdavey) : with\_resque helper
393
- * Lar Van Der Jagt (@supaspoida) : with\_resque helper
394
- * Evan Sagge (@evansagge) : Hook in via Job.create, have\_queued.in
395
- * Jon Larkowski (@l4rk) : inline perform
396
- * James Conroy-Finn (@jcf) : spec fix
397
- * Dennis Walters (@ess) : enqueue\_in support
398
- * (@RipTheJacker) : remove\_delayed support
399
- * Kurt Werle (@kwerle) : explicit require spec for v020
400
- * (@dwilkie) : initial before\_enqueue support
401
- * Marcin Balinski (@marcinb) : have\_schedule\_size\_of matcher, schedule matcher at, in
402
- * (@alexeits) : fix matcher in bug with RSpec 2.8.0
403
- * (@ToadJamb) : encode/decode of Resque job arguments
404
- * Mateusz Konikowski (@mkonikowski) : support for anything matcher
405
- * Mathieu Ravaux (@mathieuravaux) : without\_resque\_spec support
406
- * Arjan van der Gaag (@avdgaag) : peek support
407
- * (@dtsiknis) : Updated removed\_delayed
408
- * Li Ellis Gallardo (@lellisga) : fix inline/disable\_ext bug
409
- * Jeff Deville (@jeffdeville) : Resque.size
410
- * Frank Wambutt (@opinel) : Fix DST problem in `have_scheduled`
411
- * Luke Melia (@lukemelia) : Add `times` chained matcher
412
- * Pablo Fernandez (@heelhook) : Add `have_queue_size_of_at_least` and `have_schedule_size_of_at_least` matchers
413
- * (@k1w1) : Add support for enqueue\_at\_with\_queue/enqueue\_in\_with\_queue
414
- * Ozéias Sant'ana (@ozeias) : Update specs to RSpec 2.10
415
- * Yuya Kitajima (@yuyak) : Add ResqueMailer examples to README
416
- * Andrés Bravo (@andresbravog) : Replace `rspec` dependency with explicit dependencies
417
- * Ben Woosley (@Empact) : Loosen rubygems version constraint
418
- * Jeff Dickey (@dickeyxxx) : Remove 2.0 warnings, added Travis
419
- * Earle Clubb (@eclubb) : `be_queued` matcher
420
- * Erkki Eilonen (@erkki) : RSpec 3 support
390
+ * Kenneth Kalmer (@kennethkalmer) : rspec dependency fix
391
+ * Brian Cardarella (@bcardarella) : fix mutation bug
392
+ * Joshua Davey (@joshdavey) : with\_resque helper
393
+ * Lar Van Der Jagt (@supaspoida) : with\_resque helper
394
+ * Evan Sagge (@evansagge) : Hook in via Job.create, have\_queued.in
395
+ * Jon Larkowski (@l4rk) : inline perform
396
+ * James Conroy-Finn (@jcf) : spec fix
397
+ * Dennis Walters (@ess) : enqueue\_in support
398
+ * (@RipTheJacker) : remove\_delayed support
399
+ * Kurt Werle (@kwerle) : explicit require spec for v020
400
+ * (@dwilkie) : initial before\_enqueue support
401
+ * Marcin Balinski (@marcinb) : have\_schedule\_size\_of matcher, schedule matcher at, in
402
+ * (@alexeits) : fix matcher in bug with RSpec 2.8.0
403
+ * (@ToadJamb) : encode/decode of Resque job arguments
404
+ * Mateusz Konikowski (@mkonikowski) : support for anything matcher
405
+ * Mathieu Ravaux (@mathieuravaux) : without\_resque\_spec support
406
+ * Arjan van der Gaag (@avdgaag) : peek support
407
+ * (@dtsiknis) : Updated removed\_delayed
408
+ * Li Ellis Gallardo (@lellisga) : fix inline/disable\_ext bug
409
+ * Jeff Deville (@jeffdeville) : Resque.size
410
+ * Frank Wambutt (@opinel) : Fix DST problem in `have_scheduled`
411
+ * Luke Melia (@lukemelia) : Add `times` chained matcher
412
+ * Pablo Fernandez (@heelhook) : Add `have_queue_size_of_at_least` and `have_schedule_size_of_at_least` matchers
413
+ * (@k1w1) : Add support for enqueue\_at\_with\_queue/enqueue\_in\_with\_queue
414
+ * Ozéias Sant'ana (@ozeias) : Update specs to RSpec 2.10
415
+ * Yuya Kitajima (@yuyak) : Add ResqueMailer examples to README
416
+ * Andrés Bravo (@andresbravog) : Replace `rspec` dependency with explicit dependencies
417
+ * Ben Woosley (@Empact) : Loosen rubygems version constraint
418
+ * Jeff Dickey (@dickeyxxx) : Remove 2.0 warnings, added Travis
419
+ * Earle Clubb (@eclubb) : `be_queued` matcher
420
+ * Erkki Eilonen (@erkki) : RSpec 3 support
421
+ * Gavin Heavyside (@gavinheavyside) : RSpec three warnings
421
422
 
422
423
  Copyright
423
424
  =========
@@ -2,7 +2,18 @@ require 'rspec/core'
2
2
  require 'rspec/expectations'
3
3
  require 'rspec/mocks'
4
4
 
5
+ module ArgsHelper
6
+ private
7
+
8
+ def match_args(expected_args, args)
9
+ arg_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(expected_args)
10
+ arg_list_matcher.args_match?(args)
11
+ end
12
+ end
13
+
5
14
  module InQueueHelper
15
+ include ArgsHelper
16
+
6
17
  def self.included(klass)
7
18
  klass.class_eval do
8
19
  attr_accessor :queue_name
@@ -21,7 +32,6 @@ module InQueueHelper
21
32
  ResqueSpec.queue_for(actual)
22
33
  end
23
34
  end
24
-
25
35
  end
26
36
 
27
37
  RSpec::Matchers.define :be_queued do |*expected_args|
@@ -41,7 +51,7 @@ RSpec::Matchers.define :be_queued do |*expected_args|
41
51
  matched = queue(actual).select do |entry|
42
52
  klass = entry.fetch(:class)
43
53
  args = entry.fetch(:args)
44
- klass.to_s == actual.to_s && expected_args == args
54
+ klass.to_s == actual.to_s && match_args(expected_args, args)
45
55
  end
46
56
 
47
57
  if @times
@@ -51,17 +61,18 @@ RSpec::Matchers.define :be_queued do |*expected_args|
51
61
  end
52
62
  end
53
63
 
54
- failure_message_for_should do |actual|
64
+ failure_message do |actual|
55
65
  "expected that #{actual} would be queued with [#{expected_args.join(', ')}]#{@times_info}"
56
66
  end
57
67
 
58
- failure_message_for_should_not do |actual|
68
+ failure_message_when_negated do |actual|
59
69
  "expected that #{actual} would not be queued with [#{expected_args.join(', ')}]#{@times_info}"
60
70
  end
61
71
 
62
72
  description do
63
73
  "be queued with arguments of [#{expected_args.join(', ')}]#{@times_info}"
64
74
  end
75
+
65
76
  end
66
77
 
67
78
  RSpec::Matchers.define :have_queued do |*expected_args|
@@ -81,7 +92,7 @@ RSpec::Matchers.define :have_queued do |*expected_args|
81
92
  matched = queue(actual).select do |entry|
82
93
  klass = entry.fetch(:class)
83
94
  args = entry.fetch(:args)
84
- klass.to_s == actual.to_s && expected_args == args
95
+ klass.to_s == actual.to_s && match_args(expected_args, args)
85
96
  end
86
97
 
87
98
  if @times
@@ -91,11 +102,11 @@ RSpec::Matchers.define :have_queued do |*expected_args|
91
102
  end
92
103
  end
93
104
 
94
- failure_message_for_should do |actual|
105
+ failure_message do |actual|
95
106
  "expected that #{actual} would have [#{expected_args.join(', ')}] queued#{@times_info}"
96
107
  end
97
108
 
98
- failure_message_for_should_not do |actual|
109
+ failure_message_when_negated do |actual|
99
110
  "expected that #{actual} would not have [#{expected_args.join(', ')}] queued#{@times_info}"
100
111
  end
101
112
 
@@ -111,11 +122,11 @@ RSpec::Matchers.define :have_queue_size_of do |size|
111
122
  queue(actual).size == size
112
123
  end
113
124
 
114
- failure_message_for_should do |actual|
125
+ failure_message do |actual|
115
126
  "expected that #{actual} would have #{size} entries queued, but got #{queue(actual).size} instead"
116
127
  end
117
128
 
118
- failure_message_for_should_not do |actual|
129
+ failure_message_when_negated do |actual|
119
130
  "expected that #{actual} would not have #{size} entries queued, but got #{queue(actual).size} instead"
120
131
  end
121
132
 
@@ -131,11 +142,11 @@ RSpec::Matchers.define :have_queue_size_of_at_least do |size|
131
142
  queue(actual).size >= size
132
143
  end
133
144
 
134
- failure_message_for_should do |actual|
145
+ failure_message do |actual|
135
146
  "expected that #{actual} would have at least #{size} entries queued, but got #{queue(actual).size} instead"
136
147
  end
137
148
 
138
- failure_message_for_should_not do |actual|
149
+ failure_message_when_negated do |actual|
139
150
  "expected that #{actual} would not have at least #{size} entries queued, but got #{queue(actual).size} instead"
140
151
  end
141
152
 
@@ -145,6 +156,8 @@ RSpec::Matchers.define :have_queue_size_of_at_least do |size|
145
156
  end
146
157
 
147
158
  module ScheduleQueueHelper
159
+ include ArgsHelper
160
+
148
161
  def self.included(klass)
149
162
  klass.class_eval do
150
163
  attr_accessor :queue_name
@@ -184,7 +197,7 @@ RSpec::Matchers.define :have_scheduled do |*expected_args|
184
197
  match do |actual|
185
198
  schedule_queue_for(actual).any? do |entry|
186
199
  class_matches = entry[:class].to_s == actual.to_s
187
- args_match = expected_args == entry[:args]
200
+ args_match = match_args(expected_args, entry[:args])
188
201
 
189
202
  time_matches = if @time
190
203
  entry[:time] == @time
@@ -198,11 +211,11 @@ RSpec::Matchers.define :have_scheduled do |*expected_args|
198
211
  end
199
212
  end
200
213
 
201
- failure_message_for_should do |actual|
214
+ failure_message do |actual|
202
215
  ["expected that #{actual} would have [#{expected_args.join(', ')}] scheduled", @time_info].join(' ')
203
216
  end
204
217
 
205
- failure_message_for_should_not do |actual|
218
+ failure_message_when_negated do |actual|
206
219
  ["expected that #{actual} would not have [#{expected_args.join(', ')}] scheduled", @time_info].join(' ')
207
220
  end
208
221
 
@@ -218,14 +231,14 @@ RSpec::Matchers.define :have_scheduled_at do |*expected_args|
218
231
  match do |actual|
219
232
  time = expected_args.first
220
233
  other_args = expected_args[1..-1]
221
- schedule_queue_for(actual).any? { |entry| entry[:class].to_s == actual.to_s && entry[:time] == time && other_args == entry[:args] }
234
+ schedule_queue_for(actual).any? { |entry| entry[:class].to_s == actual.to_s && entry[:time] == time && match_args(other_args, entry[:args]) }
222
235
  end
223
236
 
224
- failure_message_for_should do |actual|
237
+ failure_message do |actual|
225
238
  "expected that #{actual} would have [#{expected_args.join(', ')}] scheduled"
226
239
  end
227
240
 
228
- failure_message_for_should_not do |actual|
241
+ failure_message_when_negated do |actual|
229
242
  "expected that #{actual} would not have [#{expected_args.join(', ')}] scheduled"
230
243
  end
231
244
 
@@ -241,11 +254,11 @@ RSpec::Matchers.define :have_schedule_size_of do |size|
241
254
  schedule_queue_for(actual).size == size
242
255
  end
243
256
 
244
- failure_message_for_should do |actual|
257
+ failure_message do |actual|
245
258
  "expected that #{actual} would have #{size} scheduled entries, but got #{schedule_queue_for(actual).size} instead"
246
259
  end
247
260
 
248
- failure_message_for_should_not do |actual|
261
+ failure_message_when_negated do |actual|
249
262
  "expected that #{actual} would have #{size} scheduled entries."
250
263
  end
251
264
 
@@ -261,11 +274,11 @@ RSpec::Matchers.define :have_schedule_size_of_at_least do |size|
261
274
  schedule_queue_for(actual).size >= size
262
275
  end
263
276
 
264
- failure_message_for_should do |actual|
277
+ failure_message do |actual|
265
278
  "expected that #{actual} would have at least #{size} scheduled entries, but got #{schedule_queue_for(actual).size} instead"
266
279
  end
267
280
 
268
- failure_message_for_should_not do |actual|
281
+ failure_message_when_negated do |actual|
269
282
  "expected that #{actual} would have at least #{size} scheduled entries."
270
283
  end
271
284
 
@@ -1,3 +1,3 @@
1
1
  module ResqueSpec
2
- VERSION = "0.15.0"
2
+ VERSION = "0.16.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.15.0
4
+ version: 0.16.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: 2014-02-02 00:00:00.000000000 Z
12
+ date: 2014-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: resque
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 2.5.0
37
+ version: 3.0.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 2.5.0
45
+ version: 3.0.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rspec-expectations
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: 2.5.0
53
+ version: 3.0.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 2.5.0
61
+ version: 3.0.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rspec-mocks
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
- version: 2.5.0
69
+ version: 3.0.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
- version: 2.5.0
77
+ version: 3.0.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: resque-scheduler
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -162,7 +162,7 @@ dependencies:
162
162
  requirements:
163
163
  - - ! '>='
164
164
  - !ruby/object:Gem::Version
165
- version: 2.10.0
165
+ version: 3.0.0
166
166
  type: :development
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
@@ -170,7 +170,7 @@ dependencies:
170
170
  requirements:
171
171
  - - ! '>='
172
172
  - !ruby/object:Gem::Version
173
- version: 2.10.0
173
+ version: 3.0.0
174
174
  description: RSpec matchers for Resque
175
175
  email: leshill@gmail.com
176
176
  executables: []