summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-12-21 14:03:15 +0100
committerBob Van Landuyt <bob@vanlanduyt.co>2017-12-21 14:07:55 +0100
commit2882841061be3a96e72180caff19657912e7c8af (patch)
tree2043fb98188dcabc17075f34e5fd115fb6af4066
parent3ee5fd156e3465a1e1c04b2b321c62b577496ee8 (diff)
downloadgitlab-ce-bvl-patch-mr-serializer.tar.gz
Fall back to the `MergeRequestWidgetEntity`bvl-patch-mr-serializer
When no serializer was passed.
-rw-r--r--app/serializers/merge_request_serializer.rb2
-rw-r--r--spec/controllers/projects/merge_requests_controller_spec.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/app/serializers/merge_request_serializer.rb b/app/serializers/merge_request_serializer.rb
index 52eb30d688a..caf193bdae3 100644
--- a/app/serializers/merge_request_serializer.rb
+++ b/app/serializers/merge_request_serializer.rb
@@ -7,7 +7,7 @@ class MergeRequestSerializer < BaseSerializer
case opts[:serializer]
when 'basic', 'sidebar'
MergeRequestBasicEntity
- when 'widget'
+ else # It's 'widget'
MergeRequestWidgetEntity
end
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb
index 58116e6e0fe..45c424af8c4 100644
--- a/spec/controllers/projects/merge_requests_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests_controller_spec.rb
@@ -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