Commit 1f5b6c83 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'ee-epics-json' into 'master'

Update epics index JSON response

See merge request gitlab-org/gitlab-ee!4281
parents da251af2 5f4165c6
......@@ -17,9 +17,7 @@ class Groups::EpicsController < Groups::ApplicationController
respond_to do |format|
format.html
format.json do
render json: {
html: view_to_html_string("groups/epics/_epics")
}
render json: serializer.represent(@epics)
end
end
end
......@@ -38,6 +36,10 @@ class Groups::EpicsController < Groups::ApplicationController
private
def pagination_disabled?
request.format.json?
end
def epic
@issuable = @epic ||= @group.epics.find_by(iid: params[:epic_id] || params[:id])
......
......@@ -76,6 +76,39 @@ describe Groups::EpicsController do
expect(response).to have_gitlab_http_status(200)
end
end
context 'when format is JSON' do
before do
allow(Kaminari.config).to receive(:default_per_page).and_return(1)
end
def list_epics
get :index, group_id: group, format: :json
end
it 'returns a list of epics' do
list_epics
expect(json_response).to be_an Array
end
it 'does not use pagination' do
list_epics
expect(json_response.size).to eq(2)
end
it 'returns correct epic attributes' do
list_epics
item = json_response.first
epic = Epic.find(item['id'])
expect(item['group_id']).to eq(group.id)
expect(item['start_date']).to eq(epic.start_date)
expect(item['end_date']).to eq(epic.end_date)
expect(item['web_url']).to eq(group_epic_path(group, epic))
end
end
end
describe 'GET #show' do
......
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