Closed chrismaximin closed 1 year ago
Thanks @chrismaximin Could you clarify the first statement though?
There is currently no way to check whether a job was scheduled for some point in the future or enqueued immediately.
This statement, on first read, is not true. You can absolutely test that something was enqueued for the future...
I'm not against adding an explicit "no wait" option to the matcher - in other words testing, explicitly, that no delay was specified when enqueuing.
Could you add specs to enqueue_sidekiq_job_spec
as well? If you wanna add some docs to both matchers, I'd be much obliged 👍
There is currently no way to check whether a job was scheduled for some point in the future or enqueued immediately.
This statement, on first read, is not true. You can absolutely test that something was enqueued for the future...
The statement was too broad indeed. I meant "There is currently no way to check in a whether a job was scheduled or enqueued".
I added docs in the README and in matchers/enqueue_sidekiq_job.rb
for YARD, the other places being private.
I have a couple things to add for a 4.1 (composable support for example), that this will be included in. Thanks again for the contribution @chrismaximin
The issue
There is currently no way to check whether a job was scheduled for some point in the future, or enqueued immediately. Specifically, we can't use
have_enqueued_sidekiq_job.at( ... )
if a job was enqueued immediately.This is because when Sidekiq doesn't add a
"at"
option when the date was in the past, which rspec-sidekiq currently relies on: https://github.com/sidekiq/sidekiq/blob/bd1ca2b94ad73abdfd4347c83be527bb3ff60acb/lib/sidekiq/job.rb#L328C1-L329This PR
This PR enables this: