summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/checks/branch_check_spec.rb
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-05-02 11:11:07 +0000
committerGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-05-02 11:11:07 +0000
commit8554eaaf8c461767bae4be077d925aec055dde4b (patch)
tree4d3748f99871b44b64fa4074ff9ecf1eba1ade44 /spec/lib/gitlab/checks/branch_check_spec.rb
parentc6cc9bc94e23e01a01ed191aba993ccf2b443680 (diff)
parent44e981b3fb85a561c9d93f6d823d562b27789df4 (diff)
downloadgitlab-ce-8554eaaf8c461767bae4be077d925aec055dde4b.tar.gz
Merge remote-tracking branch 'dev/15-9-stable' into 15-9-stable
Diffstat (limited to 'spec/lib/gitlab/checks/branch_check_spec.rb')
-rw-r--r--spec/lib/gitlab/checks/branch_check_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/lib/gitlab/checks/branch_check_spec.rb b/spec/lib/gitlab/checks/branch_check_spec.rb
index d6280d3c28c..7f535e86d69 100644
--- a/spec/lib/gitlab/checks/branch_check_spec.rb
+++ b/spec/lib/gitlab/checks/branch_check_spec.rb
@@ -26,8 +26,14 @@ RSpec.describe Gitlab::Checks::BranchCheck do
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, "You cannot create a branch with a 40-character hexadecimal branch name.")
end
+ it "prohibits 40-character hexadecimal branch names as the start of a path" do
+ allow(subject).to receive(:branch_name).and_return("267208abfe40e546f5e847444276f7d43a39503e/test")
+
+ expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, "You cannot create a branch with a 40-character hexadecimal branch name.")
+ end
+
it "doesn't prohibit a nested hexadecimal in a branch name" do
- allow(subject).to receive(:branch_name).and_return("fix-267208abfe40e546f5e847444276f7d43a39503e")
+ allow(subject).to receive(:branch_name).and_return("267208abfe40e546f5e847444276f7d43a39503e-fix")
expect { subject.validate! }.not_to raise_error
end