rspec-sidekiq 5.0.0 → 5.2.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 +4 -4
- data/CHANGES.md +15 -0
- data/README.md +55 -8
- data/lib/rspec/sidekiq/batch.rb +7 -4
- data/lib/rspec/sidekiq/configuration.rb +6 -0
- data/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb +5 -3
- data/lib/rspec/sidekiq/helpers.rb +3 -1
- data/lib/rspec/sidekiq/matchers/base.rb +51 -20
- data/lib/rspec/sidekiq/matchers/be_delayed.rb +2 -0
- data/lib/rspec/sidekiq/matchers/be_expired_in.rb +3 -1
- data/lib/rspec/sidekiq/matchers/be_processed_in.rb +2 -0
- data/lib/rspec/sidekiq/matchers/be_retryable.rb +2 -0
- data/lib/rspec/sidekiq/matchers/be_unique.rb +29 -3
- data/lib/rspec/sidekiq/matchers/enqueue_sidekiq_job.rb +5 -4
- data/lib/rspec/sidekiq/matchers/have_enqueued_sidekiq_job.rb +2 -0
- data/lib/rspec/sidekiq/matchers/save_backtrace.rb +2 -0
- data/lib/rspec/sidekiq/matchers.rb +11 -9
- data/lib/rspec/sidekiq/sidekiq.rb +2 -0
- data/lib/rspec/sidekiq/version.rb +3 -1
- data/lib/rspec-sidekiq.rb +7 -5
- metadata +21 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47fe73bb71c8962a243f7128bffe68ce0ec5a4c644f1e1bb597723980af806b0
|
4
|
+
data.tar.gz: 0fdfbac81db581526c48fb58741e56eaee011507235538df4a48a66584477c74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01a72c5aa64da2033f4efc53000fd52241d120d8c761dd095272b6111807d99ae50746428c5a222c670a8ff573b39a911faeb1a0b3e21b93bfedaa8068f60ec6
|
7
|
+
data.tar.gz: 6d052d8dd15a05a002cbc30a26e81aa61621cc9c8e8ec1789e4b6fdb7174cb74727c81baf9cdbf1727eed951f18b65397718800f90d5adfc067dc5a6d803844f
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
Unreleased
|
2
2
|
---
|
3
3
|
|
4
|
+
5.2.0
|
5
|
+
---
|
6
|
+
* Add `never` matcher for aliasing `exactly(0)` (#256)
|
7
|
+
* Fix BeProcessedIn matcher behavior for Rails 8 (#237)
|
8
|
+
* Fix `exactly(0)` to not fail when nothing is enqueued (#238)
|
9
|
+
|
10
|
+
5.1.0
|
11
|
+
---
|
12
|
+
* Add `until` matcher for Sidekiq Enterprise unique jobs (#232, #147)
|
13
|
+
* Add `with_context` matcher for matching against job contexts (#222)
|
14
|
+
* Support for Sidekiq 8 (#233)
|
15
|
+
* Add `frozen_string_literal: true` (#220)
|
16
|
+
* Fix queue always nil in default_retries_exhausted_message (#229)
|
17
|
+
* Fix pattern matching warnings on Ruby 2.7 (#227)
|
18
|
+
|
4
19
|
5.0.0
|
5
20
|
---
|
6
21
|
* [BREAKING] Make `have_enqueued_sidekiq_job()` match jobs with any arguments (same as `enqueue_sidekiq_job()` or `have_enqueued_sidekiq_job(any_args)`) (#215)
|
data/README.md
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
**Welcome @wspurgin as new maintainer for `rspec-sidekiq`!**
|
2
|
-
|
3
1
|
[](https://badge.fury.io/rb/rspec-sidekiq)
|
4
2
|
[![Github Actions CI][github_actions_badge]][github_actions]
|
5
3
|
|
@@ -72,6 +70,9 @@ end
|
|
72
70
|
|
73
71
|
# A specific number of times
|
74
72
|
|
73
|
+
expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.never
|
74
|
+
expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.exactly(0)
|
75
|
+
expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.exactly(0).time
|
75
76
|
expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.once
|
76
77
|
expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.exactly(1).time
|
77
78
|
expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.exactly(:once)
|
@@ -81,6 +82,17 @@ expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.at_most(2).times
|
|
81
82
|
expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.at_most(:twice)
|
82
83
|
expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.at_most(:thrice)
|
83
84
|
|
85
|
+
# With specific context:
|
86
|
+
# Useful for testing anything `set` on the job, including
|
87
|
+
# overrides to things like `retry`
|
88
|
+
expect {
|
89
|
+
AwesomeJob.set(trace_id: "something").perform_async
|
90
|
+
}.to enqueue_sidekiq_job.with_context(trace_id: anything)
|
91
|
+
|
92
|
+
expect {
|
93
|
+
AwesomeJob.set(retry: 5).perform_async
|
94
|
+
}.to enqueue_sidekiq_job.with_context(retry: 5)
|
95
|
+
|
84
96
|
# Combine and chain them as desired
|
85
97
|
expect { AwesomeJob.perform_at(specific_time, "Awesome!") }.to(
|
86
98
|
enqueue_sidekiq_job(AwesomeJob)
|
@@ -133,6 +145,13 @@ expect(AwesomeJob).to have_enqueued_sidekiq_job.at_most(:twice)
|
|
133
145
|
expect(AwesomeJob).to have_enqueued_sidekiq_job.at_most(:thrice)
|
134
146
|
```
|
135
147
|
|
148
|
+
Likewise, specify what should be in the context:
|
149
|
+
```ruby
|
150
|
+
AwesomeJob.set(trace_id: "something").perform_async
|
151
|
+
|
152
|
+
expect(AwesomeJob).to have_enqueued_sidekiq_job.with_context(trace_id: anything)
|
153
|
+
```
|
154
|
+
|
136
155
|
#### Testing scheduled jobs
|
137
156
|
|
138
157
|
*Use chainable matchers `#at`, `#in` and `#immediately`*
|
@@ -204,6 +223,10 @@ it { is_expected.to be_processed_in :download }
|
|
204
223
|
|
205
224
|
### ```be_retryable```
|
206
225
|
*Describes if a job should retry when there is a failure in its execution*
|
226
|
+
|
227
|
+
Note: this only tests against the `retry` option in the job's Sidekiq options.
|
228
|
+
To test an enqueued job's retry, i.e. `AwesomeJob.set(retry: 5)`, use
|
229
|
+
`with_context`
|
207
230
|
```ruby
|
208
231
|
sidekiq_options retry: 5
|
209
232
|
# test with...
|
@@ -235,14 +258,33 @@ it { is_expected.to save_backtrace false }
|
|
235
258
|
```
|
236
259
|
|
237
260
|
### ```be_unique```
|
261
|
+
|
262
|
+
:warning: This is intended to for Sidekiq Enterprise unique job implementation.
|
263
|
+
There is _limited_ support for Sidekiq Unique Jobs, but compatibility is not
|
264
|
+
guaranteed.
|
265
|
+
|
238
266
|
*Describes when a job should be unique within its queue*
|
239
267
|
```ruby
|
240
|
-
sidekiq_options
|
268
|
+
sidekiq_options unique_for: 1.hour
|
241
269
|
# test with...
|
242
270
|
expect(AwesomeJob).to be_unique
|
243
271
|
it { is_expected.to be_unique }
|
272
|
+
|
273
|
+
# specify a specific interval
|
274
|
+
sidekiq_options unique_for: 1.hour
|
275
|
+
it { is_expected.to be_unique.for(1.hour) }
|
244
276
|
```
|
245
277
|
|
278
|
+
#### `until` sub-matcher
|
279
|
+
|
280
|
+
:warning: This sub-matcher only works for Sidekiq Enterprise
|
281
|
+
|
282
|
+
```ruby
|
283
|
+
sidekiq_options unique_for: 1.hour, unique_until: :start
|
284
|
+
it { is_expected.to be_unique.until(:start) }
|
285
|
+
```
|
286
|
+
|
287
|
+
|
246
288
|
### ```be_expired_in```
|
247
289
|
*Describes when a job should expire*
|
248
290
|
```ruby
|
@@ -345,26 +387,31 @@ FooClass.within_sidekiq_retries_exhausted_block {
|
|
345
387
|
|
346
388
|
## Testing
|
347
389
|
```
|
348
|
-
bundle exec rspec
|
390
|
+
bundle exec rspec
|
349
391
|
```
|
350
392
|
|
351
393
|
## Maintainers
|
352
|
-
* @wspurgin
|
394
|
+
* [@wspurgin]
|
395
|
+
* [@ydah]
|
353
396
|
|
354
397
|
### Alumni
|
355
398
|
|
356
|
-
* @packrat386
|
357
|
-
* @philostler
|
399
|
+
* [@packrat386]
|
400
|
+
* [@philostler]
|
358
401
|
|
359
402
|
## Contribute
|
360
403
|
Please do! If there's a feature missing that you'd love to see then get in on the action!
|
361
404
|
|
362
405
|
Issues/Pull Requests/Comments all welcome...
|
363
406
|
|
364
|
-
[github]: http://github.com/wspurgin/rspec-sidekiq
|
365
407
|
[github_actions]: https://github.com/wspurgin/rspec-sidekiq/actions
|
366
408
|
[github_actions_badge]: https://github.com/wspurgin/rspec-sidekiq/actions/workflows/main.yml/badge.svg
|
367
409
|
|
368
410
|
[rspec_sidekiq_wiki_faq_&_troubleshooting]: https://github.com/wspurgin/rspec-sidekiq/wiki/FAQ-&-Troubleshooting
|
369
411
|
[sidekiq_wiki_batches]: https://github.com/sidekiq/sidekiq/wiki/Batches
|
370
412
|
[sidekiq_wiki_delayed_extensions]: https://github.com/sidekiq/sidekiq/wiki/Delayed-Extensions
|
413
|
+
|
414
|
+
[@wspurgin]: https://github.com/wspurgin
|
415
|
+
[@ydah]: https://github.com/ydah
|
416
|
+
[@packrat386]: https://github.com/packrat386
|
417
|
+
[@philostler]: https://github.com/philostler
|
data/lib/rspec/sidekiq/batch.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rspec/core"
|
4
|
+
require "rspec/support/fuzzy_matcher"
|
2
5
|
|
3
6
|
if defined? Sidekiq::Batch
|
4
7
|
module RSpec
|
@@ -11,7 +14,7 @@ if defined? Sidekiq::Batch
|
|
11
14
|
|
12
15
|
##
|
13
16
|
# Sidekiq::Batch is a Sidekiq::Pro feature. However the general consensus is
|
14
|
-
# that, by
|
17
|
+
# that, by default, you can't test without redis. RSpec::Sidekiq includes
|
15
18
|
# a "null object" pattern implementation to mock Batches. This will mock
|
16
19
|
# Sidekiq::Batch and prevent it from using Redis.
|
17
20
|
#
|
@@ -94,8 +97,8 @@ if defined? Sidekiq::Batch
|
|
94
97
|
if mocked_with_mocha?
|
95
98
|
Sidekiq::Batch.stubs(:new) { RSpec::Sidekiq::NullBatch.new }
|
96
99
|
else
|
97
|
-
allow(Sidekiq::Batch).to receive(:new)
|
98
|
-
allow(Sidekiq::Batch::Status).to receive(:new)
|
100
|
+
allow(Sidekiq::Batch).to receive(:new) { RSpec::Sidekiq::NullBatch.new }
|
101
|
+
allow(Sidekiq::Batch::Status).to receive(:new) { RSpec::Sidekiq::NullStatus.new }
|
99
102
|
end
|
100
103
|
end
|
101
104
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "rubygems"
|
2
4
|
require "set"
|
3
5
|
|
@@ -22,6 +24,10 @@ module RSpec
|
|
22
24
|
Gem::Version.new(::Sidekiq::VERSION) >= Gem::Version.new("7.0.0")
|
23
25
|
end
|
24
26
|
|
27
|
+
def sidekiq_gte_8?
|
28
|
+
Gem::Version.new(::Sidekiq::VERSION) >= Gem::Version.new("8.0.0")
|
29
|
+
end
|
30
|
+
|
25
31
|
def silence_warning(symbol)
|
26
32
|
@silence_warnings << symbol
|
27
33
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Sidekiq
|
2
4
|
module Worker
|
3
5
|
module ClassMethods
|
@@ -8,15 +10,15 @@ module Sidekiq
|
|
8
10
|
|
9
11
|
def default_retries_exhausted_message
|
10
12
|
{
|
11
|
-
'queue' => get_sidekiq_options[
|
13
|
+
'queue' => get_sidekiq_options['queue'],
|
12
14
|
'class' => name,
|
13
15
|
'args' => [],
|
14
|
-
'error_message' => 'An error
|
16
|
+
'error_message' => 'An error occurred'
|
15
17
|
}
|
16
18
|
end
|
17
19
|
|
18
20
|
def default_retries_exhausted_exception
|
19
|
-
StandardError.new('An error
|
21
|
+
StandardError.new('An error occurred')
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RSpec
|
2
4
|
module Sidekiq
|
3
5
|
module Matchers
|
@@ -26,7 +28,7 @@ module RSpec
|
|
26
28
|
# send to custom evaluator
|
27
29
|
at_evaluator(value)
|
28
30
|
else
|
29
|
-
job.context.has_key?(key) && job.context[key]
|
31
|
+
job.context.has_key?(key) && RSpec::Support::FuzzyMatcher.values_match?(value, job.context[key])
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -58,7 +60,11 @@ module RSpec
|
|
58
60
|
private
|
59
61
|
|
60
62
|
def active_job?
|
61
|
-
|
63
|
+
if RSpec::Sidekiq.configuration.sidekiq_gte_8?
|
64
|
+
job["class"] == "Sidekiq::ActiveJob::Wrapper"
|
65
|
+
else
|
66
|
+
job["class"] == "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"
|
67
|
+
end
|
62
68
|
end
|
63
69
|
|
64
70
|
def deserialized_active_job_args
|
@@ -121,13 +127,13 @@ module RSpec
|
|
121
127
|
def includes?(arguments, options, count)
|
122
128
|
matching = jobs.filter { |job| matches?(job, arguments, options) }
|
123
129
|
|
124
|
-
case count
|
125
|
-
|
126
|
-
matching.size ==
|
127
|
-
|
128
|
-
matching.size >=
|
129
|
-
|
130
|
-
matching.size <=
|
130
|
+
case count[0]
|
131
|
+
when :exactly
|
132
|
+
matching.size == count[1]
|
133
|
+
when :at_least
|
134
|
+
matching.size >= count[1]
|
135
|
+
when :at_most
|
136
|
+
matching.size <= count[1]
|
131
137
|
else
|
132
138
|
matching.size > 0
|
133
139
|
end
|
@@ -138,7 +144,7 @@ module RSpec
|
|
138
144
|
end
|
139
145
|
|
140
146
|
def minus!(other)
|
141
|
-
self unless other.is_a?(EnqueuedJobs)
|
147
|
+
return self unless other.is_a?(EnqueuedJobs)
|
142
148
|
|
143
149
|
@jobs -= other.jobs
|
144
150
|
|
@@ -208,6 +214,11 @@ module RSpec
|
|
208
214
|
self
|
209
215
|
end
|
210
216
|
|
217
|
+
def never
|
218
|
+
set_expected_count :exactly, 0
|
219
|
+
self
|
220
|
+
end
|
221
|
+
|
211
222
|
def once
|
212
223
|
set_expected_count :exactly, 1
|
213
224
|
self
|
@@ -243,6 +254,26 @@ module RSpec
|
|
243
254
|
end
|
244
255
|
alias :time :times
|
245
256
|
|
257
|
+
def with_context(**kwargs)
|
258
|
+
raise ArgumentError, "Must specify keyword arguments to with_context" if kwargs.empty?
|
259
|
+
|
260
|
+
# gather keys and compare against currently set expected_options
|
261
|
+
# Someone could have accidentally used with_context and other
|
262
|
+
# chainables with different expectations. Better to explicitly
|
263
|
+
# inform loudly of clashes than let them overwrite silently
|
264
|
+
normalized = normalize_arguments(kwargs)
|
265
|
+
already_set = normalized.keys & @expected_options.keys
|
266
|
+
if already_set.any?
|
267
|
+
prettied = already_set.map { |key| "'#{key}'" }
|
268
|
+
raise ArgumentError, "There are already expectations against #{prettied.join(",")}. Did you already call other context chainables like `on` or `at`?"
|
269
|
+
end
|
270
|
+
|
271
|
+
# We're good, no accidental overwrites of expectations
|
272
|
+
@expected_options.merge!(normalized)
|
273
|
+
|
274
|
+
self
|
275
|
+
end
|
276
|
+
|
246
277
|
def set_expected_count(relativity, n)
|
247
278
|
n =
|
248
279
|
case n
|
@@ -275,13 +306,13 @@ module RSpec
|
|
275
306
|
message << "but enqueued only jobs"
|
276
307
|
if expected_arguments
|
277
308
|
job_messages = actual_jobs.map do |job|
|
278
|
-
base = " -JID:#{job.jid} with arguments:"
|
279
|
-
base << "
|
309
|
+
base = [" -JID:#{job.jid} with arguments:"]
|
310
|
+
base << " -#{formatted(job.args)}"
|
280
311
|
if expected_options.any?
|
281
|
-
base << "
|
312
|
+
base << " with context: #{formatted(job.context)}"
|
282
313
|
end
|
283
314
|
|
284
|
-
base
|
315
|
+
base.join("\n")
|
285
316
|
end
|
286
317
|
|
287
318
|
message << job_messages.join("\n")
|
@@ -302,13 +333,13 @@ module RSpec
|
|
302
333
|
end
|
303
334
|
|
304
335
|
def count_message
|
305
|
-
case expected_count
|
306
|
-
|
336
|
+
case expected_count[0]
|
337
|
+
when :positive
|
307
338
|
"a"
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
"#{
|
339
|
+
when :exactly
|
340
|
+
expected_count[1]
|
341
|
+
else
|
342
|
+
"#{expected_count[0].to_s.gsub('_', ' ')} #{expected_count[1]}"
|
312
343
|
end
|
313
344
|
end
|
314
345
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RSpec
|
2
4
|
module Sidekiq
|
3
5
|
module Matchers
|
@@ -23,8 +25,11 @@ module RSpec
|
|
23
25
|
|
24
26
|
def failure_message
|
25
27
|
if !interval_matches? && @expected_interval
|
26
|
-
"expected #{@klass} to be unique for #{@expected_interval} seconds, "\
|
28
|
+
"expected #{@klass} to be unique for #{@expected_interval} seconds, " \
|
27
29
|
"but its interval was #{actual_interval} seconds"
|
30
|
+
elsif !expiration_matches?
|
31
|
+
"expected #{@klass} to be unique until #{@expected_expiration}, " \
|
32
|
+
"but its unique_until was #{actual_expiration || 'not specified'}"
|
28
33
|
else
|
29
34
|
"expected #{@klass} to be unique in the queue"
|
30
35
|
end
|
@@ -33,7 +38,7 @@ module RSpec
|
|
33
38
|
def matches?(job)
|
34
39
|
@klass = job.is_a?(Class) ? job : job.class
|
35
40
|
@actual = @klass.get_sidekiq_options[unique_key]
|
36
|
-
|
41
|
+
value_matches? && interval_matches? && expiration_matches?
|
37
42
|
end
|
38
43
|
|
39
44
|
def for(interval)
|
@@ -41,6 +46,11 @@ module RSpec
|
|
41
46
|
self
|
42
47
|
end
|
43
48
|
|
49
|
+
def until(expiration)
|
50
|
+
@expected_expiration = expiration
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
44
54
|
def interval_specified?
|
45
55
|
@expected_interval
|
46
56
|
end
|
@@ -49,6 +59,10 @@ module RSpec
|
|
49
59
|
!interval_specified? || actual_interval == @expected_interval
|
50
60
|
end
|
51
61
|
|
62
|
+
def expiration_matches?
|
63
|
+
@expected_expiration.nil? || actual_expiration == @expected_expiration
|
64
|
+
end
|
65
|
+
|
52
66
|
def failure_message_when_negated
|
53
67
|
"expected #{@klass} to not be unique in the queue"
|
54
68
|
end
|
@@ -59,6 +73,10 @@ module RSpec
|
|
59
73
|
@klass.get_sidekiq_options['unique_job_expiration']
|
60
74
|
end
|
61
75
|
|
76
|
+
def actual_expiration
|
77
|
+
fail 'until is not supported for SidekiqUniqueJobs'
|
78
|
+
end
|
79
|
+
|
62
80
|
def value_matches?
|
63
81
|
[true, :all].include?(@actual)
|
64
82
|
end
|
@@ -73,8 +91,16 @@ module RSpec
|
|
73
91
|
@actual
|
74
92
|
end
|
75
93
|
|
94
|
+
def actual_expiration
|
95
|
+
@klass.get_sidekiq_options['unique_until']
|
96
|
+
end
|
97
|
+
|
76
98
|
def value_matches?
|
77
|
-
|
99
|
+
unless @actual
|
100
|
+
false
|
101
|
+
else
|
102
|
+
@actual > 0
|
103
|
+
end
|
78
104
|
end
|
79
105
|
|
80
106
|
def unique_key
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RSpec
|
2
4
|
module Sidekiq
|
3
5
|
module Matchers
|
@@ -23,10 +25,6 @@ module RSpec
|
|
23
25
|
proc.call
|
24
26
|
@actual_jobs = EnqueuedJobs.new(@klass).minus!(original_jobs)
|
25
27
|
|
26
|
-
if @actual_jobs.none?
|
27
|
-
return false
|
28
|
-
end
|
29
|
-
|
30
28
|
@actual_jobs.includes?(expected_arguments, expected_options, expected_count)
|
31
29
|
end
|
32
30
|
|
@@ -72,6 +70,9 @@ module RSpec
|
|
72
70
|
# expect { AwesomeJob.perform_async }.to enqueue_sidekiq_job.immediately
|
73
71
|
# expect { AwesomeJob.perform_at(1.hour.ago) }.to enqueue_sidekiq_job.immediately
|
74
72
|
#
|
73
|
+
# # With specific context
|
74
|
+
# expect { AwesomeJob.set(trace_id: "something").perform_async }.to enqueue_sidekiq_job.with_context(trace_id: anything)
|
75
|
+
#
|
75
76
|
# ## Composable
|
76
77
|
#
|
77
78
|
# expect do
|
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "rspec/core"
|
2
4
|
require "rspec/matchers"
|
3
5
|
require "rspec/mocks/argument_list_matcher"
|
4
6
|
require "rspec/mocks/argument_matchers"
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
require_relative "matchers/base"
|
9
|
+
require_relative "matchers/be_delayed"
|
10
|
+
require_relative "matchers/be_expired_in"
|
11
|
+
require_relative "matchers/be_processed_in"
|
12
|
+
require_relative "matchers/be_retryable"
|
13
|
+
require_relative "matchers/be_unique"
|
14
|
+
require_relative "matchers/have_enqueued_sidekiq_job"
|
15
|
+
require_relative "matchers/save_backtrace"
|
16
|
+
require_relative "matchers/enqueue_sidekiq_job"
|
15
17
|
|
16
18
|
RSpec.configure do |config|
|
17
19
|
config.include RSpec::Sidekiq::Matchers
|
data/lib/rspec-sidekiq.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'forwardable'
|
2
4
|
|
3
5
|
require 'sidekiq'
|
4
6
|
require 'sidekiq/testing'
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
require_relative 'rspec/sidekiq/batch'
|
9
|
+
require_relative 'rspec/sidekiq/configuration'
|
10
|
+
require_relative 'rspec/sidekiq/helpers'
|
11
|
+
require_relative 'rspec/sidekiq/matchers'
|
12
|
+
require_relative 'rspec/sidekiq/sidekiq'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aidan Coyle
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-07-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec-core
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '3.0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name: rspec-
|
30
|
+
name: rspec-expectations
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '3.0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
|
-
name: rspec-
|
44
|
+
name: rspec-mocks
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
@@ -63,7 +63,7 @@ dependencies:
|
|
63
63
|
version: '5'
|
64
64
|
- - "<"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '9'
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -73,37 +73,9 @@ dependencies:
|
|
73
73
|
version: '5'
|
74
74
|
- - "<"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
77
|
-
- !ruby/object:Gem::Dependency
|
78
|
-
name: pry
|
79
|
-
requirement: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
|
-
type: :development
|
85
|
-
prerelease: false
|
86
|
-
version_requirements: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
- !ruby/object:Gem::Dependency
|
92
|
-
name: pry-doc
|
93
|
-
requirement: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
type: :development
|
99
|
-
prerelease: false
|
100
|
-
version_requirements: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
76
|
+
version: '9'
|
105
77
|
- !ruby/object:Gem::Dependency
|
106
|
-
name:
|
78
|
+
name: actionmailer
|
107
79
|
requirement: !ruby/object:Gem::Requirement
|
108
80
|
requirements:
|
109
81
|
- - ">="
|
@@ -117,7 +89,7 @@ dependencies:
|
|
117
89
|
- !ruby/object:Gem::Version
|
118
90
|
version: '0'
|
119
91
|
- !ruby/object:Gem::Dependency
|
120
|
-
name:
|
92
|
+
name: activejob
|
121
93
|
requirement: !ruby/object:Gem::Requirement
|
122
94
|
requirements:
|
123
95
|
- - ">="
|
@@ -131,7 +103,7 @@ dependencies:
|
|
131
103
|
- !ruby/object:Gem::Version
|
132
104
|
version: '0'
|
133
105
|
- !ruby/object:Gem::Dependency
|
134
|
-
name:
|
106
|
+
name: activemodel
|
135
107
|
requirement: !ruby/object:Gem::Requirement
|
136
108
|
requirements:
|
137
109
|
- - ">="
|
@@ -145,7 +117,7 @@ dependencies:
|
|
145
117
|
- !ruby/object:Gem::Version
|
146
118
|
version: '0'
|
147
119
|
- !ruby/object:Gem::Dependency
|
148
|
-
name:
|
120
|
+
name: activerecord
|
149
121
|
requirement: !ruby/object:Gem::Requirement
|
150
122
|
requirements:
|
151
123
|
- - ">="
|
@@ -159,7 +131,7 @@ dependencies:
|
|
159
131
|
- !ruby/object:Gem::Version
|
160
132
|
version: '0'
|
161
133
|
- !ruby/object:Gem::Dependency
|
162
|
-
name:
|
134
|
+
name: activesupport
|
163
135
|
requirement: !ruby/object:Gem::Requirement
|
164
136
|
requirements:
|
165
137
|
- - ">="
|
@@ -173,7 +145,7 @@ dependencies:
|
|
173
145
|
- !ruby/object:Gem::Version
|
174
146
|
version: '0'
|
175
147
|
- !ruby/object:Gem::Dependency
|
176
|
-
name:
|
148
|
+
name: debug
|
177
149
|
requirement: !ruby/object:Gem::Requirement
|
178
150
|
requirements:
|
179
151
|
- - ">="
|
@@ -187,7 +159,7 @@ dependencies:
|
|
187
159
|
- !ruby/object:Gem::Version
|
188
160
|
version: '0'
|
189
161
|
- !ruby/object:Gem::Dependency
|
190
|
-
name:
|
162
|
+
name: ostruct
|
191
163
|
requirement: !ruby/object:Gem::Requirement
|
192
164
|
requirements:
|
193
165
|
- - ">="
|
@@ -201,7 +173,7 @@ dependencies:
|
|
201
173
|
- !ruby/object:Gem::Version
|
202
174
|
version: '0'
|
203
175
|
- !ruby/object:Gem::Dependency
|
204
|
-
name:
|
176
|
+
name: railties
|
205
177
|
requirement: !ruby/object:Gem::Requirement
|
206
178
|
requirements:
|
207
179
|
- - ">="
|
@@ -215,7 +187,7 @@ dependencies:
|
|
215
187
|
- !ruby/object:Gem::Version
|
216
188
|
version: '0'
|
217
189
|
- !ruby/object:Gem::Dependency
|
218
|
-
name:
|
190
|
+
name: rspec
|
219
191
|
requirement: !ruby/object:Gem::Requirement
|
220
192
|
requirements:
|
221
193
|
- - ">="
|
@@ -257,7 +229,11 @@ files:
|
|
257
229
|
homepage: http://github.com/wspurgin/rspec-sidekiq
|
258
230
|
licenses:
|
259
231
|
- MIT
|
260
|
-
metadata:
|
232
|
+
metadata:
|
233
|
+
homepage_uri: http://github.com/wspurgin/rspec-sidekiq
|
234
|
+
source_code_uri: http://github.com/wspurgin/rspec-sidekiq
|
235
|
+
changelog_uri: http://github.com/wspurgin/rspec-sidekiq/blob/main/CHANGES.md
|
236
|
+
bug_tracker_uri: http://github.com/wspurgin/rspec-sidekiq/issues
|
261
237
|
post_install_message:
|
262
238
|
rdoc_options: []
|
263
239
|
require_paths:
|
@@ -273,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
249
|
- !ruby/object:Gem::Version
|
274
250
|
version: '0'
|
275
251
|
requirements: []
|
276
|
-
rubygems_version: 3.
|
252
|
+
rubygems_version: 3.5.22
|
277
253
|
signing_key:
|
278
254
|
specification_version: 4
|
279
255
|
summary: RSpec for Sidekiq
|