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
2cca78b1
Commit
2cca78b1
authored
Apr 27, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add external issues to ReferenceExtractor
parent
d2b36e6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
22 deletions
+15
-22
lib/gitlab/reference_extractor.rb
lib/gitlab/reference_extractor.rb
+5
-12
spec/lib/gitlab/reference_extractor_spec.rb
spec/lib/gitlab/reference_extractor_spec.rb
+10
-10
No files found.
lib/gitlab/reference_extractor.rb
View file @
2cca78b1
...
...
@@ -23,19 +23,12 @@ module Gitlab
end
def
issues
# TODO (rspeicher): What about external issues?
#EE code
#<<<<<<< HEAD
#references[:issue].uniq.map do |project, identifier|
#if project.default_issues_tracker?
#project.issues.where(iid: identifier).first
#elsif project.jira_tracker?
#JiraIssue.new(identifier, project)
#end
#end.compact.uniq
#=======
if
project
.
default_issues_tracker?
result
=
pipeline_result
(
:issue
)
elsif
project
.
jira_tracker?
result
=
pipeline_result
(
:external_issue
)
end
result
=
pipeline_result
(
:issue
)
result
.
uniq
end
...
...
spec/lib/gitlab/reference_extractor_spec.rb
View file @
2cca78b1
...
...
@@ -24,16 +24,6 @@ describe Gitlab::ReferenceExtractor do
expect
(
subject
.
issues
).
to
eq
([
@i0
,
@i1
])
end
it
'returns JIRA issues for a JIRA-integrated project'
do
project
.
stub
(
jira_tracker?:
true
)
project
.
stub
(
default_issues_tracker?:
false
)
subject
.
analyze
(
'JIRA-123 and FOOBAR-4567'
)
subject
.
issues
.
should
eq
(
[
JiraIssue
.
new
(
'JIRA-123'
,
project
),
JiraIssue
.
new
(
'FOOBAR-4567'
,
project
)]
)
end
it
'accesses valid merge requests'
do
@m0
=
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
source_branch:
'aaa'
)
@m1
=
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
source_branch:
'bbb'
)
...
...
@@ -83,6 +73,16 @@ describe Gitlab::ReferenceExtractor do
expect
(
extracted
.
first
.
commit_to
).
to
eq
commit
end
context
'with an external issue tracker'
do
let
(
:project
)
{
create
(
:jira_project
)
}
subject
{
described_class
.
new
(
project
,
project
.
creator
)
}
it
'returns JIRA issues for a JIRA-integrated project'
do
subject
.
analyze
(
'JIRA-123 and FOOBAR-4567'
)
expect
(
subject
.
issues
).
to
eq
[
JiraIssue
.
new
(
'JIRA-123'
,
project
),
JiraIssue
.
new
(
'FOOBAR-4567'
,
project
)]
end
end
context
'with a project with an underscore'
do
let
(
:other_project
)
{
create
(
:project
,
path:
'test_project'
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
other_project
)
}
...
...
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