Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
c27c65f9
Commit
c27c65f9
authored
Dec 21, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fall back to the `MergeRequestWidgetEntity`
When no serializer was passed.
parent
3ee5fd15
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
app/serializers/merge_request_serializer.rb
app/serializers/merge_request_serializer.rb
+1
-1
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+8
-0
spec/serializers/merge_request_serializer_spec.rb
spec/serializers/merge_request_serializer_spec.rb
+2
-2
No files found.
app/serializers/merge_request_serializer.rb
View file @
c27c65f9
...
...
@@ -7,7 +7,7 @@ class MergeRequestSerializer < BaseSerializer
case
opts
[
:serializer
]
when
'basic'
,
'sidebar'
MergeRequestBasicEntity
when
'widget'
else
# It's
'widget'
MergeRequestWidgetEntity
end
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
c27c65f9
...
...
@@ -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
...
...
spec/serializers/merge_request_serializer_spec.rb
View file @
c27c65f9
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment