diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-30 14:45:54 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-30 14:45:54 +0300 |
commit | 003a51d17aea6af92953f7207e2b39a5cb6db8de (patch) | |
tree | 37204d4149b2c63fd0daea365e4a358b820a7882 /spec/lib/container_registry | |
parent | 031122eb54390b4ed792289237ecfb156ec69002 (diff) |
Check container repository exists for a given path
Diffstat (limited to 'spec/lib/container_registry')
-rw-r--r-- | spec/lib/container_registry/path_spec.rb | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/spec/lib/container_registry/path_spec.rb b/spec/lib/container_registry/path_spec.rb index 6384850eb19..906dd920031 100644 --- a/spec/lib/container_registry/path_spec.rb +++ b/spec/lib/container_registry/path_spec.rb @@ -39,7 +39,7 @@ describe ContainerRegistry::Path do it 'is not valid' do expect(subject).not_to be_valid end - end + 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' } @@ -58,6 +58,34 @@ describe ContainerRegistry::Path do end end + describe '#has_repository?' do + context 'when project exists' do + let(:project) { create(:empty_project) } + let(:path) { "#{project.full_path}/my/image" } + + context 'when path already has matching repository' do + before do + create(:container_repository, project: project, name: 'my/image') + end + + it { is_expected.to have_repository } + it { is_expected.to have_project } + end + + context 'when path does not have matching repository' do + it { is_expected.not_to have_repository } + it { is_expected.to have_project } + end + end + + context 'when project does not exist' do + let(:path) { 'some/project/my/image' } + + it { is_expected.not_to have_repository } + it { is_expected.not_to have_project } + end + end + describe '#repository_project' do let(:group) { create(:group, path: 'some_group') } |