提交 9b288238 编写于 作者: D Douglas Barbosa Alexandre

List all available labels to the project on the labels API

上级 68f30b2f
......@@ -11,7 +11,7 @@ module API
# Example Request:
# GET /projects/:id/labels
get ':id/labels' do
present user_project.labels, with: Entities::Label, current_user: current_user
present available_labels, with: Entities::Label, current_user: current_user
end
# Creates a new label
......
......@@ -12,12 +12,18 @@ describe API::API, api: true do
end
describe 'GET /projects/:id/labels' do
it 'returns project labels' do
it 'returns all available labels to the project' do
group = create(:group)
group_label = create(:group_label, group: group)
project.update(group: group)
get api("/projects/#{project.id}/labels", 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.first['name']).to eq(label1.name)
expect(json_response.size).to eq(2)
expect(json_response.first['name']).to eq(group_label.name)
expect(json_response.second['name']).to eq(label1.name)
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册