lib/decidim/comments/test/shared_examples/comment_event.rb in decidim-comments-0.28.1 vs lib/decidim/comments/test/shared_examples/comment_event.rb in decidim-comments-0.28.2
- old
+ new
@@ -40,6 +40,39 @@
describe "resource_text" do
it "outputs the comment body" do
expect(subject.resource_text).to eq comment.formatted_body
end
end
+
+ describe "hidden_resource?" do
+ context "when comment is not moderated" do
+ it "returns false" do
+ expect(subject.hidden_resource?).to be false
+ end
+ end
+
+ context "when comment is moderated" do
+ let(:comment) { create(:comment, :moderated) }
+
+ it "returns true" do
+ expect(subject.hidden_resource?).to be true
+ end
+ end
+
+ context "when resource is not moderated" do
+ it "returns false" do
+ expect(subject.hidden_resource?).to be false
+ end
+ end
+
+ context "when resource is moderated" do
+ before do
+ create(:moderation, reportable: resource, hidden_at: 2.days.ago)
+ resource.reload
+ end
+
+ it "returns true" do
+ expect(subject.hidden_resource?).to be true
+ end
+ end
+ end
end