SPEC: Use I18n translation instead of using raw text

SPEC: Use I18n translation instead of using raw text

diff --git a/spec/components/post_destroyer_spec.rb b/spec/components/post_destroyer_spec.rb
index 8266f8d..ba12c82 100644
--- a/spec/components/post_destroyer_spec.rb
+++ b/spec/components/post_destroyer_spec.rb
@@ -636,6 +636,7 @@ describe PostDestroyer do
     end
 
     it "should delete public post actions and agree with flags" do
+      url = second_post.url
       second_post.expects(:update_flagged_posts_count)
 
       PostDestroyer.new(moderator, second_post).destroy
@@ -655,7 +656,18 @@ describe PostDestroyer do
 
       Jobs::SendSystemMessage.new.execute(jobs[0]["args"][0].with_indifferent_access)
 
-      expect(Post.last.raw).to include("[details=\"Click to expand removed post\"]\n`‍`` markdown\n#{second_post.raw}\n`‍``\n[/details]")
+      expect(Post.last.raw).to eq(I18n.t(
+        "system_messages.flags_agreed_and_post_deleted.text_body_template",
+        flagged_post_raw_content: second_post.raw,
+        url: url,
+        flag_reason: I18n.t(
+          "flag_reasons.#{PostActionType.flag_types[off_topic.post_action_type_id]}",
+          locale: SiteSetting.default_locale,
+          base_path: Discourse.base_path
+        ),
+        site_name: SiteSetting.title,
+        base_url: Discourse.base_url
+      ).strip)
     end
 
     it "should not send the flags_agreed_and_post_deleted message if it was deleted by system" do

GitHub sha: 0cf8f101

1 Like