SPEC: Use I18n translation instead of using raw text

This commit is contained in:
Vinoth Kannan 2019-01-21 20:21:09 +05:30
parent b95165b838
commit 0cf8f10158

View File

@ -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