uses cache counter for debate's comments

This commit is contained in:
Juanjo Bazán
2015-08-26 17:17:53 +02:00
parent 5d112ac2bf
commit dacbe27fda
5 changed files with 18 additions and 5 deletions

View File

@@ -8,6 +8,15 @@ describe Comment do
expect(comment).to be_valid
end
it "should update cache_counter in debate after hide" do
debate = create(:debate)
comment = create(:comment, commentable: debate)
expect(debate.reload.comments_count).to eq(1)
comment.hide
expect(debate.reload.comments_count).to eq(0)
end
describe "#children_count" do
let(:comment) { create(:comment) }
let(:debate) { comment.debate }