add a way to delete posts and topics when deleting a user with UserDestroyer

This commit is contained in:
Neil Lalonde
2013-07-24 13:48:55 -04:00
parent a8df9778b5
commit e25638dab0
6 changed files with 87 additions and 49 deletions

View File

@ -218,6 +218,13 @@ describe Admin::UsersController do
response.should be_forbidden
end
it "doesn't return an error if the user has posts and delete_posts == true" do
Fabricate(:post, user: @delete_me)
UserDestroyer.any_instance.expects(:destroy).with(@delete_me, has_entry('delete_posts' => true)).returns(true)
xhr :delete, :destroy, id: @delete_me.id, delete_posts: true
response.should be_success
end
it "deletes the user record" do
UserDestroyer.any_instance.expects(:destroy).returns(true)
xhr :delete, :destroy, id: @delete_me.id