Rails - How do you test ActionMailer sent a specific email in tests

后端 未结 7 2025
面向向阳花
面向向阳花 2020-12-23 12:58

Currently in my tests I do something like this to test if an email is queued to be sent

assert_difference(\'ActionMailer::Base.deliveries.size\', 1) do              


        
7条回答
  •  轮回少年
    2020-12-23 13:23

    A little late, but it may help others:

    You could use Email-spec, a collection of Rspec/Minitest matchers and Cucumber steps.

提交回复
热议问题