sends notification email to each voter
This commit is contained in:
@@ -148,4 +148,40 @@ feature 'Emails' do
|
||||
expect(email).to have_body_text(spending_proposal.feasible_explanation)
|
||||
end
|
||||
|
||||
scenario "Proposal notification" do
|
||||
author = create(:user)
|
||||
|
||||
noelia = create(:user)
|
||||
vega = create(:user)
|
||||
cristina = create(:user)
|
||||
|
||||
proposal = create(:proposal, author: author)
|
||||
|
||||
create(:vote, voter: noelia, votable: proposal, vote_flag: true)
|
||||
create(:vote, voter: vega, votable: proposal, vote_flag: true)
|
||||
|
||||
reset_mailer
|
||||
|
||||
login_as(author)
|
||||
visit root_path
|
||||
|
||||
visit new_proposal_notification_path(proposal_id: proposal.id)
|
||||
|
||||
fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal"
|
||||
fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!"
|
||||
click_button "Send"
|
||||
|
||||
expect(page).to have_content "Your message has been sent correctly."
|
||||
|
||||
expect(unread_emails_for(noelia.email).size).to eql parse_email_count(1)
|
||||
expect(unread_emails_for(vega.email).size).to eql parse_email_count(1)
|
||||
expect(unread_emails_for(cristina.email).size).to eql parse_email_count(0)
|
||||
expect(unread_emails_for(author.email).size).to eql parse_email_count(0)
|
||||
|
||||
email = open_last_email
|
||||
expect(email).to have_subject("Thank you for supporting my proposal")
|
||||
expect(email).to have_body_text("Please share it with others so we can make it happen!")
|
||||
expect(email).to have_body_text(proposal.title)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user