Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlake Hitchcock <rbhitchcock@gmail.com>2016-01-25 19:27:03 +0300
committerBlake Hitchcock <rbhitchcock@gmail.com>2016-01-26 23:55:40 +0300
commit4be65c3231f1bc260134d1c301b24baf87ef1552 (patch)
treed4ab7e3962fe10533dc56451d3eb5cdbdcaa5648 /spec/models/external_issue_spec.rb
parent95c644dfa2b433e9658f7ea1e76c08bf1fcc74ab (diff)
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.
Diffstat (limited to 'spec/models/external_issue_spec.rb')
-rw-r--r--spec/models/external_issue_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/external_issue_spec.rb b/spec/models/external_issue_spec.rb
index 6ec6b9037a4..9b144dd1ecc 100644
--- a/spec/models/external_issue_spec.rb
+++ b/spec/models/external_issue_spec.rb
@@ -10,6 +10,21 @@ describe ExternalIssue, models: true do
it { is_expected.to include_module(Referable) }
end
+ describe '.reference_pattern' do
+ it 'allows underscores in the project name' do
+ expect(ExternalIssue.reference_pattern.match('EXT_EXT-1234')[0]).to eq 'EXT_EXT-1234'
+ end
+
+ it 'allows numbers in the project name' do
+ expect(ExternalIssue.reference_pattern.match('EXT3_EXT-1234')[0]).to eq 'EXT3_EXT-1234'
+ end
+
+ it 'requires the project name to begin with A-Z' do
+ expect(ExternalIssue.reference_pattern.match('3EXT_EXT-1234')).to eq nil
+ expect(ExternalIssue.reference_pattern.match('EXT_EXT-1234')[0]).to eq 'EXT_EXT-1234'
+ end
+ end
+
describe '#to_reference' do
it 'returns a String reference to the object' do
expect(issue.to_reference).to eq issue.id