summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-02-22 16:09:11 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-02-22 16:09:11 +0000
commit05f4788eab747d2529ebf2b7a3dd3e1ee2385fa3 (patch)
tree8b3c072c3779247eaca15481c2a74d8fb18f4a5a /spec/support
parent2d004982475180c84e1e0f83ede3e6569192ec74 (diff)
parent028562a049f6b5738731be9bedb2b2d9da1b575d (diff)
downloadgitlab-ce-05f4788eab747d2529ebf2b7a3dd3e1ee2385fa3.tar.gz
Merge branch 'fix-500-for-invalid-upload-path' into 'master'
Fix 500 error when loading an invalid upload URL Closes gitlab-ee#4998 See merge request gitlab-org/gitlab-ce!17267
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb b/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb
index 7ce80c82439..ea7dbade171 100644
--- a/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb
+++ b/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb
@@ -89,6 +89,19 @@ shared_examples 'handle uploads' do
end
end
+ context "when neither the uploader nor the model exists" do
+ before do
+ allow_any_instance_of(Upload).to receive(:build_uploader).and_return(nil)
+ allow(controller).to receive(:find_model).and_return(nil)
+ end
+
+ it "responds with status 404" do
+ show_upload
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+
context "when the file doesn't exist" do
before do
allow_any_instance_of(FileUploader).to receive(:exists?).and_return(false)