BigW Consortium Gitlab

Unverified Commit 576a80e9 by Dmitriy Zaporozhets

Merge branch 'api-project-delete' of https://gitlab.com/mr-vinn/gitlab-ce into…

Merge branch 'api-project-delete' of https://gitlab.com/mr-vinn/gitlab-ce into mr-vinn/gitlab-ce-api-project-delete Signed-off-by: 's avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Conflicts: spec/features/projects_spec.rb
parents 05f19392 41518a46
...@@ -178,7 +178,7 @@ module API ...@@ -178,7 +178,7 @@ module API
# DELETE /projects/:id # DELETE /projects/:id
delete ":id" do delete ":id" do
authorize! :remove_project, user_project authorize! :remove_project, user_project
user_project.destroy ::Projects::DestroyService.new(user_project, current_user, {}).execute
end end
# Mark this project as forked from another # Mark this project as forked from another
......
...@@ -17,5 +17,14 @@ describe "Projects", feature: true do ...@@ -17,5 +17,14 @@ describe "Projects", feature: true do
click_button 'Confirm' click_button 'Confirm'
}.to change {Project.count}.by(-1) }.to change {Project.count}.by(-1)
end 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
end end
...@@ -632,6 +632,11 @@ describe API::API, api: true do ...@@ -632,6 +632,11 @@ describe API::API, api: true do
describe "DELETE /projects/:id" do describe "DELETE /projects/:id" do
context "when authenticated as user" do context "when authenticated as user" do
it "should remove project" 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) delete api("/projects/#{project.id}", user)
response.status.should == 200 response.status.should == 200
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment