diff --git a/spec/mailers/user_notifications_spec.rb b/spec/mailers/user_notifications_spec.rb
index 4c250f18e87..7b56e2bb7ef 100644
--- a/spec/mailers/user_notifications_spec.rb
+++ b/spec/mailers/user_notifications_spec.rb
@@ -35,6 +35,10 @@ describe UserNotifications do
expect(subject.body).to be_present
end
+ it "does not use the layout" do
+ expect(subject.html_part.to_s.scan(//).count).to eq(0)
+ end
+
end
describe ".forgot_password" do
@@ -48,6 +52,10 @@ describe UserNotifications do
expect(subject.body).to be_present
end
+ it "does not use the layout" do
+ expect(subject.html_part.to_s.scan(//).count).to eq(0)
+ end
+
end
describe '.digest' do
@@ -77,6 +85,10 @@ describe UserNotifications do
expect(subject.text_part.body.to_s).to be_present
end
+ it "uses the layout" do
+ expect(subject.html_part.to_s.scan(//).count).to eq(1)
+ end
+
it "includes email_prefix in email subject instead of site title" do
SiteSetting.email_prefix = "Try Discourse"
SiteSetting.title = "Discourse Meta"
@@ -104,6 +116,8 @@ describe UserNotifications do
notification_type: notification.notification_type,
notification_data_hash: notification.data_hash
)
+ # meta tag should be present from the layout
+ expect(mail.html_part.to_s.scan(//).count).to eq(1)
# from should include full user name
expect(mail[:from].display_names).to eql(['John Doe'])
@@ -156,6 +170,9 @@ describe UserNotifications do
notification_data_hash: notification.data_hash
)
+ # meta tag should be present from the layout
+ expect(mail.html_part.to_s.scan(//).count).to eq(1)
+
# from should not include full user name if "show user full names" is disabled
expect(mail[:from].display_names).to_not eql(['John Doe'])
@@ -193,6 +210,9 @@ describe UserNotifications do
notification_data_hash: notification.data_hash
)
+ # meta tag should be present from the layout
+ expect(mail.html_part.to_s.scan(//).count).to eq(1)
+
# from should include username if full user name is not provided
expect(mail[:from].display_names).to eql(['john'])