0

I have an API project in Rails 5 using rswag for endpoint definition and testing.

One controller action, create, enqueues an ActiveJob with keyword arguments using perform_later(job_title: @job, date: @date)

When I use run_test! in my request spec for this action, I want to run the queued job immediately.

How do I force the job to run with the keyword arguments that were passed in the controller action?

user1022788
  • 419
  • 8
  • 18

1 Answers1

0

You can use perform_enqueued_jobs inside your run_test! block

run_test! do
  perform_enqueued_jobs
end
jumichot
  • 2,016
  • 1
  • 12
  • 8