FIX: only count regular posts in user stats when deleting

This commit is contained in:
Neil Lalonde
2017-11-02 17:11:08 -04:00
parent 30689783db
commit 21dd2ccd43
2 changed files with 17 additions and 2 deletions

View File

@ -308,6 +308,21 @@ describe PostDestroyer do
author.reload
}.to change { author.post_count }.by(-1)
end
it "doesn't count whispers" do
user_stat = admin.user_stat
whisper = PostCreator.new(
admin,
topic_id: post.topic.id,
reply_to_post_number: 1,
post_type: Post.types[:whisper],
raw: 'this is a whispered reply'
).create
expect(user_stat.reload.post_count).to eq(0)
expect {
PostDestroyer.new(admin, whisper).destroy
}.to_not change { user_stat.reload.post_count }
end
end
end