Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorja Aparicio <borja.aparicio.cotarelo@cern.ch>2016-10-25 16:22:12 +0300
committerBorja Aparicio <borja.aparicio.cotarelo@cern.ch>2016-11-08 12:55:35 +0300
commit4f2c4411615a7c870fd1fa54525079f7ea97d6e5 (patch)
treeca57b1d7a9c73af784300f637984c2746323d719 /spec/requests/api/groups_spec.rb
parentc2e2cde910008e148c0af49ee6135be0b3d7f7d9 (diff)
Added API endpoint groups/owned
Diffstat (limited to 'spec/requests/api/groups_spec.rb')
-rw-r--r--spec/requests/api/groups_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb
index 7b47bf5afc1..b29a13b1d8b 100644
--- a/spec/requests/api/groups_spec.rb
+++ b/spec/requests/api/groups_spec.rb
@@ -68,6 +68,24 @@ describe API::API, api: true do
end
end
+ describe 'GET /groups/owned' do
+ context 'when unauthenticated' do
+ it 'returns authentication error' do
+ get api('/groups/owned')
+ expect(response).to have_http_status(401)
+ end
+ end
+
+ context 'when authenticated as group owner' do
+ it 'returns an array of groups the user owns' do
+ get api('/groups/owned', user2)
+ expect(response).to have_http_status(200)
+ expect(json_response).to be_an Array
+ expect(json_response.first['name']).to eq(group2.name)
+ end
+ end
+ end
+
describe "GET /groups/:id" do
context "when authenticated as user" do
it "returns one of user1's groups" do