diff options
author | Rémy Coutable <remy@rymai.me> | 2016-10-31 18:37:13 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-10-31 18:47:30 +0100 |
commit | e5c6f943fe6e33510813f05a6f7e6d56af47461a (patch) | |
tree | d93062daf78ef0179cf96c071cdb999e0ccca74e /spec/requests | |
parent | a60cc42b262cb63ce5d2284f1f3f41d6521daa14 (diff) | |
download | gitlab-ce-e5c6f943fe6e33510813f05a6f7e6d56af47461a.tar.gz |
Backport Group API code that was added in EE onlybackport-ee-js-groups-api
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/groups_spec.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 3ba257256a0..7b47bf5afc1 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -37,7 +37,7 @@ describe API::API, api: true do end end - context "when authenticated as admin" do + context "when authenticated as admin" do it "admin: returns an array of all groups" do get api("/groups", admin) expect(response).to have_http_status(200) @@ -55,6 +55,17 @@ describe API::API, api: true do expect(json_response.length).to eq(1) end end + + context "when using all_available in request" do + it "returns all groups you have access to" do + public_group = create :group, :public + get api("/groups", user1), all_available: true + + expect(response).to have_http_status(200) + expect(json_response).to be_an Array + expect(json_response.first['name']).to eq(public_group.name) + end + end end describe "GET /groups/:id" do |