Commit 2cca78b1 authored by Robert Speicher's avatar Robert Speicher

Add external issues to ReferenceExtractor

parent d2b36e6b
......@@ -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
......
......@@ -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) }
......
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