Commit 1a18e778f5e95223831f56de916d4fe0ce9d9dba
1 parent
f141711c
Exists in
master
and in
4 other branches
Remove group api specs
Showing
1 changed file
with
38 additions
and
0 deletions
Show diff stats
spec/requests/api/groups_spec.rb
... | ... | @@ -106,6 +106,44 @@ describe API::API do |
106 | 106 | end |
107 | 107 | end |
108 | 108 | |
109 | + describe "DELETE /groups/:id" do | |
110 | + context "when authenticated as user" do | |
111 | + it "should remove group" do | |
112 | + delete api("/groups/#{group1.id}", user1) | |
113 | + response.status.should == 200 | |
114 | + end | |
115 | + | |
116 | + it "should not remove a group if not an owner" do | |
117 | + user3 = create(:user) | |
118 | + group1.add_user(user3, Gitlab::Access::MASTER) | |
119 | + delete api("/groups/#{group1.id}", user3) | |
120 | + response.status.should == 403 | |
121 | + end | |
122 | + | |
123 | + it "should not remove a non existing group" do | |
124 | + delete api("/groups/1328", user1) | |
125 | + response.status.should == 404 | |
126 | + end | |
127 | + | |
128 | + it "should not remove a group not attached to user1" do | |
129 | + delete api("/groups/#{group2.id}", user1) | |
130 | + response.status.should == 403 | |
131 | + end | |
132 | + end | |
133 | + | |
134 | + context "when authenticated as admin" do | |
135 | + it "should remove any existing group" do | |
136 | + delete api("/groups/#{group2.id}", admin) | |
137 | + response.status.should == 200 | |
138 | + end | |
139 | + | |
140 | + it "should not remove a non existing group" do | |
141 | + delete api("/groups/1328", admin) | |
142 | + response.status.should == 404 | |
143 | + end | |
144 | + end | |
145 | + end | |
146 | + | |
109 | 147 | describe "POST /groups/:id/projects/:project_id" do |
110 | 148 | let(:project) { create(:project) } |
111 | 149 | before(:each) do | ... | ... |