diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-10-09 14:41:54 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-10-09 14:41:54 +0300 |
commit | 4416be54a90f9c7ecbf40e5bd6ca9b5ff1d8d26a (patch) | |
tree | e457bee95e1eaa5aba6788f72551b68ff2dfce63 /spec | |
parent | c8e7d6df794fe845299fab07827aa35269e2c2bf (diff) | |
download | gitlab-ce-4416be54a90f9c7ecbf40e5bd6ca9b5ff1d8d26a.tar.gz |
API: specs for remove project
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index b8c0b6f33ed..bf4a1749418 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -730,4 +730,42 @@ describe API::API do end end end + + describe "DELETE /projects/:id" do + context "when authenticated as user" do + it "should remove project" do + delete api("/projects/#{project.id}", user) + response.status.should == 200 + end + + it "should not remove a project if not an owner" do + user3 = create(:user) + project.team << [user3, :developer] + delete api("/projects/#{project.id}", user3) + response.status.should == 403 + end + + it "should not remove a non existing project" do + delete api("/projects/1328", user) + response.status.should == 404 + end + + it "should not remove a project not attached to user" do + delete api("/projects/#{project.id}", user2) + response.status.should == 404 + end + end + + context "when authenticated as admin" do + it "should remove any existing project" do + delete api("/projects/#{project.id}", admin) + response.status.should == 200 + end + + it "should not remove a non existing project" do + delete api("/projects/1328", admin) + response.status.should == 404 + end + end + end end |