Skip to content

A platform for community discussion. Free, open, simple.

DEV: Commit failing test for email substution bug

Kane York371fba6ae02b
diff --git a/spec/jobs/user_email_spec.rb b/spec/jobs/user_email_spec.rb
index c91ed8e6d02..7c46567337b 100644
--- a/spec/jobs/user_email_spec.rb
+++ b/spec/jobs/user_email_spec.rb
@@ -149,6 +149,30 @@ describe Jobs::UserEmail do
)
end
+ it "sends an email with no gsub substitution bugs" do
+ upload = Fabricate(:upload)
+
+ post.update!(raw: <<~RAW)
+ This is a test post
+
+ With a \\0 \\1 \\2 in it
+ RAW
+ Jobs::UserEmail.new.execute(
+ type: :user_private_message,
+ user_id: user.id,
+ post_id: post.id,
+ notification_id: notification.id
+ )
+
+ email = ActionMailer::Base.deliveries.first
+
+ expect(email.to).to contain_exactly(user.email)
+
+ html_part = email.parts.find { |x| x.content_type.include? "html" }
+ expect(html_part.body.to_s).to_not include('%{email_content}')
+ expect(html_part.body.to_s).to include('\0')
+ end
+
it "sends an email by default for a PM to a user that's been recently seen" do
upload = Fabricate(:upload)