diff options
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r-- | spec/models/namespace_spec.rb | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 3649990670b..8913644a3ce 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' describe Namespace do include ProjectForksHelper + include GitHelpers let!(:namespace) { create(:namespace) } let(:gitlab_shell) { Gitlab::Shell.new } @@ -82,6 +83,27 @@ describe Namespace do it { expect(namespace.human_name).to eq(namespace.owner_name) } end + describe '#first_project_with_container_registry_tags' do + let(:container_repository) { create(:container_repository) } + let!(:project) { create(:project, namespace: namespace, container_repositories: [container_repository]) } + + before do + stub_container_registry_config(enabled: true) + end + + it 'returns the project' do + stub_container_registry_tags(repository: :any, tags: ['tag']) + + expect(namespace.first_project_with_container_registry_tags).to eq(project) + end + + it 'returns no project' do + stub_container_registry_tags(repository: :any, tags: nil) + + expect(namespace.first_project_with_container_registry_tags).to be_nil + end + end + describe '.search' do let(:namespace) { create(:namespace) } @@ -184,7 +206,8 @@ describe Namespace do end it 'raises an error about not movable project' do - expect { namespace.move_dir }.to raise_error(/Namespace cannot be moved/) + expect { namespace.move_dir }.to raise_error(Gitlab::UpdatePathError, + /Namespace .* cannot be moved/) end end end @@ -339,9 +362,7 @@ describe Namespace do end def project_rugged(project) - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - project.repository.rugged - end + rugged_repo(project.repository) end end |