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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
3918fce5
Commit
3918fce5
authored
Apr 12, 2016
by
Baldinof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide number sign for string prefixed external issues
parent
b372968e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
app/models/external_issue.rb
app/models/external_issue.rb
+3
-5
spec/models/external_issue_spec.rb
spec/models/external_issue_spec.rb
+11
-2
No files found.
app/models/external_issue.rb
View file @
3918fce5
...
...
@@ -34,15 +34,13 @@ class ExternalIssue
%r{(?<issue>
\b
([A-Z][A-Z0-9_]+-)
\d
+)}
end
def
self
.
reference_prefix
'#'
end
def
to_reference
(
_from_project
=
nil
)
id
end
def
reference_link_text
(
from_project
=
nil
)
"
#{
self
.
class
.
reference_prefix
}#{
id
}
"
return
"#
#{
id
}
"
if
/^\d+$/
.
match
(
id
)
id
end
end
spec/models/external_issue_spec.rb
View file @
3918fce5
...
...
@@ -38,8 +38,17 @@ describe ExternalIssue, models: true do
end
describe
'#reference_link_text'
do
it
'returns a String reference to the object'
do
expect
(
issue
.
reference_link_text
).
to
eq
'#EXT-1234'
context
'if issue id has a prefix'
do
it
'returns the issue ID'
do
expect
(
issue
.
reference_link_text
).
to
eq
'EXT-1234'
end
end
context
'if issue id is a number'
do
let
(
:issue
)
{
described_class
.
new
(
'1234'
,
project
)
}
it
'returns the issue ID prefixed by #'
do
expect
(
issue
.
reference_link_text
).
to
eq
'#1234'
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