Skip to content

Commit

Permalink
Fix new account mailers, update mailer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yulia-bel committed Nov 29, 2023
1 parent da52bfb commit 903efe0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/app/views/admin_mailer/investor_created.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<h3><%= t "admin_mailer.greetings", full_name: @admin.full_name %></h3>
<p><%= t "admin_mailer.investor_created.content_html", new_investor_url: link_to(backoffice_investor_url(@investor)) %></p>
<p><%= t "admin_mailer.investor_created.content_html", new_investor_url: link_to('New Investor', backoffice_investor_url(@investor)) %></p>
<p><%= t "admin_mailer.farewell_html" %></p>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<h3><%= t "admin_mailer.greetings", full_name: @admin.full_name %></h3>
<p><%= t "admin_mailer.project_developer_created.content_html", new_pd_url: link_to(backoffice_project_developer_url(@project_developer)) %></p>
<p><%= t "admin_mailer.project_developer_created.content_html", new_pd_url: link_to('New Project Developer', backoffice_project_developer_url(@project_developer)) %></p>
<p><%= t "admin_mailer.farewell_html" %></p>
4 changes: 2 additions & 2 deletions backend/config/locales/zu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,10 @@ zu:
reset_password_link: setup your new password
investor_created:
subject: New Investor account created!
content_html: "A new Investor account has been created and needs your inspection for approval. Please, review the account: %{new_investor_url} "
content_html: "A new Investor account has been created and needs your inspection for approval. Please, review the account: %{new_investor_url}"
project_developer_created:
subject: New Project developer account created!
content_html: "A new Project developer account has been created and needs your inspection for approval. Please, review the account: %{new_pd_url} "
content_html: "A new Project developer account has been created and needs your inspection for approval. Please, review the account: %{new_pd_url}"
project_developer_mailer:
greetings: Dear %{full_name},
farewell_html: Best Regards,<br />Your HeCo Invest Team
Expand Down
32 changes: 32 additions & 0 deletions backend/spec/mailers/admin_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
include ActionView::Helpers::UrlHelper

let(:admin) { create :admin }
let(:project_developer) { create :project_developer }
let(:investor) { create :investor }

describe ".first_time_login_instructions" do
let(:mail) { AdminMailer.first_time_login_instructions admin }
Expand All @@ -20,4 +22,34 @@
expect(mail.body.encoded).to match(I18n.t("admin_mailer.farewell_html"))
end
end

describe ".project_developer_created" do
let(:mail) { AdminMailer.project_developer_created admin, project_developer }

it "renders the headers" do
expect(mail.subject).to eq(I18n.t("admin_mailer.project_developer_created.subject"))
expect(mail.to).to eq([admin.email])
end

it "renders the body" do
expect(mail.body.encoded).to match(I18n.t("admin_mailer.greetings", full_name: admin.full_name))
expect(mail.body.encoded).to match(I18n.t("admin_mailer.project_developer_created.content_html", new_pd_url: ""))
expect(mail.body.encoded).to match(I18n.t("admin_mailer.farewell_html"))
end
end

describe ".investor_created" do
let(:mail) { AdminMailer.investor_created admin, investor }

it "renders the headers" do
expect(mail.subject).to eq(I18n.t("admin_mailer.investor_created.subject"))
expect(mail.to).to eq([admin.email])
end

it "renders the body" do
expect(mail.body.encoded).to match(I18n.t("admin_mailer.greetings", full_name: admin.full_name))
expect(mail.body.encoded).to match(I18n.t("admin_mailer.investor_created.content_html", new_investor_url: ""))
expect(mail.body.encoded).to match(I18n.t("admin_mailer.farewell_html"))
end
end
end

0 comments on commit 903efe0

Please sign in to comment.