adds email delivery of selected and unselected investments
This commit is contained in:
@@ -321,5 +321,51 @@ feature 'Emails' do
|
||||
expect(email).to have_body_text(investment.unfeasibility_explanation)
|
||||
end
|
||||
|
||||
scenario "Selected investment" do
|
||||
author1 = create(:user)
|
||||
author2 = create(:user)
|
||||
author3 = create(:user)
|
||||
|
||||
investment1 = create(:budget_investment, :selected, author: author1, budget: budget)
|
||||
investment2 = create(:budget_investment, :selected, author: author2, budget: budget)
|
||||
investment3 = create(:budget_investment, :unselected, author: author3, budget: budget)
|
||||
|
||||
reset_mailer
|
||||
budget.email_selected
|
||||
|
||||
expect(find_email investment1.author.email).to be
|
||||
expect(find_email investment2.author.email).to be
|
||||
expect(find_email investment3.author.email).to_not be
|
||||
|
||||
email = open_last_email
|
||||
investment = investment2
|
||||
expect(email).to have_subject("Your investment project '#{investment.code}' has been selected")
|
||||
expect(email).to deliver_to(investment.author.email)
|
||||
expect(email).to have_body_text(investment.title)
|
||||
end
|
||||
|
||||
scenario "Unselected investment" do
|
||||
author1 = create(:user)
|
||||
author2 = create(:user)
|
||||
author3 = create(:user)
|
||||
|
||||
investment1 = create(:budget_investment, :unselected, author: author1, budget: budget)
|
||||
investment2 = create(:budget_investment, :unselected, author: author2, budget: budget)
|
||||
investment3 = create(:budget_investment, :selected, author: author3, budget: budget)
|
||||
|
||||
reset_mailer
|
||||
budget.email_unselected
|
||||
|
||||
expect(find_email investment1.author.email).to be
|
||||
expect(find_email investment2.author.email).to be
|
||||
expect(find_email investment3.author.email).to_not be
|
||||
|
||||
email = open_last_email
|
||||
investment = investment2
|
||||
expect(email).to have_subject("Your investment project '#{investment.code}' has not been selected")
|
||||
expect(email).to deliver_to(investment.author.email)
|
||||
expect(email).to have_body_text(investment.title)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user