Commit 5011d83c authored by Yauhen Kotau's avatar Yauhen Kotau

Lowercase letters support and additional tests for YouTrack integration service

parent fdfa6f1e
......@@ -8,9 +8,9 @@ class YoutrackService < IssueTrackerService
# {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1
def self.reference_pattern(only_long: false)
if only_long
/(?<issue>\b[A-Z][A-Z0-9_]*-\d+)/
/(?<issue>\b[A-Z][A-Za-z0-9_]*-\d+)/
else
/(?<issue>\b[A-Z][A-Z0-9_]*-\d+)|(#{Issue.reference_prefix}(?<issue>\d+))/
/(?<issue>\b[A-Z][A-Za-z0-9_]*-\d+)|(#{Issue.reference_prefix}(?<issue>\d+))/
end
end
......
......@@ -87,6 +87,7 @@ def fill_form(active = true)
end
it_behaves_like 'external issue tracker activation', tracker: 'Redmine'
it_behaves_like 'external issue tracker activation', tracker: 'YouTrack'
it_behaves_like 'external issue tracker activation', tracker: 'Bugzilla'
it_behaves_like 'external issue tracker activation', tracker: 'Custom Issue Tracker'
end
......@@ -135,6 +135,20 @@ def helper
it_behaves_like "external issue tracker"
end
context "with underscores in the prefix" do
let(:issue) { ExternalIssue.new("PRJ_1-123", project) }
let(:reference) { issue.to_reference }
it_behaves_like "external issue tracker"
end
context "with lowercase letters in the prefix" do
let(:issue) { ExternalIssue.new("YTkPrj-123", project) }
let(:reference) { issue.to_reference }
it_behaves_like "external issue tracker"
end
context "with a single-letter prefix" do
let(:issue) { ExternalIssue.new("T-123", project) }
let(:reference) { issue.to_reference }
......
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