diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-12 18:09:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-12 18:09:39 +0300 |
commit | dc889678d1de8c09310b2f8f9742bb6c78a6f1a4 (patch) | |
tree | 70945aa6721a271fc8057efa13c3216a03fbac45 /spec/controllers | |
parent | cd52759ee33051b8ad7b88b02ba7954e4fad7018 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/releases_controller_spec.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/controllers/projects/releases_controller_spec.rb b/spec/controllers/projects/releases_controller_spec.rb index 58fb2a95ce6..ca073c520cd 100644 --- a/spec/controllers/projects/releases_controller_spec.rb +++ b/spec/controllers/projects/releases_controller_spec.rb @@ -200,6 +200,46 @@ describe Projects::ReleasesController do context 'GET #downloads' do subject do + get :downloads, params: { namespace_id: project.namespace, project_id: project, tag: tag, filepath: filepath } + end + + before do + sign_in(user) + end + + let(:release) { create(:release, project: project, tag: tag ) } + let!(:link) { create(:release_link, release: release, name: 'linux-amd64 binaries', filepath: '/binaries/linux-amd64', url: 'https://downloads.example.com/bin/gitlab-linux-amd64') } + let(:tag) { 'v11.9.0-rc2' } + + context 'valid filepath' do + let(:filepath) { CGI.escape('/binaries/linux-amd64') } + + it 'redirects to the asset direct link' do + subject + + expect(response).to redirect_to('https://downloads.example.com/bin/gitlab-linux-amd64') + end + + it 'redirects with a status of 302' do + subject + + expect(response).to have_gitlab_http_status(:redirect) + end + end + + context 'invalid filepath' do + let(:filepath) { CGI.escape('/binaries/win32') } + + it 'is not found' do + subject + + expect(response).to have_gitlab_http_status(:not_found) + end + end + end + + context 'GET #downloads' do + subject do get :downloads, params: { namespace_id: project.namespace, project_id: project, |