From 5b6d347fcdb915a977369721bbc2545f17467cbb Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 18 Feb 2016 14:19:35 +0100 Subject: Handle raw_repository returning nil in exists? If path_with_namespace is nil Repository#raw_repository will also return nil. Apparently code out there creates a Repository instance without a namespace path. Right. --- spec/models/repository_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spec/models') diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index b97e3cbc70a..ed91b62c534 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -240,6 +240,12 @@ describe Repository, models: true do expect(repository.exists?).to eq(false) end + + it 'returns false when there is no namespace' do + allow(repository).to receive(:path_with_namespace).and_return(nil) + + expect(repository.exists?).to eq(false) + end end describe '#has_visible_content?' do -- cgit v1.2.1