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:
Diffstat (limited to 'spec/lib/gitlab/regex_spec.rb')
-rw-r--r--spec/lib/gitlab/regex_spec.rb28
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