Closed ghost closed 7 years ago
I ended up surrounding my config/initializer file as follows
if Rails.env.production?
MyJob.schedule!
end
and then just calling my scheduled jobs manually in Rspec
it 'performs the job' do
MyJob.perform
end
This allowed me to test the work that the job was doing by bypassing the scheduled aspect of it.
I'm using delayed_job_active_record and delayed_job_recurring. Everything works great in development and production. However, in test environment I'm getting
Stack level too deep
exception when testing recurring jobs.I configured Delayed job to work synchronously when running specs:
My current (not so great) workaround is to include RecurringJob only outside of test env:
I'm using: