Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-06-02 23:48:40 +0300
committerDouwe Maan <douwe@gitlab.com>2017-06-02 23:48:40 +0300
commit7cc734a2176e199d2e28ad8666e7e4e0030682db (patch)
tree8c5699cc243e3f4fd1448fb0e1f00020e100cfde /spec/requests/api
parent256a8601fb3e762193973afff25152dcdab9930c (diff)
parentc890c6aaf2939bc19292947bd8268d724fa7ddce (diff)
Merge branch '28694-hard-delete-user-from-api' into 'master'
Allow users to be hard-deleted from the API See merge request !11853
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/users_spec.rb20
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