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
db453ffd
Commit
db453ffd
authored
May 10, 2019
by
Patrick Derichs
Committed by
Rémy Coutable
May 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "JIRA service: NoMethodError: undefined method `find' for nil:NilClass"
parent
4c16ce11
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
0 deletions
+13
-0
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+1
-0
changelogs/unreleased/60180-jira-service-fix-nil-on-find-call.yml
...gs/unreleased/60180-jira-service-fix-nil-on-find-call.yml
+5
-0
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+7
-0
No files found.
app/models/project_services/jira_service.rb
View file @
db453ffd
...
@@ -265,6 +265,7 @@ class JiraService < IssueTrackerService
...
@@ -265,6 +265,7 @@ class JiraService < IssueTrackerService
def
find_remote_link
(
issue
,
url
)
def
find_remote_link
(
issue
,
url
)
links
=
jira_request
{
issue
.
remotelink
.
all
}
links
=
jira_request
{
issue
.
remotelink
.
all
}
return
unless
links
links
.
find
{
|
link
|
link
.
object
[
"url"
]
==
url
}
links
.
find
{
|
link
|
link
.
object
[
"url"
]
==
url
}
end
end
...
...
changelogs/unreleased/60180-jira-service-fix-nil-on-find-call.yml
0 → 100644
View file @
db453ffd
---
title
:
'
Resolved
JIRA
service:
NoMethodError:
undefined
method
'
'
find'
'
for
nil:NilClass'
merge_request
:
28206
author
:
type
:
fixed
spec/models/project_services/jira_service_spec.rb
View file @
db453ffd
...
@@ -166,6 +166,13 @@ describe JiraService do
...
@@ -166,6 +166,13 @@ describe JiraService do
).
once
).
once
end
end
it
'does not fail if remote_link.all on issue returns nil'
do
allow
(
JIRA
::
Resource
::
Remotelink
).
to
receive
(
:all
).
and_return
(
nil
)
expect
{
@jira_service
.
close_issue
(
resource
,
ExternalIssue
.
new
(
'JIRA-123'
,
project
))
}
.
not_to
raise_error
(
NoMethodError
)
end
# Check https://developer.atlassian.com/jiradev/jira-platform/guides/other/guide-jira-remote-issue-links/fields-in-remote-issue-links
# Check https://developer.atlassian.com/jiradev/jira-platform/guides/other/guide-jira-remote-issue-links/fields-in-remote-issue-links
# for more information
# for more information
it
'creates Remote Link reference in JIRA for comment'
do
it
'creates Remote Link reference in JIRA for comment'
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