Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-10-05 20:38:14 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2018-10-05 20:38:14 +0300
commit2c9c7d72383c6e7232077b4949b98bb71c90e521 (patch)
tree957cbfb23b0d45b47f3dcd78dedbed6535e7452d
parent2f720ddd597af85772e266c91d321f6e202a9d80 (diff)
parentcf0a61c20229f4415991ea55262ba78275320daf (diff)
Merge branch 'rails5-fix-artifacts-controller-spec' into 'master'
Rails5: fix artifacts controller download spec See merge request gitlab-org/gitlab-ce!22123
-rw-r--r--changelogs/unreleased/rails5-fix-artifacts-controller-spec.yml6
-rw-r--r--spec/controllers/projects/artifacts_controller_spec.rb14
2 files changed, 14 insertions, 6 deletions
diff --git a/changelogs/unreleased/rails5-fix-artifacts-controller-spec.yml b/changelogs/unreleased/rails5-fix-artifacts-controller-spec.yml
new file mode 100644
index 00000000000..3a399bb836e
--- /dev/null
+++ b/changelogs/unreleased/rails5-fix-artifacts-controller-spec.yml
@@ -0,0 +1,6 @@
+---
+title: 'Rails5: fix artifacts controller download spec Rails5 has params[:file_type]
+ as '''' if file_type is included as nil in the request'
+merge_request: 22123
+author: Jasper Maes
+type: other
diff --git a/spec/controllers/projects/artifacts_controller_spec.rb b/spec/controllers/projects/artifacts_controller_spec.rb
index 436f4525093..6091185e252 100644
--- a/spec/controllers/projects/artifacts_controller_spec.rb
+++ b/spec/controllers/projects/artifacts_controller_spec.rb
@@ -19,15 +19,17 @@ describe Projects::ArtifactsController do
end
describe 'GET download' do
- subject { get :download, namespace_id: project.namespace, project_id: project, job_id: job, file_type: file_type }
+ def download_artifact(extra_params = {})
+ params = { namespace_id: project.namespace, project_id: project, job_id: job }.merge(extra_params)
- context 'when no file type is supplied' do
- let(:file_type) { nil }
+ get :download, params
+ end
+ context 'when no file type is supplied' do
it 'sends the artifacts file' do
expect(controller).to receive(:send_file).with(job.artifacts_file.path, hash_including(disposition: 'attachment')).and_call_original
- subject
+ download_artifact
end
end
@@ -36,7 +38,7 @@ describe Projects::ArtifactsController do
let(:file_type) { 'invalid' }
it 'returns 404' do
- subject
+ download_artifact(file_type: file_type)
expect(response).to have_gitlab_http_status(404)
end
@@ -52,7 +54,7 @@ describe Projects::ArtifactsController do
it 'sends the codequality report' do
expect(controller).to receive(:send_file).with(job.job_artifacts_codequality.file.path, hash_including(disposition: 'attachment')).and_call_original
- subject
+ download_artifact(file_type: file_type)
end
end
end