diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/lib/gitlab/closing_issue_extractor_spec.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/lib/gitlab/closing_issue_extractor_spec.rb')
-rw-r--r-- | spec/lib/gitlab/closing_issue_extractor_spec.rb | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/spec/lib/gitlab/closing_issue_extractor_spec.rb b/spec/lib/gitlab/closing_issue_extractor_spec.rb index 279486aa2a1..1422f83c629 100644 --- a/spec/lib/gitlab/closing_issue_extractor_spec.rb +++ b/spec/lib/gitlab/closing_issue_extractor_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe Gitlab::ClosingIssueExtractor do let_it_be_with_reload(:project) { create(:project) } - let_it_be(:project2) { create(:project) } + let_it_be_with_reload(:project2) { create(:project) } let_it_be(:issue) { create(:issue, project: project) } let_it_be(:issue2) { create(:issue, project: project2) } @@ -335,6 +335,17 @@ RSpec.describe Gitlab::ClosingIssueExtractor do end end + context 'when target project has autoclose issues disabled' do + before do + project2.update!(autoclose_referenced_issues: false) + end + + it 'omits the issue reference' do + message = "Closes #{cross_reference}" + expect(subject.closed_by_message(message)).to be_empty + end + end + context "with an invalid URL" do it do message = "Closes https://google.com#{urls.project_issue_path(issue2.project, issue2)}" @@ -443,14 +454,19 @@ RSpec.describe Gitlab::ClosingIssueExtractor do end context "with autoclose referenced issues disabled" do - before do + before_all do project.update!(autoclose_referenced_issues: false) end - it do + it 'excludes same project references' do message = "Awesome commit (Closes #{reference})" expect(subject.closed_by_message(message)).to eq([]) end + + it 'includes issues from other projects with autoclose enabled' do + message = "Closes #{cross_reference}" + expect(subject.closed_by_message(message)).to eq([issue2]) + end end end |