diff options
author | Nick Thomas <nick@gitlab.com> | 2016-12-08 04:09:18 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-12-15 16:57:03 +0300 |
commit | 93a03cd92f6418fbeaf126c30c161ab40d377e94 (patch) | |
tree | 0f49cd51558b97b8674e72b200e7d9150562e00e /spec/lib/gitlab | |
parent | 35a3e9183052bab847c30203f27fea9cf77901a4 (diff) |
Add an environment slug
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/regex_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index c51b10bdc69..c78cd30157e 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -29,4 +29,20 @@ describe Gitlab::Regex, lib: true do describe 'file path regex' do it { expect('foo@/bar').to match(Gitlab::Regex.file_path_regex) } end + + describe 'environment slug regex' do + def be_matched + match(Gitlab::Regex.environment_slug_regex) + end + + it { expect('foo').to be_matched } + it { expect('foo-1').to be_matched } + + it { expect('FOO').not_to be_matched } + it { expect('foo/1').not_to be_matched } + it { expect('foo.1').not_to be_matched } + it { expect('foo*1').not_to be_matched } + it { expect('9foo').not_to be_matched } + it { expect('foo-').not_to be_matched } + end end |