summaryrefslogtreecommitdiff
path: root/spec/lib/banzai
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-11-06 17:12:20 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-11-06 17:12:20 +0000
commit3301876bcce517ce233893004012606ffef070a2 (patch)
tree13d70feb4f026e7d0d61d8cd5ead70439f41237d /spec/lib/banzai
parentea3b8864e8f4d577e7f06ccaa7d9bac30be162d9 (diff)
parent9de175bfff747dd490c1b18a73ef9f04321e9806 (diff)
downloadgitlab-ce-3301876bcce517ce233893004012606ffef070a2.tar.gz
Merge branch 'allow_single_letter_external_issue_ids' into 'master'
Allow single letter external issue IDs Closes #52803 See merge request gitlab-org/gitlab-ce!22717
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r--spec/lib/banzai/filter/external_issue_reference_filter_spec.rb28
1 files changed, 23 insertions, 5 deletions
diff --git a/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb b/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb
index 0d0554a2259..a0270d93d50 100644
--- a/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/external_issue_reference_filter_spec.rb
@@ -101,15 +101,24 @@ describe Banzai::Filter::ExternalIssueReferenceFilter do
context "redmine project" do
let(:project) { create(:redmine_project) }
- let(:issue) { ExternalIssue.new("#123", project) }
- let(:reference) { issue.to_reference }
before do
- project.issues_enabled = false
- project.save!
+ project.update!(issues_enabled: false)
+ end
+
+ context "with a hash prefix" do
+ let(:issue) { ExternalIssue.new("#123", project) }
+ let(:reference) { issue.to_reference }
+
+ it_behaves_like "external issue tracker"
end
- it_behaves_like "external issue tracker"
+ context "with a single-letter prefix" do
+ let(:issue) { ExternalIssue.new("T-123", project) }
+ let(:reference) { issue.to_reference }
+
+ it_behaves_like "external issue tracker"
+ end
end
context "jira project" do
@@ -122,6 +131,15 @@ describe Banzai::Filter::ExternalIssueReferenceFilter do
it_behaves_like "external issue tracker"
end
+ context "with a single-letter prefix" do
+ let(:issue) { ExternalIssue.new("J-123", project) }
+
+ it "ignores reference" do
+ exp = act = "Issue #{reference}"
+ expect(filter(act).to_html).to eq exp
+ end
+ end
+
context "with wrong markdown" do
let(:issue) { ExternalIssue.new("#123", project) }