Make sure there is no empty <p> in the badge email (#7043)
This commit is contained in:
parent
b72fe0f03c
commit
cf1f6cc209
2 changed files with 17 additions and 3 deletions
|
|
@ -9,7 +9,7 @@
|
|||
<%= @badge.description %>
|
||||
</p>
|
||||
|
||||
<% if @badge_achievement.rewarding_context_message %>
|
||||
<% if @badge_achievement.rewarding_context_message.present? %>
|
||||
<p>
|
||||
<em>
|
||||
<%= @badge_achievement.rewarding_context_message.html_safe %>
|
||||
|
|
|
|||
|
|
@ -206,12 +206,19 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
expect(email.html_part.body).to include(CGI.escape(URL.url("/hey")))
|
||||
end
|
||||
|
||||
it "does not include the rewarding_context_message in the email" do
|
||||
it "does not include the nil rewarding_context_message in the email" do
|
||||
allow(badge_achievement).to receive(:rewarding_context_message).and_return(nil)
|
||||
|
||||
expect(email.html_part.body).not_to include("Hello <a")
|
||||
expect(email.html_part.body).not_to include(CGI.escape(URL.url("/hey")))
|
||||
end
|
||||
|
||||
it "does not include the empty rewarding_context_message in the email" do
|
||||
allow(badge_achievement).to receive(:rewarding_context_message).and_return("")
|
||||
|
||||
expect(email.html_part.body).not_to include("Hello <a")
|
||||
expect(email.html_part.body).not_to include(CGI.escape(URL.url("/hey")))
|
||||
end
|
||||
end
|
||||
|
||||
context "when rendering the text email" do
|
||||
|
|
@ -234,12 +241,19 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
expect(email.text_part.body).not_to include(URL.url("/hey"))
|
||||
end
|
||||
|
||||
it "does not include the rewarding_context_message in the email" do
|
||||
it "does not include the nil rewarding_context_message in the email" do
|
||||
allow(badge_achievement).to receive(:rewarding_context_message).and_return(nil)
|
||||
|
||||
expect(email.text_part.body).not_to include("Hello Yoho")
|
||||
expect(email.text_part.body).not_to include(URL.url("/hey"))
|
||||
end
|
||||
|
||||
it "does not include the empty rewarding_context_message in the email" do
|
||||
allow(badge_achievement).to receive(:rewarding_context_message).and_return("")
|
||||
|
||||
expect(email.text_part.body).not_to include("Hello Yoho")
|
||||
expect(email.text_part.body).not_to include(URL.url("/hey"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue