rspec-sidekiq
rspec-sidekiq copied to clipboard
have_enqueued_sidekiq_job fails frequently because of nanoseconds
This generally happens when a time calculation has gone through a db round trip.
My current workaround is to use Timecop to freeze now without nanoseconds at the beginning of each spec:
now = Timecop.freeze(Time.zone.now.change(nsec: 0))
but I think it would be better if have_enqueued_sidekiq_job
dropped nanoseconds from both sides.
:+1:
I believe this was fixed with https://github.com/wspurgin/rspec-sidekiq/commit/dcc6d037a2333a5af73ead81809b484fd0e9ac13 which drops any fractional second component. However, It's always a good idea to freeze time for any time-based expectations to avoid flaky failures.