summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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