How to test with RSpec if an email is delivered

后端 未结 8 1178
清酒与你
清酒与你 2020-12-25 11:09

I\'d like to test if an email is delivered if I call a controller method with :post. I\'ll use email_spec so I tried this snipped here: http://rubydoc.info/gems/email_spec/1

8条回答
  •  星月不相逢
    2020-12-25 11:35

    Anyone using rspec +3.4 and ActiveJob to send async emails, try with:

    expect {
      post :create, params
    }.to have_enqueued_job.on_queue('mailers')
    

提交回复
热议问题