summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/releases_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/projects/releases_controller_spec.rb')
-rw-r--r--spec/controllers/projects/releases_controller_spec.rb97
1 files changed, 1 insertions, 96 deletions
diff --git a/spec/controllers/projects/releases_controller_spec.rb b/spec/controllers/projects/releases_controller_spec.rb
index 420d818daeb..07fb03b39c6 100644
--- a/spec/controllers/projects/releases_controller_spec.rb
+++ b/spec/controllers/projects/releases_controller_spec.rb
@@ -201,102 +201,7 @@ RSpec.describe Projects::ReleasesController do
end
end
- 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,
- tag: tag,
- filepath: filepath
- }
- end
-
- before do
- sign_in(user)
- end
-
- let(:release) { create(:release, project: project, tag: tag ) }
- let(:tag) { 'v11.9.0-rc2' }
- let(:db_filepath) { '/binaries/linux-amd64' }
- let!(:link) do
- create :release_link,
- release: release,
- name: 'linux-amd64 binaries',
- filepath: db_filepath,
- url: 'https://downloads.example.com/bin/gitlab-linux-amd64'
- end
-
- 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(link.url)
- 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
-
- context 'ignores filepath extension' do
- let(:db_filepath) { '/binaries/linux-amd64.json' }
- let(:filepath) { CGI.escape(db_filepath) }
-
- it 'redirects to the asset direct link' do
- subject
-
- expect(response).to redirect_to(link.url)
- end
- end
- end
+ # `GET #downloads` is addressed in spec/requests/projects/releases_controller_spec.rb
private