summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaldinof <baldinof@gmail.com>2016-03-22 10:56:44 +0100
committerBaldinof <baldinof@gmail.com>2016-03-22 15:36:50 +0100
commitb372968e936a8b02f8d7ff73a1e1cc25b332406c (patch)
tree950a01689abee7cfa68b4ce16ab794487b2e9b37
parentfc6ee359287c6bd286e32ce808e7069714e1732e (diff)
downloadgitlab-ce-b372968e936a8b02f8d7ff73a1e1cc25b332406c.tar.gz
Add number sign on external issue reference text
-rw-r--r--app/models/external_issue.rb8
-rw-r--r--spec/models/external_issue_spec.rb6
2 files changed, 14 insertions, 0 deletions
diff --git a/app/models/external_issue.rb b/app/models/external_issue.rb
index 2ca79df0a29..92f1f174941 100644
--- a/app/models/external_issue.rb
+++ b/app/models/external_issue.rb
@@ -34,7 +34,15 @@ 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}"
+ end
end
diff --git a/spec/models/external_issue_spec.rb b/spec/models/external_issue_spec.rb
index 9b144dd1ecc..b3d0c4efe98 100644
--- a/spec/models/external_issue_spec.rb
+++ b/spec/models/external_issue_spec.rb
@@ -36,4 +36,10 @@ describe ExternalIssue, models: true do
expect(issue.title).to eq "External Issue #{issue}"
end
end
+
+ describe '#reference_link_text' do
+ it 'returns a String reference to the object' do
+ expect(issue.reference_link_text).to eq '#EXT-1234'
+ end
+ end
end