Add Preview Pending action to Admin System Emails

Some system emails need to be manually reviewed before being sent. This
new action allows admins to see a preview of all Pending to be sent
Proposal Notification Digest messages.
This commit is contained in:
Bertocq
2018-04-18 16:12:38 +02:00
committed by decabeza
parent 5c726e0949
commit eb0919d978
8 changed files with 123 additions and 10 deletions

View File

@@ -40,4 +40,29 @@ feature "System Emails" do
end
end
context "Preview Pending" do
scenario "#proposal_notification_digest" do
proposal_a = create(:proposal, title: 'Proposal A')
proposal_b = create(:proposal, title: 'Proposal B')
proposal_notification_a = create(:proposal_notification, proposal: proposal_a,
title: 'Proposal A Title',
body: 'Proposal A Notification Body')
proposal_notification_b = create(:proposal_notification, proposal: proposal_b,
title: 'Proposal B Title',
body: 'Proposal B Notification Body')
create(:notification, notifiable: proposal_notification_a, emailed_at: nil)
create(:notification, notifiable: proposal_notification_b, emailed_at: nil)
visit admin_system_email_preview_pending_path('proposal_notification_digest')
expect(page).to have_content('This is the content pending to be sent')
expect(page).to have_link('Proposal A', href: proposal_url(proposal_a))
expect(page).to have_link('Proposal B', href: proposal_url(proposal_b))
expect(page).to have_link('Proposal A Title', href: proposal_url(proposal_a,
anchor: 'tab-notifications'))
expect(page).to have_link('Proposal B Title', href: proposal_url(proposal_b,
anchor: 'tab-notifications'))
end
end
end