diff options
Diffstat (limited to 'spec/lib/gitlab/regex_spec.rb')
-rw-r--r-- | spec/lib/gitlab/regex_spec.rb | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index 979f4fefcb6..a1079e54975 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -1,7 +1,7 @@ # coding: utf-8 require 'spec_helper' -describe Gitlab::Regex, lib: true do +describe Gitlab::Regex do describe '.project_name_regex' do subject { described_class.project_name_regex } @@ -14,22 +14,22 @@ describe Gitlab::Regex, lib: true do it { is_expected.not_to match('?gitlab') } end - describe '.file_name_regex' do - subject { described_class.file_name_regex } - - it { is_expected.to match('foo@bar') } - end - - describe '.environment_slug_regex' do + describe '.environment_name_regex' do subject { described_class.environment_name_regex } it { is_expected.to match('foo') } + it { is_expected.to match('a') } it { is_expected.to match('foo-1') } it { is_expected.to match('FOO') } it { is_expected.to match('foo/1') } it { is_expected.to match('foo.1') } it { is_expected.not_to match('9&foo') } it { is_expected.not_to match('foo-^') } + it { is_expected.not_to match('!!()()') } + 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('/') } end describe '.environment_slug_regex' do @@ -44,4 +44,15 @@ describe Gitlab::Regex, lib: true do it { is_expected.not_to match('9foo') } it { is_expected.not_to match('foo-') } end + + describe '.container_repository_name_regex' do + subject { described_class.container_repository_name_regex } + + it { is_expected.to match('image') } + it { is_expected.to match('my/image') } + it { is_expected.to match('my/awesome/image-1') } + it { is_expected.to match('my/awesome/image.test') } + it { is_expected.not_to match('.my/image') } + it { is_expected.not_to match('my/image.') } + end end |