Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-03 12:38:39 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-03 12:38:39 +0300
commit1a47986b3d7cd8e6d5bdbfbc20a841cf5586f773 (patch)
tree50d421d260f6ef1fb7d5d9f564494fe9d23d09bf /spec/lib/container_registry
parent01280a5ad56f67ae653dade815faa5649bcee81f (diff)
Check registry repository name against regexp
This regexp is extracted from Docker Distribution 2.4.1 docs, contains additional `/` element that can be a separator of components.
Diffstat (limited to 'spec/lib/container_registry')
-rw-r--r--spec/lib/container_registry/path_spec.rb24
1 files changed, 15 insertions, 9 deletions
diff --git a/spec/lib/container_registry/path_spec.rb b/spec/lib/container_registry/path_spec.rb
index 68732b12542..1973da65f0a 100644
--- a/spec/lib/container_registry/path_spec.rb
+++ b/spec/lib/container_registry/path_spec.rb
@@ -36,25 +36,31 @@ describe ContainerRegistry::Path do
context 'when path has less than two components' do
let(:path) { 'something/' }
- it 'is not valid' do
- expect(subject).not_to be_valid
- end
+ it { is_expected.not_to be_valid }
end
context 'when path has more than allowed number of components' do
let(:path) { 'a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/r/s/t/u/w/y/z' }
- it 'is not valid' do
- expect(subject).not_to be_valid
- end
+ it { is_expected.not_to be_valid }
+ end
+
+ context 'when path has invalid characters' do
+ let(:path) { 'some\path' }
+
+ it { is_expected.not_to be_valid }
end
context 'when path has two or more components' do
let(:path) { 'some/path' }
- it 'is valid' do
- expect(subject).to be_valid
- end
+ it { is_expected.to be_valid }
+ end
+
+ context 'when path is related to multi-level image' do
+ let(:path) { 'some/path/my/image' }
+
+ it { is_expected.to be_valid }
end
end