From 4be65c3231f1bc260134d1c301b24baf87ef1552 Mon Sep 17 00:00:00 2001 From: Blake Hitchcock Date: Mon, 25 Jan 2016 11:27:03 -0500 Subject: Update ExternalIssue regex for JIRA integration The pattern in the `::reference_pattern` class method in the ExternalIssue model does not match all valid forms of JIRA project names. I have updated the regex to match JIRA project names with numbers and underscores. More information on valid JIRA project names can be found here: https://confluence.atlassian.com/jira/changing-the-project-key-format-192534.html * The first character must be a letter, * All letters used in the project key must be from the Modern Roman Alphabet and upper case, and * Only letters, numbers or the underscore character can be used. --- spec/lib/gitlab/closing_issue_extractor_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/lib') diff --git a/spec/lib/gitlab/closing_issue_extractor_spec.rb b/spec/lib/gitlab/closing_issue_extractor_spec.rb index 99288da1e43..04cf11fc6f1 100644 --- a/spec/lib/gitlab/closing_issue_extractor_spec.rb +++ b/spec/lib/gitlab/closing_issue_extractor_spec.rb @@ -135,6 +135,17 @@ describe Gitlab::ClosingIssueExtractor, lib: true do message = "resolve #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end + + context 'with an external issue tracker reference' do + it 'extracts the referenced issue' do + jira_project = create(:jira_project, name: 'JIRA_EXT1') + jira_issue = ExternalIssue.new("#{jira_project.name}-1", project: jira_project) + closing_issue_extractor = described_class.new jira_project + message = "Resolve #{jira_issue.to_reference}" + + expect(closing_issue_extractor.closed_by_message(message)).to eq([jira_issue]) + end + end end context "with a cross-project reference" do -- cgit v1.2.1