Closed LeoGardel closed 4 months ago
did you found any solution? am trying to test something similar
Just stumbled on this. It is happening in my case also. Anyone found more about it?
Found something
MyJob.queue_adapter.enqueued_jobs
You can then get the enqueued_jobs
Closing stale
I'm using DelayedJob through the ActiveJob library.
At a certain moment, I call the
perform_later
method (form ActiveJob) to enqueue a task. It works fine in the app and all the tests are ok when I run model tests (I'm using RSpec).The problem occurs when I run mailer specs. The same line of code is not enqueuing the job when it is run by the mailer specs. I've realized where was the problem by using the around_enqueue callback as below.
The code below is the moment I call the enqueue method
CreateAsyncWalletEntryJob.perform_later(payment_data)
I am already setting Delayed Jobs to enqueue tasks while running the tests, but it is not taking effect with my mailer specs.
Delayed::Worker.delay_jobs = true
I have already checked if the
perform
method is running, but it isn't, which means that the problem is not related to instant execution instead of enqueuing. It is not adding to the queue and not running the perform method at all! And there is no error, it's totally silent.Any ideas?