diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/gitlab/regex_spec.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/gitlab/regex_spec.rb')
-rw-r--r-- | spec/lib/gitlab/regex_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index 5a2cf2eda8b..9e596400904 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -130,4 +130,37 @@ describe Gitlab::Regex do it { is_expected.not_to match('aa-1234-cc') } it { is_expected.not_to match('9/9/2018') } end + + describe '.kubernetes_namespace_regex' do + subject { described_class.kubernetes_namespace_regex } + + it { is_expected.to match('foo') } + it { is_expected.to match('foo-bar') } + it { is_expected.to match('1foo-bar') } + it { is_expected.to match('foo-bar2') } + it { is_expected.to match('foo-1bar') } + it { is_expected.not_to match('foo.bar') } + it { is_expected.not_to match('Foo') } + it { is_expected.not_to match('FoO') } + it { is_expected.not_to match('FoO-') } + it { is_expected.not_to match('-foo-') } + it { is_expected.not_to match('foo/bar') } + end + + describe '.kubernetes_dns_subdomain_regex' do + subject { described_class.kubernetes_dns_subdomain_regex } + + it { is_expected.to match('foo') } + it { is_expected.to match('foo-bar') } + it { is_expected.to match('foo.bar') } + it { is_expected.to match('foo1.bar') } + it { is_expected.to match('foo1.2bar') } + it { is_expected.to match('foo.bar1') } + it { is_expected.to match('1foo.bar1') } + it { is_expected.not_to match('Foo') } + it { is_expected.not_to match('FoO') } + it { is_expected.not_to match('FoO-') } + it { is_expected.not_to match('-foo-') } + it { is_expected.not_to match('foo/bar') } + end end |