Question: Cucumber - perform ActiveJob `perform_later` jobs immediately

Question

Cucumber - perform ActiveJob `perform_later` jobs immediately

Answers 0
Added at 2016-11-10 01:11
Tags
Question

I have many jobs that are calling other nested jobs using perform_later. However, during some tests on Cucumber, I'd like to execute those jobs immediately after to proceed with the rests of the tests.

I thought it would be enough to add

# features/support/active_job.rb
World(ActiveJob::TestHelper)

And to call jobs using this in a step definition file

perform_enqueued_jobs do
  # call step that calls MyJob.perform_later(*args)
end

However I run into something like that

undefined method `perform_enqueued_jobs' for #<ActiveJob::QueueAdapters::AsyncAdapter:0x007f98fd03b900> (NoMethodError)

What am I missing / doing wrong ?

Answers
Source Show
◀ Wstecz