summaryrefslogtreecommitdiff
path: root/spec/controllers/uploads_controller_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-27 12:08:35 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-27 12:08:35 +0000
commit22e9af3c8b8aedf7f46b786be968862b74a2d07e (patch)
treea10a7d9af40a17fe6cda7b3a681f5e5e2112c16e /spec/controllers/uploads_controller_spec.rb
parentc8e28a0bb8dd45d91cb72ff2c930bc4a562f1fc7 (diff)
downloadgitlab-ce-22e9af3c8b8aedf7f46b786be968862b74a2d07e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/uploads_controller_spec.rb')
-rw-r--r--spec/controllers/uploads_controller_spec.rb60
1 files changed, 30 insertions, 30 deletions
diff --git a/spec/controllers/uploads_controller_spec.rb b/spec/controllers/uploads_controller_spec.rb
index ff15e685007..69e2c085659 100644
--- a/spec/controllers/uploads_controller_spec.rb
+++ b/spec/controllers/uploads_controller_spec.rb
@@ -46,7 +46,7 @@ describe UploadsController do
it "returns 401 when the user is not logged in" do
post :create, params: { model: model, id: snippet.id }, format: :json
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
it "returns 404 when user can't comment on a snippet" do
@@ -55,7 +55,7 @@ describe UploadsController do
sign_in(user)
post :create, params: { model: model, id: private_snippet.id }, format: :json
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -67,7 +67,7 @@ describe UploadsController do
it "returns an error without file" do
post :create, params: { model: model, id: snippet.id }, format: :json
- expect(response).to have_gitlab_http_status(422)
+ expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
it "returns an error with invalid model" do
@@ -78,7 +78,7 @@ describe UploadsController do
it "returns 404 status when object not found" do
post :create, params: { model: model, id: 9999 }, format: :json
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
context 'with valid image' do
@@ -129,7 +129,7 @@ describe UploadsController do
it 'returns 401 when the user has no access' do
post :create, params: { model: 'user', id: user.id }, format: :json
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
context 'when user is logged in' do
@@ -188,7 +188,7 @@ describe UploadsController do
post :create, params: { model: model, id: another_user.id, file: txt }, format: :json
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -246,7 +246,7 @@ describe UploadsController do
it "responds with status 401" do
get :show, params: { model: "user", mounted_as: "avatar", id: user.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
@@ -254,7 +254,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "user", mounted_as: "avatar", id: user.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content publicly cached' do
@@ -271,7 +271,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "user", mounted_as: "avatar", id: user.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content publicly cached' do
@@ -296,7 +296,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content 5 min private cached with revalidation' do
@@ -316,7 +316,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content 5 min private cached with revalidation' do
@@ -338,7 +338,7 @@ describe UploadsController do
it "responds with status 401" do
get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
@@ -361,7 +361,7 @@ describe UploadsController do
it "responds with status 401" do
get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
@@ -369,7 +369,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content 5 min private cached with revalidation' do
@@ -386,7 +386,7 @@ describe UploadsController do
it "responds with status 404" do
get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -401,7 +401,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content 5 min private cached with revalidation' do
@@ -421,7 +421,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content 5 min private cached with revalidation' do
@@ -457,7 +457,7 @@ describe UploadsController do
it "responds with status 401" do
get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
@@ -465,7 +465,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content 5 min private cached with revalidation' do
@@ -482,7 +482,7 @@ describe UploadsController do
it "responds with status 404" do
get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -502,7 +502,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content not cached' do
@@ -522,7 +522,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content not cached' do
@@ -544,7 +544,7 @@ describe UploadsController do
it "responds with status 401" do
get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
@@ -567,7 +567,7 @@ describe UploadsController do
it "responds with status 401" do
get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
@@ -575,7 +575,7 @@ describe UploadsController do
it "responds with status 200" do
get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content not cached' do
@@ -592,7 +592,7 @@ describe UploadsController do
it "responds with status 404" do
get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -607,7 +607,7 @@ describe UploadsController do
it 'responds with status 200' do
get :show, params: { model: 'appearance', mounted_as: 'header_logo', id: appearance.id, filename: 'dk.png' }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content publicly cached' do
@@ -627,7 +627,7 @@ describe UploadsController do
it 'responds with status 200' do
get :show, params: { model: 'appearance', mounted_as: 'logo', id: appearance.id, filename: 'dk.png' }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it_behaves_like 'content publicly cached' do
@@ -648,7 +648,7 @@ describe UploadsController do
it 'successfully returns the file' do
get :show, params: { model: 'appearance', mounted_as: 'favicon', id: appearance.id, filename: 'dk.png' }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(response.header['Content-Disposition']).to end_with 'filename="dk.png"'
end
end
@@ -657,7 +657,7 @@ describe UploadsController do
it 'returns a 404' do
get :show, params: { model: 'appearance', mounted_as: 'favicon', id: appearance.id, filename: 'bogus.png' }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end