docbrown/spec/views/comments/_comment.html.erb_spec.rb
Anna Buianova 7d5650c3f1
Admin access to spam comments by url (#20775)
* Admin access to spam comments by url

* Fixed spec

* Fixed view spec
2024-03-22 08:40:36 -04:00

23 lines
923 B
Ruby

require "rails_helper"
RSpec.describe "rendering locals in a partial" do
context "when comment is low-quality" do
it "renders the comment with low-quality marker" do
allow(Settings::General).to receive(:mascot_image_url).and_return("https://i.imgur.com/fKYKgo4.png")
article = create(:article)
comment = create(:comment, processed_html: "hi", score: -100, commentable: article)
render "comments/comment",
comment: comment,
commentable: article,
is_view_root: true,
is_childless: true,
is_admin: false,
subtree_html: ""
expect(rendered).to match(/crayons-notice crayons-notice--warning low-quality-comment-marker/)
.and match(%r{Comment marked as low quality/non-constructive by the community.})
expect(rendered).to have_link "View Code of Conduct", href: "/code-of-conduct"
end
end
end