Skip to content
Snippets Groups Projects
Commit 47cf3b4b authored by Nick Thomas's avatar Nick Thomas
Browse files

Fix the groups API endpoint to handle ?owned=true correctly

parent 404a5623
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -57,7 +57,7 @@ class GroupsFinder < UnionFinder
end
 
def owned_groups
current_user&.groups || Group.none
current_user&.owned_groups || Group.none
end
 
def include_public_groups?
Loading
Loading
Loading
Loading
@@ -159,11 +159,14 @@ describe API::Groups do
 
context 'when using owned in the request' do
it 'returns an array of groups the user owns' do
group1.add_master(user2)
get api('/groups', user2), owned: true
 
expect(response).to have_http_status(200)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.length).to eq(1)
expect(json_response.first['name']).to eq(group2.name)
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment