summaryrefslogtreecommitdiff
path: root/spec/controllers
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
parentc8e28a0bb8dd45d91cb72ff2c930bc4a562f1fc7 (diff)
downloadgitlab-ce-22e9af3c8b8aedf7f46b786be968862b74a2d07e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/acme_challenges_controller_spec.rb4
-rw-r--r--spec/controllers/application_controller_spec.rb18
-rw-r--r--spec/controllers/autocomplete_controller_spec.rb20
-rw-r--r--spec/controllers/chaos_controller_spec.rb28
-rw-r--r--spec/controllers/concerns/metrics_dashboard_spec.rb2
-rw-r--r--spec/controllers/graphql_controller_spec.rb4
-rw-r--r--spec/controllers/groups_controller_spec.rb44
-rw-r--r--spec/controllers/health_check_controller_spec.rb8
-rw-r--r--spec/controllers/help_controller_spec.rb2
-rw-r--r--spec/controllers/invites_controller_spec.rb4
-rw-r--r--spec/controllers/notification_settings_controller_spec.rb4
-rw-r--r--spec/controllers/omniauth_callbacks_controller_spec.rb2
-rw-r--r--spec/controllers/passwords_controller_spec.rb2
-rw-r--r--spec/controllers/profiles_controller_spec.rb2
-rw-r--r--spec/controllers/projects/blame_controller_spec.rb2
-rw-r--r--spec/controllers/projects/blob_controller_spec.rb4
-rw-r--r--spec/controllers/projects/branches_controller_spec.rb6
-rw-r--r--spec/controllers/projects/raw_controller_spec.rb2
-rw-r--r--spec/controllers/projects/tree_controller_spec.rb10
-rw-r--r--spec/controllers/projects_controller_spec.rb86
-rw-r--r--spec/controllers/registrations_controller_spec.rb6
-rw-r--r--spec/controllers/search_controller_spec.rb12
-rw-r--r--spec/controllers/sessions_controller_spec.rb4
-rw-r--r--spec/controllers/snippets_controller_spec.rb40
-rw-r--r--spec/controllers/uploads_controller_spec.rb60
-rw-r--r--spec/controllers/users_controller_spec.rb12
26 files changed, 194 insertions, 194 deletions
diff --git a/spec/controllers/acme_challenges_controller_spec.rb b/spec/controllers/acme_challenges_controller_spec.rb
index cee06bed27b..be077a4b20d 100644
--- a/spec/controllers/acme_challenges_controller_spec.rb
+++ b/spec/controllers/acme_challenges_controller_spec.rb
@@ -28,7 +28,7 @@ describe AcmeChallengesController do
let(:token) { acme_order.challenge_token }
it 'renders not found' do
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -37,7 +37,7 @@ describe AcmeChallengesController do
let(:token) { 'wrongtoken' }
it 'renders not found' do
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index ae7b5784302..c1cfe9f20d2 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -156,7 +156,7 @@ describe ApplicationController do
it 'returns 200 response' do
get :index, format: requested_format
- expect(response).to have_gitlab_http_status 200
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -164,7 +164,7 @@ describe ApplicationController do
it 'returns 404 response' do
get :index
- expect(response).to have_gitlab_http_status 404
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -181,7 +181,7 @@ describe ApplicationController do
get :index
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
it 'redirects to login page if not authenticated' do
@@ -202,7 +202,7 @@ describe ApplicationController do
get :index, format: 'unknown'
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
@@ -489,7 +489,7 @@ describe ApplicationController do
it 'redirects if the user did not accept the terms' do
get :index
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
it 'does not redirect when the user accepted terms' do
@@ -497,7 +497,7 @@ describe ApplicationController do
get :index
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
end
@@ -581,21 +581,21 @@ describe ApplicationController do
it 'renders a 404 without a message' do
get :index
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
expect(response).to render_template('errors/not_found')
end
it 'renders a 403 when a message is passed to access denied' do
get :index, params: { message: 'None shall pass' }
- expect(response).to have_gitlab_http_status(403)
+ expect(response).to have_gitlab_http_status(:forbidden)
expect(response).to render_template('errors/access_denied')
end
it 'renders a status passed to access denied' do
get :index, params: { status: 401 }
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb
index 51f20bae880..1ebbeecc583 100644
--- a/spec/controllers/autocomplete_controller_spec.rb
+++ b/spec/controllers/autocomplete_controller_spec.rb
@@ -32,7 +32,7 @@ describe AutocompleteController do
get(:users, params: { project_id: 'unknown' })
end
- it { expect(response).to have_gitlab_http_status(404) }
+ it { expect(response).to have_gitlab_http_status(:not_found) }
end
end
@@ -61,7 +61,7 @@ describe AutocompleteController do
get(:users, params: { group_id: 'unknown' })
end
- it { expect(response).to have_gitlab_http_status(404) }
+ it { expect(response).to have_gitlab_http_status(:not_found) }
end
end
@@ -140,7 +140,7 @@ describe AutocompleteController do
get(:users, params: { project_id: project.id })
end
- it { expect(response).to have_gitlab_http_status(404) }
+ it { expect(response).to have_gitlab_http_status(:not_found) }
end
describe 'GET #users with unknown project' do
@@ -148,7 +148,7 @@ describe AutocompleteController do
get(:users, params: { project_id: 'unknown' })
end
- it { expect(response).to have_gitlab_http_status(404) }
+ it { expect(response).to have_gitlab_http_status(:not_found) }
end
describe 'GET #users with inaccessible group' do
@@ -157,7 +157,7 @@ describe AutocompleteController do
get(:users, params: { group_id: user.namespace.id })
end
- it { expect(response).to have_gitlab_http_status(404) }
+ it { expect(response).to have_gitlab_http_status(:not_found) }
end
describe 'GET #users with no project' do
@@ -372,7 +372,7 @@ describe AutocompleteController do
it 'returns empty json' do
get :merge_request_target_branches, params: { project_id: project.id }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_empty
end
end
@@ -383,7 +383,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: { project_id: project.id }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_empty
end
end
@@ -404,7 +404,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: params
- expect(response).to have_gitlab_http_status(400)
+ expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response).to eq({ 'error' => 'At least one of group_id or project_id must be specified' })
end
end
@@ -416,7 +416,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: { project_id: project.id }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to contain_exactly({ 'title' => 'feature' })
end
end
@@ -433,7 +433,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: { group_id: group.id }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to contain_exactly({ 'title' => 'feature' })
end
end
diff --git a/spec/controllers/chaos_controller_spec.rb b/spec/controllers/chaos_controller_spec.rb
index bafd4a70862..5812990ce7a 100644
--- a/spec/controllers/chaos_controller_spec.rb
+++ b/spec/controllers/chaos_controller_spec.rb
@@ -9,7 +9,7 @@ describe ChaosController do
get :leakmem
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'call synchronously with params' do
@@ -17,7 +17,7 @@ describe ChaosController do
get :leakmem, params: { memory_mb: 1, duration_s: 2 }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
@@ -25,7 +25,7 @@ describe ChaosController do
get :leakmem, params: { async: 1 }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -35,7 +35,7 @@ describe ChaosController do
get :cpu_spin
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'calls synchronously with params' do
@@ -43,7 +43,7 @@ describe ChaosController do
get :cpu_spin, params: { duration_s: 3 }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
@@ -51,7 +51,7 @@ describe ChaosController do
get :cpu_spin, params: { async: 1 }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -61,7 +61,7 @@ describe ChaosController do
get :db_spin
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'calls synchronously with params' do
@@ -69,7 +69,7 @@ describe ChaosController do
get :db_spin, params: { duration_s: 4, interval_s: 5 }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
@@ -77,7 +77,7 @@ describe ChaosController do
get :db_spin, params: { async: 1 }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -87,7 +87,7 @@ describe ChaosController do
get :sleep
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'calls synchronously with params' do
@@ -95,7 +95,7 @@ describe ChaosController do
get :sleep, params: { duration_s: 5 }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
@@ -103,7 +103,7 @@ describe ChaosController do
get :sleep, params: { async: 1 }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -113,7 +113,7 @@ describe ChaosController do
get :kill
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
@@ -121,7 +121,7 @@ describe ChaosController do
get :kill, params: { async: 1 }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
end
diff --git a/spec/controllers/concerns/metrics_dashboard_spec.rb b/spec/controllers/concerns/metrics_dashboard_spec.rb
index 389d264bed3..6ab02057412 100644
--- a/spec/controllers/concerns/metrics_dashboard_spec.rb
+++ b/spec/controllers/concerns/metrics_dashboard_spec.rb
@@ -72,7 +72,7 @@ describe MetricsDashboard do
it 'includes project_blob_path only for project dashboards' do
expect(system_dashboard['project_blob_path']).to be_nil
- expect(project_dashboard['project_blob_path']).to eq("/#{project.namespace.path}/#{project.name}/blob/master/.gitlab/dashboards/test.yml")
+ expect(project_dashboard['project_blob_path']).to eq("/#{project.namespace.path}/#{project.name}/-/blob/master/.gitlab/dashboards/test.yml")
end
describe 'project permissions' do
diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb
index 9937bdf4061..0c1089dc7a8 100644
--- a/spec/controllers/graphql_controller_spec.rb
+++ b/spec/controllers/graphql_controller_spec.rb
@@ -39,7 +39,7 @@ describe GraphqlController do
it 'returns 200 when user can access API' do
post :execute
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'returns access denied template when user cannot access API' do
@@ -59,7 +59,7 @@ describe GraphqlController do
it 'returns 200' do
post :execute
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
end
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb
index 2ed2b319298..3399ad563a1 100644
--- a/spec/controllers/groups_controller_spec.rb
+++ b/spec/controllers/groups_controller_spec.rb
@@ -136,7 +136,7 @@ describe GroupsController do
get :activity, params: { id: group.to_param }, format: :json
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(json_response['count']).to eq(3)
expect(assigns(:projects).limit_value).to be_nil
end
@@ -151,7 +151,7 @@ describe GroupsController do
post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1)
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
context 'authorization' do
@@ -162,7 +162,7 @@ describe GroupsController do
post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1)
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
@@ -367,7 +367,7 @@ describe GroupsController do
it 'updates the path successfully' do
post :update, params: { id: group.to_param, group: { path: 'new_path' } }
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(controller).to set_flash[:notice]
end
@@ -382,7 +382,7 @@ describe GroupsController do
it 'updates the project_creation_level successfully' do
post :update, params: { id: group.to_param, group: { project_creation_level: ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS } }
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(group.reload.project_creation_level).to eq(::Gitlab::Access::MAINTAINER_PROJECT_ACCESS)
end
@@ -397,7 +397,7 @@ describe GroupsController do
post :update, params: { id: group.to_param, group: { name: 'new_name' } }
expect(controller).to set_flash[:notice]
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(group.reload.name).to eq('new_name')
end
@@ -405,7 +405,7 @@ describe GroupsController do
post :update, params: { id: group.to_param, group: { path: 'new_path' } }
expect(assigns(:group).errors[:base].first).to match(/Docker images in their Container Registry/)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
end
@@ -468,7 +468,7 @@ describe GroupsController do
it 'does not redirect' do
get :issues, params: { id: group.to_param }
- expect(response).not_to have_gitlab_http_status(301)
+ expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
@@ -487,7 +487,7 @@ describe GroupsController do
it 'does not redirect' do
get :show, params: { id: group.to_param }
- expect(response).not_to have_gitlab_http_status(301)
+ expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
@@ -554,13 +554,13 @@ describe GroupsController do
it 'does not 404' do
post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } }
- expect(response).not_to have_gitlab_http_status(404)
+ expect(response).not_to have_gitlab_http_status(:not_found)
end
it 'does not redirect to the correct casing' do
post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } }
- expect(response).not_to have_gitlab_http_status(301)
+ expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
@@ -570,7 +570,7 @@ describe GroupsController do
it 'returns not found' do
post :update, params: { id: redirect_route.path, group: { path: 'new_path' } }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -580,13 +580,13 @@ describe GroupsController do
it 'does not 404' do
delete :destroy, params: { id: group.to_param.upcase }
- expect(response).not_to have_gitlab_http_status(404)
+ expect(response).not_to have_gitlab_http_status(:not_found)
end
it 'does not redirect to the correct casing' do
delete :destroy, params: { id: group.to_param.upcase }
- expect(response).not_to have_gitlab_http_status(301)
+ expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
@@ -596,7 +596,7 @@ describe GroupsController do
it 'returns not found' do
delete :destroy, params: { id: redirect_route.path }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -693,7 +693,7 @@ describe GroupsController do
end
it 'is denied' do
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -755,13 +755,13 @@ describe GroupsController do
it 'is successful' do
get :show, params: { id: group.to_param }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'does not allow other formats' do
get :show, params: { id: group.to_param }, format: :atom
- expect(response).to have_gitlab_http_status(403)
+ expect(response).to have_gitlab_http_status(:forbidden)
end
end
@@ -769,7 +769,7 @@ describe GroupsController do
it 'is successful' do
get :edit, params: { id: group.to_param }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -777,7 +777,7 @@ describe GroupsController do
it 'is successful' do
get :new
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -786,7 +786,7 @@ describe GroupsController do
get :index
# Redirects to the dashboard
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
@@ -810,7 +810,7 @@ describe GroupsController do
it 'deletes the group' do
delete :destroy, params: { id: group.to_param }
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
end
diff --git a/spec/controllers/health_check_controller_spec.rb b/spec/controllers/health_check_controller_spec.rb
index cbcda5d0dc7..d1de669ad43 100644
--- a/spec/controllers/health_check_controller_spec.rb
+++ b/spec/controllers/health_check_controller_spec.rb
@@ -101,7 +101,7 @@ describe HealthCheckController, :request_store do
it 'supports failure plaintext response' do
get :index
- expect(response).to have_gitlab_http_status(500)
+ expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'text/plain'
expect(response.body).to include('The server is on fire')
end
@@ -109,7 +109,7 @@ describe HealthCheckController, :request_store do
it 'supports failure json response' do
get :index, format: :json
- expect(response).to have_gitlab_http_status(500)
+ expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'application/json'
expect(json_response['healthy']).to be false
expect(json_response['message']).to include('The server is on fire')
@@ -118,7 +118,7 @@ describe HealthCheckController, :request_store do
it 'supports failure xml response' do
get :index, format: :xml
- expect(response).to have_gitlab_http_status(500)
+ expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'application/xml'
expect(xml_response['healthy']).to be false
expect(xml_response['message']).to include('The server is on fire')
@@ -127,7 +127,7 @@ describe HealthCheckController, :request_store do
it 'supports failure responses for specific checks' do
get :index, params: { checks: 'email' }, format: :json
- expect(response).to have_gitlab_http_status(500)
+ expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'application/json'
expect(json_response['healthy']).to be false
expect(json_response['message']).to include('Email is on fire')
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb
index 03b6e85b653..69b5605c0e5 100644
--- a/spec/controllers/help_controller_spec.rb
+++ b/spec/controllers/help_controller_spec.rb
@@ -148,7 +148,7 @@ describe HelpController do
context 'for UI Development Kit' do
it 'renders found' do
get :ui
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
end
diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb
index ac0adcd06a3..9daaa258aa2 100644
--- a/spec/controllers/invites_controller_spec.rb
+++ b/spec/controllers/invites_controller_spec.rb
@@ -17,7 +17,7 @@ describe InvitesController do
get :accept, params: { id: token }
member.reload
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(member.user).to eq(user)
expect(flash[:notice]).to include 'You have been granted'
end
@@ -28,7 +28,7 @@ describe InvitesController do
get :decline, params: { id: token }
expect {member.reload}.to raise_error ActiveRecord::RecordNotFound
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(flash[:notice]).to include 'You have declined the invitation to join'
end
end
diff --git a/spec/controllers/notification_settings_controller_spec.rb b/spec/controllers/notification_settings_controller_spec.rb
index 46328148eff..7b19c67cad3 100644
--- a/spec/controllers/notification_settings_controller_spec.rb
+++ b/spec/controllers/notification_settings_controller_spec.rb
@@ -125,7 +125,7 @@ describe NotificationSettingsController do
notification_setting: { level: :participating }
}
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -195,7 +195,7 @@ describe NotificationSettingsController do
notification_setting: { level: :participating }
}
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
diff --git a/spec/controllers/omniauth_callbacks_controller_spec.rb b/spec/controllers/omniauth_callbacks_controller_spec.rb
index 8b92976252c..71cdba12147 100644
--- a/spec/controllers/omniauth_callbacks_controller_spec.rb
+++ b/spec/controllers/omniauth_callbacks_controller_spec.rb
@@ -172,7 +172,7 @@ describe OmniauthCallbacksController, type: :controller, do_not_mock_admin_mode:
it 'returns 403' do
post provider
- expect(response).to have_gitlab_http_status(403)
+ expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
diff --git a/spec/controllers/passwords_controller_spec.rb b/spec/controllers/passwords_controller_spec.rb
index bf9680329ce..3ec8e347659 100644
--- a/spec/controllers/passwords_controller_spec.rb
+++ b/spec/controllers/passwords_controller_spec.rb
@@ -15,7 +15,7 @@ describe PasswordsController do
post :create
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(flash[:alert]).to eq _('Password authentication is unavailable.')
end
end
diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb
index 265f941e146..91f3bfcfa40 100644
--- a/spec/controllers/profiles_controller_spec.rb
+++ b/spec/controllers/profiles_controller_spec.rb
@@ -87,7 +87,7 @@ describe ProfilesController, :request_store do
put :update, params: { user: { status: { message: 'Working hard!' } } }
expect(user.reload.status.message).to eq('Working hard!')
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
diff --git a/spec/controllers/projects/blame_controller_spec.rb b/spec/controllers/projects/blame_controller_spec.rb
index dd7c0f45dc2..ac8394e3cd4 100644
--- a/spec/controllers/projects/blame_controller_spec.rb
+++ b/spec/controllers/projects/blame_controller_spec.rb
@@ -36,7 +36,7 @@ describe Projects::BlameController do
it 'redirects' do
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/master")
+ .to redirect_to("/#{project.full_path}/-/tree/master")
end
end
diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb
index 78599935910..aa1dcdd9f1d 100644
--- a/spec/controllers/projects/blob_controller_spec.rb
+++ b/spec/controllers/projects/blob_controller_spec.rb
@@ -33,7 +33,7 @@ describe Projects::BlobController do
it 'redirects' do
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/master")
+ .to redirect_to("/#{project.full_path}/-/tree/master")
end
end
@@ -115,7 +115,7 @@ describe Projects::BlobController do
it 'redirects' do
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/markdown/doc")
+ .to redirect_to("/#{project.full_path}/-/tree/markdown/doc")
end
end
end
diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb
index ac39ac626c7..5b59534cb49 100644
--- a/spec/controllers/projects/branches_controller_spec.rb
+++ b/spec/controllers/projects/branches_controller_spec.rb
@@ -38,7 +38,7 @@ describe Projects::BranchesController do
it 'redirects' do
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/merge_branch")
+ .to redirect_to("/#{project.full_path}/-/tree/merge_branch")
end
end
@@ -48,7 +48,7 @@ describe Projects::BranchesController do
it 'redirects' do
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/alert('merge');")
+ .to redirect_to("/#{project.full_path}/-/tree/alert('merge');")
end
end
@@ -93,7 +93,7 @@ describe Projects::BranchesController do
}
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/1-feature-branch")
+ .to redirect_to("/#{project.full_path}/-/tree/1-feature-branch")
end
it 'posts a system note' do
diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb
index a570db12d94..aef8ef1d487 100644
--- a/spec/controllers/projects/raw_controller_spec.rb
+++ b/spec/controllers/projects/raw_controller_spec.rb
@@ -72,7 +72,7 @@ describe Projects::RawController do
env: :raw_blob_request_limit,
remote_ip: '0.0.0.0',
request_method: 'GET',
- path: "/#{project.full_path}/raw/#{file_path}"
+ path: "/#{project.full_path}/-/raw/#{file_path}"
}
expect(Gitlab::AuthLogger).to receive(:error).with(attributes).once
diff --git a/spec/controllers/projects/tree_controller_spec.rb b/spec/controllers/projects/tree_controller_spec.rb
index 7c9abdf700b..5df05a06f00 100644
--- a/spec/controllers/projects/tree_controller_spec.rb
+++ b/spec/controllers/projects/tree_controller_spec.rb
@@ -45,7 +45,7 @@ describe Projects::TreeController do
it 'redirects' do
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/master")
+ .to redirect_to("/#{project.full_path}/-/tree/master")
end
end
@@ -60,7 +60,7 @@ describe Projects::TreeController do
it 'redirects' do
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/empty-branch")
+ .to redirect_to("/#{project.full_path}/-/tree/empty-branch")
end
end
@@ -153,7 +153,7 @@ describe Projects::TreeController do
let(:id) { 'master/README.md' }
it 'redirects' do
- redirect_url = "/#{project.full_path}/blob/master/README.md"
+ redirect_url = "/#{project.full_path}/-/blob/master/README.md"
expect(subject)
.to redirect_to(redirect_url)
end
@@ -181,7 +181,7 @@ describe Projects::TreeController do
it 'redirects to the new directory' do
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/#{branch_name}/#{path}")
+ .to redirect_to("/#{project.full_path}/-/tree/#{branch_name}/#{path}")
expect(flash[:notice]).to eq('The directory has been successfully created.')
end
end
@@ -192,7 +192,7 @@ describe Projects::TreeController do
it 'does not allow overwriting of existing files' do
expect(subject)
- .to redirect_to("/#{project.full_path}/tree/master")
+ .to redirect_to("/#{project.full_path}/-/tree/master")
expect(flash[:alert]).to eq('A file with this name already exists')
end
end
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 9ae1277de26..a44218a5d2f 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -27,7 +27,7 @@ describe ProjectsController do
get :new, params: { namespace_id: group.id }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('new')
end
end
@@ -36,7 +36,7 @@ describe ProjectsController do
it 'responds with status 404' do
get :new, params: { namespace_id: group.id }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
expect(response).not_to render_template('new')
end
end
@@ -159,7 +159,7 @@ describe ProjectsController do
it 'renders a 503' do
get :show, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(503)
+ expect(response).to have_gitlab_http_status(:service_unavailable)
end
end
@@ -264,7 +264,7 @@ describe ProjectsController do
get :show, params: { namespace_id: project.namespace, id: project }, format: :git
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_path)
end
end
@@ -331,7 +331,7 @@ describe ProjectsController do
id: project.path
}
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'sets the badge API endpoint' do
@@ -371,7 +371,7 @@ describe ProjectsController do
end
it 'redirects to projects path' do
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(project_path(project))
end
end
@@ -391,7 +391,7 @@ describe ProjectsController do
end
it 'returns 404' do
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -419,7 +419,7 @@ describe ProjectsController do
end
it 'redirects to projects path' do
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(project_path(project))
end
end
@@ -439,7 +439,7 @@ describe ProjectsController do
end
it 'returns 404' do
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -466,7 +466,7 @@ describe ProjectsController do
id: project.path
}
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
@@ -486,7 +486,7 @@ describe ProjectsController do
id: project.path
}
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
end
@@ -521,7 +521,7 @@ describe ProjectsController do
expect(assign_repository_path).to include(project.path)
end
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
@@ -537,7 +537,7 @@ describe ProjectsController do
.not_to change { project.reload.path }
expect(controller).to set_flash.now[:alert].to(s_('UpdateProject|Cannot rename project because it contains container registry tags!'))
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -555,7 +555,7 @@ describe ProjectsController do
project: params
}
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
params.each do |param, value|
expect(project.public_send(param)).to eq(value)
end
@@ -653,7 +653,7 @@ describe ProjectsController do
project.reload
expect(project.namespace).to eq(new_namespace)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
context 'when new namespace is empty' do
@@ -674,7 +674,7 @@ describe ProjectsController do
project.reload
expect(project.namespace).to eq(old_namespace)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(flash[:alert]).to eq s_('TransferProject|Please select a new namespace for your project.')
end
end
@@ -691,7 +691,7 @@ describe ProjectsController do
delete :destroy, params: { namespace_id: project.namespace, id: project }
expect { Project.find(orig_id) }.to raise_error(ActiveRecord::RecordNotFound)
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(dashboard_projects_path)
end
@@ -733,7 +733,7 @@ describe ProjectsController do
end
it 'has http status 200' do
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'changes the user incoming email token' do
@@ -763,7 +763,7 @@ describe ProjectsController do
end
it 'has http status 200' do
- expect(response).to have_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'changes the user incoming email token' do
@@ -856,7 +856,7 @@ describe ProjectsController do
id: project
},
format: :js)
- expect(response).to have_gitlab_http_status(401)
+ expect(response).to have_gitlab_http_status(:unauthorized)
end
end
@@ -905,7 +905,7 @@ describe ProjectsController do
sign_in(user)
get :refs, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -928,7 +928,7 @@ describe ProjectsController do
it 'returns 404' do
post :preview_markdown, params: { namespace_id: private_project.namespace, id: private_project, text: '*Markdown* text' }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -973,7 +973,7 @@ describe ProjectsController do
end
it 'renders JSON body with image links expanded' do
- expanded_path = "/#{project_with_repo.full_path}/raw/master/files/images/logo-white.png"
+ expanded_path = "/#{project_with_repo.full_path}/-/raw/master/files/images/logo-white.png"
post :preview_markdown, params: preview_markdown_params
@@ -994,7 +994,7 @@ describe ProjectsController do
get :show, params: { namespace_id: public_project.namespace, id: public_project }
expect(assigns(:project)).to eq(public_project)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -1033,13 +1033,13 @@ describe ProjectsController do
it 'does not 404' do
post :toggle_star, params: { namespace_id: public_project.namespace, id: public_project.path.upcase }
- expect(response).not_to have_gitlab_http_status(404)
+ expect(response).not_to have_gitlab_http_status(:not_found)
end
it 'does not redirect to the correct casing' do
post :toggle_star, params: { namespace_id: public_project.namespace, id: public_project.path.upcase }
- expect(response).not_to have_gitlab_http_status(301)
+ expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
@@ -1049,7 +1049,7 @@ describe ProjectsController do
it 'returns not found' do
post :toggle_star, params: { namespace_id: 'foo', id: 'bar' }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -1063,13 +1063,13 @@ describe ProjectsController do
it 'does not 404' do
delete :destroy, params: { namespace_id: project.namespace, id: project.path.upcase }
- expect(response).not_to have_gitlab_http_status(404)
+ expect(response).not_to have_gitlab_http_status(:not_found)
end
it 'does not redirect to the correct casing' do
delete :destroy, params: { namespace_id: project.namespace, id: project.path.upcase }
- expect(response).not_to have_gitlab_http_status(301)
+ expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
@@ -1079,7 +1079,7 @@ describe ProjectsController do
it 'returns not found' do
delete :destroy, params: { namespace_id: 'foo', id: 'bar' }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -1103,7 +1103,7 @@ describe ProjectsController do
get action, params: { namespace_id: project.namespace, id: project }
expect(flash[:alert]).to eq('This endpoint has been requested too many times. Try again later.')
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
@@ -1114,7 +1114,7 @@ describe ProjectsController do
it 'returns 302' do
get action, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
@@ -1126,7 +1126,7 @@ describe ProjectsController do
it 'returns 404' do
get action, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -1143,7 +1143,7 @@ describe ProjectsController do
it 'returns 302' do
get action, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
@@ -1155,7 +1155,7 @@ describe ProjectsController do
it 'returns 404' do
get action, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -1172,7 +1172,7 @@ describe ProjectsController do
it 'returns 302' do
post action, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
@@ -1184,7 +1184,7 @@ describe ProjectsController do
it 'returns 404' do
post action, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -1196,7 +1196,7 @@ describe ProjectsController do
it 'returns 302' do
post action, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
end
end
@@ -1208,7 +1208,7 @@ describe ProjectsController do
it 'returns 404' do
post action, params: { namespace_id: project.namespace, id: project }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -1245,7 +1245,7 @@ describe ProjectsController do
it 'redirects to the project page' do
get :resolve, params: { id: project.id }
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(project_path(project))
end
end
@@ -1267,14 +1267,14 @@ describe ProjectsController do
it 'gives 404 for existing project' do
get :resolve, params: { id: project.id }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
it 'gives 404 for non-existing project' do
get :resolve, params: { id: '0' }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -1288,7 +1288,7 @@ describe ProjectsController do
it 'gives 404 for private project' do
get :resolve, params: { id: project.id }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb
index 214eb35ec9d..792219d830d 100644
--- a/spec/controllers/registrations_controller_spec.rb
+++ b/spec/controllers/registrations_controller_spec.rb
@@ -30,7 +30,7 @@ describe RegistrationsController do
it 'renders new template and sets the resource variable' do
expect(subject).to render_template(:new)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:resource)).to be_a(User)
end
end
@@ -48,7 +48,7 @@ describe RegistrationsController do
it 'renders new template and sets the resource variable' do
subject
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(new_user_session_path(anchor: 'register-pane'))
end
end
@@ -200,7 +200,7 @@ describe RegistrationsController do
.and_call_original
expect(Gitlab::AuthLogger).to receive(:error).with(auth_log_attributes).once
expect { post(:create, params: user_params, session: session_params) }.not_to change(User, :count)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to be_empty
end
end
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index ca7b8a4036a..19786417d76 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -21,13 +21,13 @@ describe SearchController do
it 'blocks access without a project_id' do
get action, params: params
- expect(response).to have_gitlab_http_status(403)
+ expect(response).to have_gitlab_http_status(:forbidden)
end
it 'allows access with a project_id' do
get action, params: params.merge(project_id: create(:project, :public).id)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -42,13 +42,13 @@ describe SearchController do
it 'renders a 403 when no project is given' do
get action, params: params
- expect(response).to have_gitlab_http_status(403)
+ expect(response).to have_gitlab_http_status(:forbidden)
end
it 'renders a 200 when a project was set' do
get action, params: params.merge(project_id: project.id)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -57,7 +57,7 @@ describe SearchController do
it 'still allows accessing the search page' do
get :show
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -195,7 +195,7 @@ describe SearchController do
get :count, params: { search: 'hello', scope: 'projects' }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq({ 'count' => '1' })
end
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb
index 1e47df150b4..63797e22b38 100644
--- a/spec/controllers/sessions_controller_spec.rb
+++ b/spec/controllers/sessions_controller_spec.rb
@@ -22,7 +22,7 @@ describe SessionsController do
it 'redirects to :omniauth_authorize_path' do
get(:new)
- expect(response).to have_gitlab_http_status(302)
+ expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to('/saml')
end
end
@@ -31,7 +31,7 @@ describe SessionsController do
it 'responds with 200' do
get(:new, params: { auto_sign_in: 'false' })
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
end
diff --git a/spec/controllers/snippets_controller_spec.rb b/spec/controllers/snippets_controller_spec.rb
index c8f9e4256c9..f8fc9a72e00 100644
--- a/spec/controllers/snippets_controller_spec.rb
+++ b/spec/controllers/snippets_controller_spec.rb
@@ -51,7 +51,7 @@ describe SnippetsController do
it 'responds with status 200' do
get :new
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
context 'when user is not allowed to create a personal snippet' do
@@ -60,7 +60,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :new
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -90,7 +90,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :show, params: { id: other_personal_snippet.to_param }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -99,13 +99,13 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'responds with status 404 when embeddable content is requested' do
get :show, params: { id: personal_snippet.to_param }, format: :js
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -131,13 +131,13 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'responds with status 404 when embeddable content is requested' do
get :show, params: { id: personal_snippet.to_param }, format: :js
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -162,14 +162,14 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'responds with status 200 when embeddable content is requested' do
get :show, params: { id: personal_snippet.to_param }, format: :js
expect(assigns(:snippet)).to eq(personal_snippet)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -178,7 +178,7 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
end
@@ -192,7 +192,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :show, params: { id: 'doesntexist' }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -234,7 +234,7 @@ describe SnippetsController do
create_snippet(visibility_level: Snippet::PUBLIC)
end.not_to change { Snippet.count }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -496,7 +496,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :raw, params: { id: other_personal_snippet.to_param }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -507,7 +507,7 @@ describe SnippetsController do
it 'responds with status 200' do
expect(assigns(:snippet)).to eq(personal_snippet)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
it 'has expected headers' do
@@ -517,7 +517,7 @@ describe SnippetsController do
end
it "sets #{Gitlab::Workhorse::DETECT_HEADER} header" do
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
end
end
@@ -544,7 +544,7 @@ describe SnippetsController do
get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -569,7 +569,7 @@ describe SnippetsController do
get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
context 'CRLF line ending' do
@@ -596,7 +596,7 @@ describe SnippetsController do
get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
end
@@ -610,7 +610,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :raw, params: { id: 'doesntexist' }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -712,7 +712,7 @@ describe SnippetsController do
it 'responds with status 404' do
delete :destroy, params: { id: snippet.to_param }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
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
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 597d2a185b5..2af398e143d 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -28,7 +28,7 @@ describe UsersController do
it 'renders the show template' do
get :show, params: { username: user.username }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('show')
end
end
@@ -53,7 +53,7 @@ describe UsersController do
it 'renders show' do
get :show, params: { username: user.username }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('show')
end
end
@@ -74,7 +74,7 @@ describe UsersController do
it 'renders 404' do
get :show, params: { username: 'nonexistent' }
- expect(response).to have_gitlab_http_status(404)
+ expect(response).to have_gitlab_http_status(:not_found)
end
end
end
@@ -130,7 +130,7 @@ describe UsersController do
get :calendar, params: { username: public_user.username }, format: :json
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -285,7 +285,7 @@ describe UsersController do
context 'format html' do
it 'renders snippets page' do
get :snippets, params: { username: user.username }
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('show')
end
end
@@ -293,7 +293,7 @@ describe UsersController do
context 'format json' do
it 'response with snippets json data' do
get :snippets, params: { username: user.username }, format: :json
- expect(response).to have_gitlab_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to have_key('html')
end
end