diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /spec/lib/gitlab/regex_spec.rb | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/lib/gitlab/regex_spec.rb')
-rw-r--r-- | spec/lib/gitlab/regex_spec.rb | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index f1b4e50b1eb..9514654204b 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -12,22 +12,29 @@ RSpec.describe Gitlab::Regex do it { is_expected.to match('Dash – is this') } end - shared_examples_for 'project/group name regex' do + shared_examples_for 'group name regex' do it_behaves_like 'project/group name chars regex' it { is_expected.not_to match('?gitlab') } it { is_expected.not_to match("Users's something") } end + shared_examples_for 'project name regex' do + it_behaves_like 'project/group name chars regex' + it { is_expected.to match("Gitlab++") } + it { is_expected.not_to match('?gitlab') } + it { is_expected.not_to match("Users's something") } + end + describe '.project_name_regex' do subject { described_class.project_name_regex } - it_behaves_like 'project/group name regex' + it_behaves_like 'project name regex' end describe '.group_name_regex' do subject { described_class.group_name_regex } - it_behaves_like 'project/group name regex' + it_behaves_like 'group name regex' it 'allows parenthesis' do is_expected.to match('Group One (Test)') @@ -51,7 +58,7 @@ RSpec.describe Gitlab::Regex do describe '.project_name_regex_message' do subject { described_class.project_name_regex_message } - it { is_expected.to eq("can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'.") } + it { is_expected.to eq("can contain only letters, digits, emojis, '_', '.', '+', dashes, or spaces. It must start with a letter, digit, emoji, or '_'.") } end describe '.group_name_regex_message' do @@ -646,13 +653,24 @@ RSpec.describe Gitlab::Regex do it { is_expected.to match('release') } it { is_expected.to match('my-repo') } - it { is_expected.to match('my-repo42') } + it { is_expected.to match('My-Re_po') } + it { is_expected.to match('my_repo42') } + it { is_expected.to match('1.2.3') } + it { is_expected.to match('v1.2.3-beta-12') } + it { is_expected.to match('renovate_https-github.com-operator-framework-operator-lifecycle-manager.git-0.x') } # Do not allow empty it { is_expected.not_to match('') } # Do not allow Unicode it { is_expected.not_to match('hé') } + + it { is_expected.not_to match('.1.23') } + it { is_expected.not_to match('1..23') } + it { is_expected.not_to match('1.2.3.') } + it { is_expected.not_to match('1..2.3.') } + it { is_expected.not_to match('1/../2.3.') } + it { is_expected.not_to match('1/..%2F2.3.') } end describe '.helm_package_regex' do |