From 0cf8f10158236290d8d2df0fe2a0b38399109eed Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Mon, 21 Jan 2019 20:21:09 +0530 Subject: [PATCH] SPEC: Use I18n translation instead of using raw text --- spec/components/post_destroyer_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/components/post_destroyer_spec.rb b/spec/components/post_destroyer_spec.rb index 8266f8dafb6..ba12c82f9c4 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