BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
merge_request_serializer.rb
app/serializers/merge_request_serializer.rb
+1
-1
merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+8
-0
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