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 13:49:54 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-03 14:03:16 +0300
commitfd30b3d4972180b6e91d0180b140f32622c48b1d (patch)
tree9ff40552f415568869ee3ec86c2f5a276c3ab4b9 /spec/models/container_repository_spec.rb
parent6fefa794304a6233368b592422ea0fb71a2700f0 (diff)
Ensure root container repository when visiting registry
Root container repository is a images repository that had been created before 9.1, before we introduced multi-level images support.
Diffstat (limited to 'spec/models/container_repository_spec.rb')
-rw-r--r--spec/models/container_repository_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/models/container_repository_spec.rb b/spec/models/container_repository_spec.rb
index 503da6556c0..b23ed8e30b6 100644
--- a/spec/models/container_repository_spec.rb
+++ b/spec/models/container_repository_spec.rb
@@ -98,6 +98,43 @@ describe ContainerRepository do
end
end
+ describe '#root_repository?' do
+ context 'when repository is a root repository' do
+ let(:repository) { create(:container_repository, :root) }
+
+ it 'returns true' do
+ expect(repository).to be_root_repository
+ end
+ end
+
+ context 'when repository is not a root repository' do
+ it 'returns false' do
+ expect(container_repository).not_to be_root_repository
+ end
+ end
+ end
+
+ describe '.build_from_path' do
+ let(:path) { project.full_path + '/some/image' }
+ let(:repository_path) { ContainerRegistry::Path.new(path) }
+
+ let(:repository) do
+ described_class.build_from_path(ContainerRegistry::Path.new(path))
+ end
+
+ it 'fabricates repository assigned to a correct project' do
+ expect(repository.project).to eq project
+ end
+
+ it 'fabricates repository with a correct name' do
+ expect(repository.name).to eq 'some/image'
+ end
+
+ it 'is not persisted' do
+ expect(repository).not_to be_persisted
+ end
+ end
+
describe '.create_from_path!' do
let(:repository) do
described_class.create_from_path!(ContainerRegistry::Path.new(path))