diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-18 23:20:47 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-18 23:20:47 +0300 |
commit | f6a11d00a8d938293a6a223c6f227b935ebe7a3c (patch) | |
tree | f2c34e53147ccbc79098ae28124e21990a91d9e4 /spec/lib/container_registry | |
parent | f88762a5f577fa620e77f38fb6812fe4ee53d237 (diff) |
Fix duplicated container repository names
Diffstat (limited to 'spec/lib/container_registry')
-rw-r--r-- | spec/lib/container_registry/path_spec.rb | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/lib/container_registry/path_spec.rb b/spec/lib/container_registry/path_spec.rb index f3b3a9a715f..0023985e1c2 100644 --- a/spec/lib/container_registry/path_spec.rb +++ b/spec/lib/container_registry/path_spec.rb @@ -189,7 +189,7 @@ describe ContainerRegistry::Path do end context 'when project exists' do - let(:group) { create(:group, path: 'some_group') } + let(:group) { create(:group, path: 'Some_Group') } let(:project) do create(:empty_project, group: group, name: 'some_project') @@ -225,4 +225,33 @@ describe ContainerRegistry::Path do end end end + + describe '#project_path' do + context 'when project does not exist' do + let(:path) { 'some/name' } + + it 'returns nil' do + expect(subject.project_path).to be_nil + end + end + + context 'when project with uppercase characters in path exists' do + let(:path) { 'somegroup/someproject' } + + let(:group) { create(:group, path: 'SomeGroup') } + + let(:project) do + create(:empty_project, group: group, name: 'SomeProject') + end + + before do + allow(path).to receive(:repository_project) + .and_return(project) + end + + it 'returns downcased project path' do + expect(subject.project_path).to eq 'somegroup/someproject' + end + end + end end |