Closed jagthedrummer closed 7 years ago
Can confirm, the same happens for me.
I'm working on it @jagthedrummer and @Morred. We'll release a fix soon.
@jagthedrummer @Morred could you please point your Gemfile to #109 branch and give us some feedback on this issue?
@wpolicarpo I'll try to give this a look later tonight. Thanks for the work on it.
@wpolicarpo I can now get a spec to fail with the fix-scheduled-jobs-testing
in my Gemfile
, but the error messages are somewhat confusing.
With the example above when the tests fail I'm seeing this reported:
1) Account start_premium_trial should queue the AccountPermissionWorker to run after the trial period is over
Failure/Error: expect(::AccountPermissionWorker).to have_enqueued_sidekiq_job(@account.id).at(3.days.from_now)
expected to have an enqueued AccountPermissionWorker job with arguments [4847]
found: [[4847]]
It seems like it's just saying that the arguments are incorrect, when the real issue is that the value of at
is incorrect. If I fix the time expectations so that they match the test passes.
I think that ideally if it found a job queued, but with a timestamp other than expected it would say something like:
expected to have a scheduled AccountPermissionWorker job with arguments [4847] at 2.days.from.now
found: [4847] at 4.days.from.now
Or maybe instead of showing something like 2.days.from.now
in the output it would just show timestamps that don't match. Or really anything else that would clue you in that it's a problem with the timing of the scheduled job vs expectations for the scheduled job instead of being some other problem with job arguments.
Anyway, thanks for the quick work on this! 😄
@jagthedrummer you're right. I'll see what can be done to make output better.
I'm using the latest work in the
develop
branch by using this in my Gemfile:I'm queueing a job in the future like this:
And I'm trying to make a test fail by doing:
No matter what
at
time I test for the test always passes when it should fail.