diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-30 00:08:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-30 00:08:46 +0300 |
commit | 4f1b5d2757835a204a7b882e2bea32dd8c9dfa6b (patch) | |
tree | 0617ad58ec0f7e8fcbc02bae09976299f9d0a24e /spec/lib/banzai | |
parent | 1bbd0179d7ed8fb17c0574aa74ef491e53c833a7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r-- | spec/lib/banzai/filter/references/external_issue_reference_filter_spec.rb | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/lib/banzai/filter/references/external_issue_reference_filter_spec.rb b/spec/lib/banzai/filter/references/external_issue_reference_filter_spec.rb index 79500f43394..86fb7d3964d 100644 --- a/spec/lib/banzai/filter/references/external_issue_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/references/external_issue_reference_filter_spec.rb @@ -223,7 +223,7 @@ RSpec.describe Banzai::Filter::References::ExternalIssueReferenceFilter, feature end context "jira project" do - let_it_be(:service) { create(:jira_integration, project: project) } + let_it_be_with_reload(:service) { create(:jira_integration, project: project) } let(:reference) { issue.to_reference } @@ -250,6 +250,36 @@ RSpec.describe Banzai::Filter::References::ExternalIssueReferenceFilter, feature expect(filter(act).to_html).to eq exp end end + + context 'with a custom regex' do + before do + service.jira_tracker_data.update!(jira_issue_regex: '[JIRA]{2,}-\\d+') + end + + context "with right markdown" do + let(:issue) { ExternalIssue.new("JIRA-123", project) } + + 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) } + + it "ignores reference" do + exp = act = "Issue #{reference}" + expect(filter(act).to_html).to eq exp + end + end + end end context "ewm project" do |