BigW Consortium Gitlab

Commit c27c65f9 by Bob Van Landuyt

Fall back to the `MergeRequestWidgetEntity`

When no serializer was passed.
parent 3ee5fd15
......@@ -7,7 +7,7 @@ class MergeRequestSerializer < BaseSerializer
case opts[:serializer]
when 'basic', 'sidebar'
MergeRequestBasicEntity
when 'widget'
else # It's 'widget'
MergeRequestWidgetEntity
end
......
......@@ -98,6 +98,14 @@ describe Projects::MergeRequestsController do
expect(response).to match_response_schema('entities/merge_request_widget')
end
end
context 'when no serialiser was passed' do
it 'renders widget MR entity as json' do
go(serializer: nil, format: :json)
expect(response).to match_response_schema('entities/merge_request_widget')
end
end
end
describe "as diff" do
......
......@@ -36,8 +36,8 @@ describe MergeRequestSerializer do
context 'no serializer' do
let(:serializer) { nil }
it 'raises an error' do
expect { json_entity }.to raise_error(NoMethodError)
it 'falls back to the widget entity' do
expect(json_entity).to match_schema('entities/merge_request_widget')
end
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