diff options
author | Nick Thomas <nick@gitlab.com> | 2017-06-01 17:14:39 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-06-02 18:28:12 +0100 |
commit | c890c6aaf2939bc19292947bd8268d724fa7ddce (patch) | |
tree | 246f57f6c492801687adb9effd790f59a2d0909b /spec/requests | |
parent | 1bf76c7620396b5cbc59b168a67a4de3102457b3 (diff) | |
download | gitlab-ce-c890c6aaf2939bc19292947bd8268d724fa7ddce.tar.gz |
Allow users to be hard-deleted from the API
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/users_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index a2503dbeb69..1c33b8f9502 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -702,6 +702,7 @@ describe API::Users do describe "DELETE /users/:id" do let!(:namespace) { user.namespace } + let!(:issue) { create(:issue, author: user) } before { admin } it "deletes user" do @@ -733,6 +734,25 @@ describe API::Users do expect(response).to have_http_status(404) end + + context "hard delete disabled" do + it "moves contributions to the ghost user" do + Sidekiq::Testing.inline! { delete api("/users/#{user.id}", admin) } + + expect(response).to have_http_status(204) + expect(issue.reload).to be_persisted + expect(issue.author.ghost?).to be_truthy + end + end + + context "hard delete enabled" do + it "removes contributions" do + Sidekiq::Testing.inline! { delete api("/users/#{user.id}?hard_delete=true", admin) } + + expect(response).to have_http_status(204) + expect(Issue.exists?(issue.id)).to be_falsy + end + end end describe "GET /user" do |