summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-02-18 14:19:35 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-02-18 14:19:35 +0100
commit5b6d347fcdb915a977369721bbc2545f17467cbb (patch)
treeb7f14f50296ec7929f077f0f7a13ed92b79add6e /spec/models
parent19b21c2e0ce1f6288172bd6fadc316f169048071 (diff)
downloadgitlab-ce-5b6d347fcdb915a977369721bbc2545f17467cbb.tar.gz
Handle raw_repository returning nil in exists?autocrlf-lazy
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.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/repository_spec.rb6
1 files changed, 6 insertions, 0 deletions
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