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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
7c9418bd
Commit
7c9418bd
authored
Mar 25, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add guard for nil merge_request_diff.id
parent
49c44b65
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
app/controllers/projects/merge_requests/diffs_controller.rb
app/controllers/projects/merge_requests/diffs_controller.rb
+1
-1
spec/controllers/projects/merge_requests/diffs_controller_spec.rb
...trollers/projects/merge_requests/diffs_controller_spec.rb
+12
-0
No files found.
app/controllers/projects/merge_requests/diffs_controller.rb
View file @
7c9418bd
...
@@ -98,7 +98,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
...
@@ -98,7 +98,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
@merge_request
.
merge_request_diff
@merge_request
.
merge_request_diff
end
end
return
unless
@merge_request_diff
return
unless
@merge_request_diff
&
.
id
@comparable_diffs
=
@merge_request_diffs
.
select
{
|
diff
|
diff
.
id
<
@merge_request_diff
.
id
}
@comparable_diffs
=
@merge_request_diffs
.
select
{
|
diff
|
diff
.
id
<
@merge_request_diff
.
id
}
...
...
spec/controllers/projects/merge_requests/diffs_controller_spec.rb
View file @
7c9418bd
...
@@ -16,6 +16,18 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -16,6 +16,18 @@ describe Projects::MergeRequests::DiffsController do
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
context
'when the merge_request_diff.id is blank'
do
it
'returns 404'
do
allow_next_instance_of
(
MergeRequest
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:merge_request_diff
).
and_return
(
MergeRequestDiff
.
new
(
merge_request_id:
instance
.
id
))
go
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
shared_examples
'forked project with submodules'
do
shared_examples
'forked project with submodules'
do
...
...
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