diff options
author | Nick Thomas <nick@gitlab.com> | 2016-12-08 01:09:18 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-12-15 13:57:03 +0000 |
commit | 93a03cd92f6418fbeaf126c30c161ab40d377e94 (patch) | |
tree | 0f49cd51558b97b8674e72b200e7d9150562e00e /spec/lib/gitlab/regex_spec.rb | |
parent | 35a3e9183052bab847c30203f27fea9cf77901a4 (diff) | |
download | gitlab-ce-93a03cd92f6418fbeaf126c30c161ab40d377e94.tar.gz |
Add an environment slug
Diffstat (limited to 'spec/lib/gitlab/regex_spec.rb')
-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 |