How to test that ActiveJob is enqueued?

前端 未结 3 2046
难免孤独
难免孤独 2021-01-21 10:08

I have a create action that calls an ActiveJob if the record is successfully saved.

def create
  @object = Object.new(importer_params)
  respond_to do |format|
         


        
3条回答
  •  难免孤独
    2021-01-21 10:30

    In official docs here is have_enqueued_job matcher

    The have_enqueued_job (also aliased as enqueue_job) matcher is used to check if given ActiveJob job was enqueued.

    https://relishapp.com/rspec/rspec-rails/docs/matchers/have-enqueued-job-matcher

提交回复
热议问题