Closed coding-red-panda closed 4 years ago
In your example you're comparing Wed, 24 Oct 2018 12:22:37 UTC +00:00
with:
Time.at(1540383757.232822) # => 2018-10-24 07:22:37 -0500
@coding-bunny you could try the following:
it do
worker = HardWorker.new
worker.perform
time = Time.at(1.minute.from_now)
expect(HardWorker).to have_enqueued_sidekiq_job.at(time)
end
I also strongly suggest freezing the time with timecop or a similar library because your test may fail if it takes more than a second to reach the expectation statement.
I hope the answer helps 2 years after this issue was opened.
We actually swapped to using Timecop
to resolve the problems.
I should probably close this xD
Hello,
i'm writing specs to check that a job re-schedules itself one minute from the current time. I'm using the
perform_in(1.minutes.from_now)
along with the arguments.The spec I am using to test his is as follows in RSpec:
This however fails with the following:
RSpec : 3.8 Sidekiq: 5.0.0
It seems as if different objects are used for this.