53 lines
1.8 KiB
Ruby
53 lines
1.8 KiB
Ruby
# coding: utf-8
|
||
require 'spec_helper'
|
||
|
||
describe Gitlab::Regex do
|
||
describe '.project_name_regex' do
|
||
subject { described_class.project_name_regex }
|
||
|
||
it { is_expected.to match('gitlab-ce') }
|
||
it { is_expected.to match('GitLab CE') }
|
||
it { is_expected.to match('100 lines') }
|
||
it { is_expected.to match('gitlab.git') }
|
||
it { is_expected.to match('Český název') }
|
||
it { is_expected.to match('Dash – is this') }
|
||
it { is_expected.not_to match('?gitlab') }
|
||
end
|
||
|
||
describe '.environment_name_regex' do
|
||
subject { described_class.environment_name_regex }
|
||
|
||
it { is_expected.to match('foo') }
|
||
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('!!()()') }
|
||
end
|
||
|
||
describe '.environment_slug_regex' do
|
||
subject { described_class.environment_slug_regex }
|
||
|
||
it { is_expected.to match('foo') }
|
||
it { is_expected.to match('foo-1') }
|
||
it { is_expected.not_to match('FOO') }
|
||
it { is_expected.not_to match('foo/1') }
|
||
it { is_expected.not_to match('foo.1') }
|
||
it { is_expected.not_to match('foo*1') }
|
||
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
|