summaryrefslogtreecommitdiff
path: root/spec/requests/api
diff options
context:
space:
mode:
authorVinnie Okada <vokada@mrvinn.com>2014-10-07 14:55:15 -0500
committerVinnie Okada <vokada@mrvinn.com>2014-10-07 15:21:00 -0500
commit68b5ac7f185b9b30cd862eacf806db726d8ce6e4 (patch)
treeadd984099eaa5706b2c2216b3a3ffab5c03f5d9b /spec/requests/api
parent51ed8b7edd119897a4a0b2f5948d049dfc8691a4 (diff)
downloadgitlab-ce-68b5ac7f185b9b30cd862eacf806db726d8ce6e4.tar.gz
Add option to keep repo on project delete
Update the project API controller to use `Projects::DestroyService` instead of calling `Project#destroy` directly. Also add an optional parameter, `:keep_repo`, that allows a project to be deleted without deleting the repository, wiki, and satellite from disk.
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/projects_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index aa1437c71aa..6de37cff0aa 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -632,10 +632,25 @@ describe API::API, api: true do
describe "DELETE /projects/:id" do
context "when authenticated as user" do
it "should remove project" do
+ expect(GitlabShellWorker).to(
+ receive(:perform_async).with(:remove_repository,
+ /#{project.path_with_namespace}/)
+ ).twice
+
delete api("/projects/#{project.id}", user)
response.status.should == 200
end
+ it 'should keep repo when "keep_repo" param is true' do
+ expect(GitlabShellWorker).not_to(
+ receive(:perform_async).with(:remove_repository,
+ /#{project.path_with_namespace}/)
+ )
+
+ delete api("/projects/#{project.id}?keep_repo=true", user)
+ response.status.should == 200
+ end
+
it "should not remove a project if not an owner" do
user3 = create(:user)
project.team << [user3, :developer]