diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-01 03:07:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-01 03:07:13 +0300 |
commit | ba557e8fea7c8a825a702ab154fa1574c4d2998a (patch) | |
tree | 9c252889816492ea0ebc5c7f86b1f5cd4a2f3620 /spec/lib/gitlab/reference_extractor_spec.rb | |
parent | d88cacce3f205151867ab3f9297f10cdae4a7025 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/reference_extractor_spec.rb')
-rw-r--r-- | spec/lib/gitlab/reference_extractor_spec.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/lib/gitlab/reference_extractor_spec.rb b/spec/lib/gitlab/reference_extractor_spec.rb index 0ee8c35ae81..4d608c07736 100644 --- a/spec/lib/gitlab/reference_extractor_spec.rb +++ b/spec/lib/gitlab/reference_extractor_spec.rb @@ -262,8 +262,11 @@ RSpec.describe Gitlab::ReferenceExtractor do describe '#all' do let(:issue) { create(:issue, project: project) } + let(:issue2) { create(:issue, project: project) } + let(:issue2_url) { Rails.application.routes.url_helpers.project_issue_url(project, issue2) } let(:label) { create(:label, project: project) } - let(:text) { "Ref. #{issue.to_reference} and #{label.to_reference}" } + let(:alert) { create(:alert_management_alert, project: project) } + let(:text) { "Ref. #{issue.to_reference} and #{label.to_reference} and #{alert.to_reference} and #{issue2_url}" } before do project.add_developer(project.creator) @@ -271,7 +274,22 @@ RSpec.describe Gitlab::ReferenceExtractor do end it 'returns all referables' do - expect(subject.all).to match_array([issue, label]) + expect(subject.all).to match_array([issue, label, alert, issue2]) + end + end + + describe '#alerts' do + let(:alert1) { create(:alert_management_alert, project: project) } + let(:alert2) { create(:alert_management_alert, project: project) } + let(:text) { "Alert ref: #{alert1.to_reference} URL: #{alert2.details_url} Infalid ref: ^alert#0" } + + before do + project.add_developer(project.creator) + subject.analyze(text) + end + + it 'returns alert referables' do + expect(subject.alerts).to match_array([alert1, alert2]) end end |