diff options
author | Chantal Rollison <crollison@gitlab.com> | 2018-09-05 06:24:06 -0700 |
---|---|---|
committer | Chantal Rollison <crollison@gitlab.com> | 2018-09-06 06:33:32 -0700 |
commit | d2161350cc8f8fc5fd9b486a07d518e76a76cde7 (patch) | |
tree | 3c4889e3f6c88d16d574a5a0e230c62d504e2bc3 /spec/controllers | |
parent | c691e07a7bafe51322e6a1ea5ec78fdc426d384c (diff) | |
download | gitlab-ce-d2161350cc8f8fc5fd9b486a07d518e76a76cde7.tar.gz |
Handled exception during file upload
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/uploads_controller_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/controllers/projects/uploads_controller_spec.rb b/spec/controllers/projects/uploads_controller_spec.rb index 325ee53aafb..9802e4d5b1e 100644 --- a/spec/controllers/projects/uploads_controller_spec.rb +++ b/spec/controllers/projects/uploads_controller_spec.rb @@ -18,6 +18,20 @@ describe Projects::UploadsController do end end + context "when exception occurs" do + before do + allow(FileUploader).to receive(:workhorse_authorize).and_raise(SocketError.new) + sign_in(create(:user)) + end + + it "responds with status internal_server_error" do + post_authorize + + expect(response).to have_gitlab_http_status(500) + expect(response.body).to eq('Error uploading file') + end + end + def post_authorize(verified: true) request.headers.merge!(workhorse_internal_api_request_header) if verified |