From 371fba6ae02b1c86d6487228838b509b156e052f Mon Sep 17 00:00:00 2001 From: Kane York Date: Mon, 5 Jul 2021 12:27:31 -0700 Subject: [PATCH] DEV: Commit failing test for email substution bug --- spec/jobs/user_email_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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)