diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-06-15 17:04:17 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-06-16 14:14:19 -0700 |
commit | 8ef3bc5d754e307628027b607dd38ebc00826502 (patch) | |
tree | def90a756c634d96132334541cccdbd80f80ea0f /spec/requests | |
parent | af784cc6e22ca915f20111828ae3252619834419 (diff) | |
download | gitlab-ce-8ef3bc5d754e307628027b607dd38ebc00826502.tar.gz |
Add “Project moved” error to Git-over-HTTP
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/git_http_spec.rb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb index dce78faefc9..000d552bb75 100644 --- a/spec/requests/git_http_spec.rb +++ b/spec/requests/git_http_spec.rb @@ -505,6 +505,33 @@ describe 'Git HTTP requests', lib: true do Rack::Attack::Allow2Ban.reset(ip, options) end end + + context 'and the user requests a redirected path' do + let!(:redirect) { project.route.create_redirect('foo/bar') } + let(:path) { "#{redirect.path}.git" } + let(:project_moved_message) do + <<-MSG.strip_heredoc + Project '#{redirect.path}' was moved to '#{project.full_path}'. + + Please update your Git remote and try again: + + git remote set-url origin #{project.http_url_to_repo} + MSG + end + + it 'downloads get status 404 with "project was moved" message' do + clone_get(path, env) + expect(response).to have_http_status(:not_found) + expect(response.body).to match(project_moved_message) + end + + it 'uploads get status 404 with "project was moved" message' do + upload(path, env) do |response| + expect(response).to have_http_status(:not_found) + expect(response.body).to match(project_moved_message) + end + end + end end context "when the user doesn't have access to the project" do @@ -680,7 +707,7 @@ describe 'Git HTTP requests', lib: true do end context "POST git-receive-pack" do - it "failes to find a route" do + it "fails to find a route" do expect { push_post(project.path_with_namespace) }.to raise_error(ActionController::RoutingError) end end |