Commit b5af4fb1 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Allow importing groups projects

parent 8dc91cde
......@@ -1092,13 +1092,13 @@ module API
end
module Github
class User < Grape::Entity
expose :username
class Namespace < Grape::Entity
expose :path, as: :login
end
class Repository < Grape::Entity
expose :id
expose :owner, using: User
expose :namespace, as: :owner, using: Namespace
expose :name
end
......
......@@ -40,13 +40,21 @@ describe API::V3::GithubRepos do
describe 'GET /users/:id/repos' do
context 'authenticated' do
it 'returns an array of projects with github format' do
group = create(:group)
create(:project, group: group)
group.add_master(user)
get v3_api("/users/whatever/repos", user)
expect(response).to have_http_status(200)
expect(json_response).to be_an(Array)
expect(json_response.size).to eq(1)
expect(json_response.size).to eq(2)
expect(json_response.first.keys).to contain_exactly('id', 'owner', 'name')
expect(json_response.first['owner'].keys).to contain_exactly('login')
expect(json_response.second.keys).to contain_exactly('id', 'owner', 'name')
expect(json_response.second['owner'].keys).to contain_exactly('login')
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment