Use PostDestroyer when deleting all of a user's posts; deleting a post removes its flags and resets its flag counts

This commit is contained in:
Neil Lalonde
2013-06-05 16:00:45 -04:00
parent 93cdb97b46
commit b55182b983
5 changed files with 31 additions and 16 deletions

View File

@ -208,12 +208,10 @@ describe User do
it 'allows moderator to delete all posts' do
@user.delete_all_posts!(@guardian)
expect(Post.where(id: @posts.map(&:id)).all).to be_empty
@posts.each do |p|
p.reload
if p
p.topic.should be_nil
else
p.should be_nil
if p.post_number == 1
expect(Topic.where(id: p.topic_id).first).to be_nil
end
end
end