diff options
author | Michael Kozono <mkozono@gmail.com> | 2018-02-22 10:51:00 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-02-24 16:22:29 -0800 |
commit | 4be20ba923c010c105e30ef8bba3b9bf82b2d0ca (patch) | |
tree | 33d714281823bc7f21739a3f11a4328f6c3b7030 /spec/lib | |
parent | b9ed721bc23ef2debe321393c2bc161a60912e5e (diff) | |
download | gitlab-ce-4be20ba923c010c105e30ef8bba3b9bf82b2d0ca.tar.gz |
Respond 404 when repo does not existmk/fix-error-code-for-repo-does-not-exist
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/git_access_spec.rb | 13 | ||||
-rw-r--r-- | spec/lib/gitlab/git_access_wiki_spec.rb | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index 19d3f55501e..6f07e423c1b 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -534,6 +534,19 @@ describe Gitlab::GitAccess do expect { pull_access_check }.to raise_unauthorized('Your account has been blocked.') end + context 'when the project repository does not exist' do + it 'returns not found' do + project.add_guest(user) + repo = project.repository + FileUtils.rm_rf(repo.path) + + # Sanity check for rm_rf + expect(repo.exists?).to eq(false) + + expect { pull_access_check }.to raise_error(Gitlab::GitAccess::NotFoundError, 'A repository for this project does not exist yet.') + end + end + describe 'without access to project' do context 'pull code' do it { expect { pull_access_check }.to raise_not_found } diff --git a/spec/lib/gitlab/git_access_wiki_spec.rb b/spec/lib/gitlab/git_access_wiki_spec.rb index 215f1ecc9c5..730ede99fc9 100644 --- a/spec/lib/gitlab/git_access_wiki_spec.rb +++ b/spec/lib/gitlab/git_access_wiki_spec.rb @@ -57,7 +57,7 @@ describe Gitlab::GitAccessWiki do # Sanity check for rm_rf expect(wiki_repo.exists?).to eq(false) - expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'A repository for this project does not exist yet.') + expect { subject }.to raise_error(Gitlab::GitAccess::NotFoundError, 'A repository for this project does not exist yet.') end end end |