diff options
Diffstat (limited to 'spec')
-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 |