diff options
author | Nick Thomas <nick@gitlab.com> | 2017-06-02 13:35:37 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-06-05 17:48:57 +0100 |
commit | f09b7f56077f8b1deb88dd565717e8ed0d8e6aee (patch) | |
tree | f43fadbe24c6377a7252474d91d7adcca947e9df /spec/controllers/admin | |
parent | 158581a447bb4976161eca26ddcb2fccd25888ab (diff) | |
download | gitlab-ce-f09b7f56077f8b1deb88dd565717e8ed0d8e6aee.tar.gz |
Support hard deletion in Admin::UsersController#destroy
Diffstat (limited to 'spec/controllers/admin')
-rw-r--r-- | spec/controllers/admin/users_controller_spec.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index 2ab2ca1b667..7d6c317482f 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -10,15 +10,26 @@ describe Admin::UsersController do describe 'DELETE #user with projects' do let(:project) { create(:empty_project, namespace: user.namespace) } + let!(:issue) { create(:issue, author: user) } before do project.team << [user, :developer] end - it 'deletes user' do + it 'deletes user and ghosts their contributions' do delete :destroy, id: user.username, format: :json + + expect(response).to have_http_status(200) + expect(User.exists?(user.id)).to be_falsy + expect(issue.reload.author).to be_ghost + end + + it 'deletes the user and their contributions when hard delete is specified' do + delete :destroy, id: user.username, hard_delete: true, format: :json + expect(response).to have_http_status(200) - expect { User.find(user.id) }.to raise_exception(ActiveRecord::RecordNotFound) + expect(User.exists?(user.id)).to be_falsy + expect(Issue.exists?(issue.id)).to be_falsy end end |