🖥

#Rails ActionMailer + #Rspec でメール送信数 / 送信先をテストする例

に公開
subject { something }

it do
  expect { subject }.to change { ActionMailer::Base.deliveries.count }.by(3)
end

before { subject }

it do
  expect(ActionMailer::Base.deliveries.map(&:to)).to include ['alice@example.com']
  expect(ActionMailer::Base.deliveries.map(&:to)).to include ['bob@example.com', 'carol@example.com']
end

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/2943

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2020-01-14

Discussion