diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-28 16:14:40 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-28 16:14:40 +0200 |
commit | 576a80e97c0314cf5b7209ff3cc2a6e26d1c2977 (patch) | |
tree | 779cf65a0f580fa8b0d78d1b173479730a8b8fc2 | |
parent | 05f19392b76d9fbe40d97547ee2a3c87883c9639 (diff) | |
parent | 41518a467dcef61deca24ad2f6205c6fd5706e1b (diff) | |
download | gitlab-ce-576a80e97c0314cf5b7209ff3cc2a6e26d1c2977.tar.gz |
Merge branch 'api-project-delete' of https://gitlab.com/mr-vinn/gitlab-ce into mr-vinn/gitlab-ce-api-project-delete
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Conflicts:
spec/features/projects_spec.rb
-rw-r--r-- | lib/api/projects.rb | 2 | ||||
-rw-r--r-- | spec/features/projects_spec.rb | 9 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 5 |
3 files changed, 15 insertions, 1 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 7f7d2f8e9a8..7fcf97d1ad6 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -178,7 +178,7 @@ module API # DELETE /projects/:id delete ":id" do authorize! :remove_project, user_project - user_project.destroy + ::Projects::DestroyService.new(user_project, current_user, {}).execute end # Mark this project as forked from another diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 98ba5a47ee5..87bfe102d39 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -17,5 +17,14 @@ describe "Projects", feature: true do click_button 'Confirm' }.to change {Project.count}.by(-1) end + + it 'should delete the project from the database and disk' do + expect(GitlabShellWorker).to( + receive(:perform_async).with(:remove_repository, + /#{@project.path_with_namespace}/) + ).twice + + expect { click_link "Remove project" }.to change {Project.count}.by(-1) + end end end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index aa1437c71aa..ba7ec7b2be9 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -632,6 +632,11 @@ 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 |