docbrown/spec/views/comments/_comment.html.erb_spec.rb
Anna Buianova 7125a62db0
Changed logic for hiding and displaying low-quality marker for comments based on their score (#20581)
* Specs for revised comments thresholds

* Changed thresholds for low quality comments

* Added specs for comments page

* Fixed /comments and related specs

* Reorganized code for comments trees

* Specs for podcasts episodes comments

* Refactored Comments::Tree

* Refactored Comments::Tree + added specs

* Made build_sort_query private
2024-02-05 09:27:24 -05:00

22 lines
893 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,
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