Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
12867628
Commit
12867628
authored
Apr 20, 2020
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Match Jira keys with trailing characters
parent
b2ee26c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+1
-1
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+16
-4
No files found.
lib/gitlab/regex.rb
View file @
12867628
...
@@ -121,7 +121,7 @@ module Gitlab
...
@@ -121,7 +121,7 @@ module Gitlab
# Based on Jira's project key format
# Based on Jira's project key format
# https://confluence.atlassian.com/adminjiraserver073/changing-the-project-key-format-861253229.html
# https://confluence.atlassian.com/adminjiraserver073/changing-the-project-key-format-861253229.html
def
jira_issue_key_regex
def
jira_issue_key_regex
@jira_issue_key_regex
||=
/[A-Z][A-Z_0-9]+-\d+
\b
/
@jira_issue_key_regex
||=
/[A-Z][A-Z_0-9]+-\d+/
end
end
def
jira_transition_id_regex
def
jira_transition_id_regex
...
...
spec/models/project_services/jira_service_spec.rb
View file @
12867628
...
@@ -69,11 +69,23 @@ describe JiraService do
...
@@ -69,11 +69,23 @@ describe JiraService do
end
end
describe
'.reference_pattern'
do
describe
'.reference_pattern'
do
it_behaves_like
'allows project key on reference pattern'
using
RSpec
::
Parameterized
::
TableSyntax
it
'does not allow # on the code'
do
where
(
:key
,
:result
)
do
expect
(
described_class
.
reference_pattern
.
match
(
'#123'
)).
to
be_nil
'#123'
|
''
expect
(
described_class
.
reference_pattern
.
match
(
'1#23#12'
)).
to
be_nil
'1#23#12'
|
''
'JIRA-1234A'
|
'JIRA-1234'
'JIRA-1234-some_tag'
|
'JIRA-1234'
'JIRA-1234_some_tag'
|
'JIRA-1234'
'EXT_EXT-1234'
|
'EXT_EXT-1234'
'EXT3_EXT-1234'
|
'EXT3_EXT-1234'
'3EXT_EXT-1234'
|
''
end
with_them
do
specify
do
expect
(
described_class
.
reference_pattern
.
match
(
key
).
to_s
).
to
eq
(
result
)
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment