summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-04-06 14:14:39 +0000
committerDouwe Maan <douwe@gitlab.com>2018-04-06 14:14:39 +0000
commit44f4a674e2a87d104f700265d835aba000c589f0 (patch)
tree1766e8c5a220fed40333c42e8db8ee02494da224 /spec/controllers
parentfe17613dec7ce0c97ca2c487f27352532968f757 (diff)
parent07f517d441ab8782286b4a59d56a630393d75e16 (diff)
downloadgitlab-ce-44f4a674e2a87d104f700265d835aba000c589f0.tar.gz
Merge branch 'jramsay-38830-tarball' into 'master'
Add alternative archive route Closes #38830 See merge request gitlab-org/gitlab-ce!17225
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/repositories_controller_spec.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/spec/controllers/projects/repositories_controller_spec.rb b/spec/controllers/projects/repositories_controller_spec.rb
index 04d16e98913..31b1b52fdd1 100644
--- a/spec/controllers/projects/repositories_controller_spec.rb
+++ b/spec/controllers/projects/repositories_controller_spec.rb
@@ -6,7 +6,7 @@ describe Projects::RepositoriesController do
describe "GET archive" do
context 'as a guest' do
it 'responds with redirect in correct format' do
- get :archive, namespace_id: project.namespace, project_id: project, format: "zip", ref: 'master'
+ get :archive, namespace_id: project.namespace, project_id: project, id: "master", format: "zip"
expect(response.header["Content-Type"]).to start_with('text/html')
expect(response).to be_redirect
@@ -22,18 +22,25 @@ describe Projects::RepositoriesController do
end
it "uses Gitlab::Workhorse" do
- get :archive, namespace_id: project.namespace, project_id: project, ref: "master", format: "zip"
+ get :archive, namespace_id: project.namespace, project_id: project, id: "master", format: "zip"
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end
+ it 'responds with redirect to the short name archive if fully qualified' do
+ get :archive, namespace_id: project.namespace, project_id: project, id: "master/#{project.path}-master", format: "zip"
+
+ expect(assigns(:ref)).to eq("master")
+ expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
+ end
+
context "when the service raises an error" do
before do
allow(Gitlab::Workhorse).to receive(:send_git_archive).and_raise("Archive failed")
end
it "renders Not Found" do
- get :archive, namespace_id: project.namespace, project_id: project, ref: "master", format: "zip"
+ get :archive, namespace_id: project.namespace, project_id: project, id: "master", format: "zip"
expect(response).to have_gitlab_http_status(404)
end