Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-19 16:38:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-19 16:38:27 +0300
commit18d7766e9e65a0966fd91b0959f49c96f8ad5845 (patch)
tree93bea1b4d4fb571a34ec92198d6844e481eaa7af /spec/lib/gitlab
parente23e7bc48165be175d7078d5e6fee002057046fd (diff)
Add latest changes from gitlab-org/gitlab@15-4-stable-ee
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/closing_issue_extractor_spec.rb30
1 files changed, 24 insertions, 6 deletions
diff --git a/spec/lib/gitlab/closing_issue_extractor_spec.rb b/spec/lib/gitlab/closing_issue_extractor_spec.rb
index 1422f83c629..d49c53fe448 100644
--- a/spec/lib/gitlab/closing_issue_extractor_spec.rb
+++ b/spec/lib/gitlab/closing_issue_extractor_spec.rb
@@ -297,14 +297,21 @@ RSpec.describe Gitlab::ClosingIssueExtractor do
end
context 'with an external issue tracker reference' do
+ let_it_be_with_reload(:jira_project) { create(:project, :with_jira_integration, name: 'JIRA_EXT1') }
+
+ let(:jira_issue) { ExternalIssue.new("#{jira_project.name}-1", project: jira_project) }
+ let(:message) { "Resolve #{jira_issue.to_reference}" }
+
+ subject { described_class.new(jira_project, jira_project.creator) }
+
it 'extracts the referenced issue' do
- jira_project = create(:jira_project, name: 'JIRA_EXT1')
- jira_project.add_maintainer(jira_project.creator)
- jira_issue = ExternalIssue.new("#{jira_project.name}-1", project: jira_project)
- closing_issue_extractor = described_class.new(jira_project, jira_project.creator)
- message = "Resolve #{jira_issue.to_reference}"
+ expect(subject.closed_by_message(message)).to eq([jira_issue])
+ end
- expect(closing_issue_extractor.closed_by_message(message)).to eq([jira_issue])
+ it 'extracts the referenced issue even if GitLab issues are disabled for the project' do
+ jira_project.update!(issues_enabled: false)
+
+ expect(subject.closed_by_message(message)).to eq([jira_issue])
end
end
end
@@ -346,6 +353,17 @@ RSpec.describe Gitlab::ClosingIssueExtractor do
end
end
+ context 'when target project has issues disabled' do
+ before do
+ project2.update!(issues_enabled: 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)}"