adds specs
This commit is contained in:
@@ -36,4 +36,34 @@ describe Comment do
|
||||
expect(comment).to be_as_moderator
|
||||
end
|
||||
end
|
||||
|
||||
describe "cache" do
|
||||
let(:comment) { create(:comment) }
|
||||
|
||||
it "should expire cache when it has a new vote" do
|
||||
expect { create(:vote, votable: comment) }
|
||||
.to change { comment.updated_at }
|
||||
end
|
||||
|
||||
it "should expire cache when hidden" do
|
||||
expect { comment.hide }
|
||||
.to change { comment.updated_at }
|
||||
end
|
||||
|
||||
it "should expire cache when the author is hidden" do
|
||||
expect { comment.user.hide }
|
||||
.to change { comment.reload.updated_at }
|
||||
end
|
||||
|
||||
it "should expire cache when the author changes" do
|
||||
expect { comment.user.update(username: "Isabel") }
|
||||
.to change { comment.reload.updated_at }
|
||||
end
|
||||
|
||||
it "should expire cache when the author's organization get verified" do
|
||||
create(:organization, user: comment.user)
|
||||
expect { comment.user.organization.verify }
|
||||
.to change { comment.reload.updated_at}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user