Commit 873127d6 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Return JiraIssues in ReferenceExtractor#issues_for

parent d4ae3e4d
...@@ -24,7 +24,9 @@ module Gitlab ...@@ -24,7 +24,9 @@ module Gitlab
def issues_for project def issues_for project
if project.jira_tracker? if project.jira_tracker?
issues.uniq issues.uniq.map do |jira_identifier|
JiraIssue.new(jira_identifier)
end
else else
issues.map do |identifier| issues.map do |identifier|
project.issues.where(iid: identifier).first project.issues.where(iid: identifier).first
......
...@@ -71,6 +71,15 @@ describe Gitlab::ReferenceExtractor do ...@@ -71,6 +71,15 @@ describe Gitlab::ReferenceExtractor do
subject.issues_for(project).should == [@i0, @i1] subject.issues_for(project).should == [@i0, @i1]
end end
it 'returns JIRA issues for a JIRA-integrated project' do
project.stub(jira_tracker?: true)
subject.analyze('JIRA-123 and FOOBAR-4567')
subject.issues_for(project).should eq(
[JiraIssue.new('JIRA-123'), JiraIssue.new('FOOBAR-4567')]
)
end
it 'accesses valid merge requests' do it 'accesses valid merge requests' do
@m0 = create(:merge_request, source_project: project, target_project: project, source_branch: 'aaa') @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') @m1 = create(:merge_request, source_project: project, target_project: project, source_branch: 'bbb')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment