Commit 57afac6a authored by Peter Leitzen's avatar Peter Leitzen

Add http status cop in top-level controller specs

347 files inspected, 207 offenses detected, 207 offenses corrected
parent ebb80e40
...@@ -343,6 +343,7 @@ RSpec/MissingExampleGroupArgument: ...@@ -343,6 +343,7 @@ RSpec/MissingExampleGroupArgument:
RSpec/UnspecifiedException: RSpec/UnspecifiedException:
Enabled: false Enabled: false
# Work in progress. See https://gitlab.com/gitlab-org/gitlab/issues/196163
RSpec/HaveGitlabHttpStatus: RSpec/HaveGitlabHttpStatus:
Enabled: true Enabled: true
Include: Include:
...@@ -350,6 +351,8 @@ RSpec/HaveGitlabHttpStatus: ...@@ -350,6 +351,8 @@ RSpec/HaveGitlabHttpStatus:
- 'ee/spec/support/shared_examples/**/*' - 'ee/spec/support/shared_examples/**/*'
- 'spec/features/**/*' - 'spec/features/**/*'
- 'ee/spec/features/**/*' - 'ee/spec/features/**/*'
- 'spec/controllers/*.rb'
- 'ee/spec/controllers/*.rb'
Style/MultilineWhenThen: Style/MultilineWhenThen:
Enabled: false Enabled: false
......
...@@ -16,7 +16,7 @@ describe GroupsController do ...@@ -16,7 +16,7 @@ describe GroupsController do
post :create, params: { group: { name: 'new_group', path: "new_group" } } post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1) 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
end end
end end
......
...@@ -33,7 +33,7 @@ describe OperationsController do ...@@ -33,7 +33,7 @@ describe OperationsController do
it 'renders index with 200 status code' do it 'renders index with 200 status code' do
get :index get :index
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index) expect(response).to render_template(:index)
end end
...@@ -42,7 +42,7 @@ describe OperationsController do ...@@ -42,7 +42,7 @@ describe OperationsController do
get :index get :index
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index) expect(response).to render_template(:index)
end end
...@@ -113,7 +113,7 @@ describe OperationsController do ...@@ -113,7 +113,7 @@ describe OperationsController do
it 'returns an empty list' do it 'returns an empty list' do
get :list get :list
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to match_schema('dashboard/operations/list', dir: 'ee') expect(json_response).to match_schema('dashboard/operations/list', dir: 'ee')
expect(json_response['projects']).to eq([]) expect(json_response['projects']).to eq([])
end end
...@@ -154,7 +154,7 @@ describe OperationsController do ...@@ -154,7 +154,7 @@ describe OperationsController do
it 'returns a list of added projects' do it 'returns a list of added projects' do
get :list get :list
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('dashboard/operations/list', dir: 'ee') expect(response).to match_response_schema('dashboard/operations/list', dir: 'ee')
expect(json_response['projects'].size).to eq(1) expect(json_response['projects'].size).to eq(1)
...@@ -178,7 +178,7 @@ describe OperationsController do ...@@ -178,7 +178,7 @@ describe OperationsController do
get :list get :list
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('dashboard/operations/list', dir: 'ee') expect(response).to match_response_schema('dashboard/operations/list', dir: 'ee')
expect(json_response['projects'].size).to eq(8) expect(json_response['projects'].size).to eq(8)
...@@ -189,7 +189,7 @@ describe OperationsController do ...@@ -189,7 +189,7 @@ describe OperationsController do
get :list get :list
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('dashboard/operations/list', dir: 'ee') expect(response).to match_response_schema('dashboard/operations/list', dir: 'ee')
expect(json_response['projects'].size).to eq(1) expect(json_response['projects'].size).to eq(1)
expect(expected_project['id']).to eq(project.id) expect(expected_project['id']).to eq(project.id)
...@@ -683,7 +683,7 @@ describe OperationsController do ...@@ -683,7 +683,7 @@ describe OperationsController do
it 'adds projects to the dasboard' do it 'adds projects to the dasboard' do
post :create, params: { project_ids: [project_a.id, project_b.id.to_s] } post :create, params: { project_ids: [project_a.id, project_b.id.to_s] }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee') expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee')
expect(json_response['added']).to contain_exactly(project_a.id, project_b.id) expect(json_response['added']).to contain_exactly(project_a.id, project_b.id)
expect(json_response['duplicate']).to be_empty expect(json_response['duplicate']).to be_empty
...@@ -698,7 +698,7 @@ describe OperationsController do ...@@ -698,7 +698,7 @@ describe OperationsController do
post :create, params: { project_ids: [project_a.id, project_b.id.to_s] } post :create, params: { project_ids: [project_a.id, project_b.id.to_s] }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee') expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee')
expect(json_response['added']).to contain_exactly(project_a.id, project_b.id) expect(json_response['added']).to contain_exactly(project_a.id, project_b.id)
end end
...@@ -706,7 +706,7 @@ describe OperationsController do ...@@ -706,7 +706,7 @@ describe OperationsController do
it 'cannot add a project twice' do it 'cannot add a project twice' do
post :create, params: { project_ids: [project_a.id, project_a.id] } post :create, params: { project_ids: [project_a.id, project_a.id] }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee') expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee')
expect(json_response['added']).to contain_exactly(project_a.id) expect(json_response['added']).to contain_exactly(project_a.id)
expect(json_response['duplicate']).to be_empty expect(json_response['duplicate']).to be_empty
...@@ -719,7 +719,7 @@ describe OperationsController do ...@@ -719,7 +719,7 @@ describe OperationsController do
it 'does not add invalid project ids' do it 'does not add invalid project ids' do
post :create, params: { project_ids: ['', -1, '-2'] } post :create, params: { project_ids: ['', -1, '-2'] }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee') expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee')
expect(json_response['added']).to be_empty expect(json_response['added']).to be_empty
expect(json_response['duplicate']).to be_empty expect(json_response['duplicate']).to be_empty
...@@ -741,7 +741,7 @@ describe OperationsController do ...@@ -741,7 +741,7 @@ describe OperationsController do
it 'does not add already added project' do it 'does not add already added project' do
post :create, params: { project_ids: [project.id] } post :create, params: { project_ids: [project.id] }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee') expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee')
expect(json_response['added']).to be_empty expect(json_response['added']).to be_empty
expect(json_response['duplicate']).to contain_exactly(project.id) expect(json_response['duplicate']).to contain_exactly(project.id)
...@@ -778,7 +778,7 @@ describe OperationsController do ...@@ -778,7 +778,7 @@ describe OperationsController do
it 'removes a project successfully' do it 'removes a project successfully' do
delete :destroy, params: { project_id: project.id } delete :destroy, params: { project_id: project.id }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
user.reload user.reload
expect(user.ops_dashboard_projects).to eq([]) expect(user.ops_dashboard_projects).to eq([])
...@@ -789,7 +789,7 @@ describe OperationsController do ...@@ -789,7 +789,7 @@ describe OperationsController do
delete :destroy, params: { project_id: project.id } delete :destroy, params: { project_id: project.id }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
user.reload user.reload
expect(user.ops_dashboard_projects).to eq([]) expect(user.ops_dashboard_projects).to eq([])
end end
...@@ -799,7 +799,7 @@ describe OperationsController do ...@@ -799,7 +799,7 @@ describe OperationsController do
it 'cannot remove invalid project' do it 'cannot remove invalid project' do
delete :destroy, params: { project_id: -1 } delete :destroy, params: { project_id: -1 }
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
end end
end end
......
...@@ -42,7 +42,7 @@ describe ProjectsController do ...@@ -42,7 +42,7 @@ describe ProjectsController do
id: project.path id: project.path
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -133,7 +133,7 @@ describe ProjectsController do ...@@ -133,7 +133,7 @@ describe ProjectsController do
it 'does not create the project from project template' do it 'does not create the project from project template' do
expect { post :create, params: { project: templates_params } }.not_to change { Project.count } expect { post :create, params: { project: templates_params } }.not_to change { Project.count }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to match(/Template name .* is unknown or invalid/) expect(response.body).to match(/Template name .* is unknown or invalid/)
end end
end end
...@@ -154,7 +154,7 @@ describe ProjectsController do ...@@ -154,7 +154,7 @@ describe ProjectsController do
} }
project.reload project.reload
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
params.except(:repository_size_limit).each do |param, value| params.except(:repository_size_limit).each do |param, value|
expect(project.public_send(param)).to eq(value) expect(project.public_send(param)).to eq(value)
end end
...@@ -177,7 +177,7 @@ describe ProjectsController do ...@@ -177,7 +177,7 @@ describe ProjectsController do
} }
project.reload project.reload
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(project.approver_groups.pluck(:group_id)).to contain_exactly(params[:approver_group_ids]) expect(project.approver_groups.pluck(:group_id)).to contain_exactly(params[:approver_group_ids])
expect(project.approvers.pluck(:user_id)).to contain_exactly(params[:approver_ids]) expect(project.approvers.pluck(:user_id)).to contain_exactly(params[:approver_ids])
end end
...@@ -196,7 +196,7 @@ describe ProjectsController do ...@@ -196,7 +196,7 @@ describe ProjectsController do
} }
project.reload project.reload
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
params.each do |param, value| params.each do |param, value|
expect(project.public_send(param)).to eq(value) expect(project.public_send(param)).to eq(value)
end end
...@@ -218,7 +218,7 @@ describe ProjectsController do ...@@ -218,7 +218,7 @@ describe ProjectsController do
} }
project.reload project.reload
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(project.service_desk_enabled).to eq(true) expect(project.service_desk_enabled).to eq(true)
end end
...@@ -413,7 +413,7 @@ describe ProjectsController do ...@@ -413,7 +413,7 @@ describe ProjectsController do
delete :destroy, params: { namespace_id: project.namespace, id: project } delete :destroy, params: { namespace_id: project.namespace, id: project }
expect(project.reload.marked_for_deletion?).to be_truthy expect(project.reload.marked_for_deletion?).to be_truthy
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(project_path(project)) expect(response).to redirect_to(project_path(project))
end end
...@@ -424,7 +424,7 @@ describe ProjectsController do ...@@ -424,7 +424,7 @@ describe ProjectsController do
delete :destroy, params: { namespace_id: project.namespace, id: project } delete :destroy, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:edit) expect(response).to render_template(:edit)
expect(flash[:alert]).to include(message) expect(flash[:alert]).to include(message)
end end
...@@ -436,7 +436,7 @@ describe ProjectsController do ...@@ -436,7 +436,7 @@ describe ProjectsController do
delete :destroy, params: { namespace_id: project.namespace, id: project } delete :destroy, params: { namespace_id: project.namespace, id: project }
expect(project.marked_for_deletion?).to be_falsey expect(project.marked_for_deletion?).to be_falsey
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(dashboard_projects_path) expect(response).to redirect_to(dashboard_projects_path)
end end
end end
...@@ -451,7 +451,7 @@ describe ProjectsController do ...@@ -451,7 +451,7 @@ describe ProjectsController do
delete :destroy, params: { namespace_id: project.namespace, id: project } delete :destroy, params: { namespace_id: project.namespace, id: project }
expect(project.marked_for_deletion?).to be_falsey expect(project.marked_for_deletion?).to be_falsey
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(dashboard_projects_path) expect(response).to redirect_to(dashboard_projects_path)
end end
end end
...@@ -471,7 +471,7 @@ describe ProjectsController do ...@@ -471,7 +471,7 @@ describe ProjectsController do
expect(project.reload.marked_for_deletion_at).to be_nil expect(project.reload.marked_for_deletion_at).to be_nil
expect(project.reload.archived).to be_falsey expect(project.reload.archived).to be_falsey
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(edit_project_path(project)) expect(response).to redirect_to(edit_project_path(project))
end end
...@@ -481,7 +481,7 @@ describe ProjectsController do ...@@ -481,7 +481,7 @@ describe ProjectsController do
post :restore, params: { namespace_id: project.namespace, project_id: project } post :restore, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:edit) expect(response).to render_template(:edit)
expect(flash[:alert]).to include(message) expect(flash[:alert]).to include(message)
end end
......
...@@ -28,7 +28,7 @@ describe AcmeChallengesController do ...@@ -28,7 +28,7 @@ describe AcmeChallengesController do
let(:token) { acme_order.challenge_token } let(:token) { acme_order.challenge_token }
it 'renders not found' do 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 end
...@@ -37,7 +37,7 @@ describe AcmeChallengesController do ...@@ -37,7 +37,7 @@ describe AcmeChallengesController do
let(:token) { 'wrongtoken' } let(:token) { 'wrongtoken' }
it 'renders not found' do 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 end
end end
......
...@@ -156,7 +156,7 @@ describe ApplicationController do ...@@ -156,7 +156,7 @@ describe ApplicationController do
it 'returns 200 response' do it 'returns 200 response' do
get :index, format: requested_format get :index, format: requested_format
expect(response).to have_gitlab_http_status 200 expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -164,7 +164,7 @@ describe ApplicationController do ...@@ -164,7 +164,7 @@ describe ApplicationController do
it 'returns 404 response' do it 'returns 404 response' do
get :index get :index
expect(response).to have_gitlab_http_status 404 expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -181,7 +181,7 @@ describe ApplicationController do ...@@ -181,7 +181,7 @@ describe ApplicationController do
get :index get :index
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'redirects to login page if not authenticated' do it 'redirects to login page if not authenticated' do
...@@ -202,7 +202,7 @@ describe ApplicationController do ...@@ -202,7 +202,7 @@ describe ApplicationController do
get :index, format: 'unknown' get :index, format: 'unknown'
expect(response).to have_gitlab_http_status(401) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
end end
...@@ -489,7 +489,7 @@ describe ApplicationController do ...@@ -489,7 +489,7 @@ describe ApplicationController do
it 'redirects if the user did not accept the terms' do it 'redirects if the user did not accept the terms' do
get :index get :index
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
it 'does not redirect when the user accepted terms' do it 'does not redirect when the user accepted terms' do
...@@ -497,7 +497,7 @@ describe ApplicationController do ...@@ -497,7 +497,7 @@ describe ApplicationController do
get :index get :index
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -581,21 +581,21 @@ describe ApplicationController do ...@@ -581,21 +581,21 @@ describe ApplicationController do
it 'renders a 404 without a message' do it 'renders a 404 without a message' do
get :index 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') expect(response).to render_template('errors/not_found')
end end
it 'renders a 403 when a message is passed to access denied' do it 'renders a 403 when a message is passed to access denied' do
get :index, params: { message: 'None shall pass' } 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') expect(response).to render_template('errors/access_denied')
end end
it 'renders a status passed to access denied' do it 'renders a status passed to access denied' do
get :index, params: { status: 401 } get :index, params: { status: 401 }
expect(response).to have_gitlab_http_status(401) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
......
...@@ -32,7 +32,7 @@ describe AutocompleteController do ...@@ -32,7 +32,7 @@ describe AutocompleteController do
get(:users, params: { project_id: 'unknown' }) get(:users, params: { project_id: 'unknown' })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(:not_found) }
end end
end end
...@@ -61,7 +61,7 @@ describe AutocompleteController do ...@@ -61,7 +61,7 @@ describe AutocompleteController do
get(:users, params: { group_id: 'unknown' }) get(:users, params: { group_id: 'unknown' })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(:not_found) }
end end
end end
...@@ -140,7 +140,7 @@ describe AutocompleteController do ...@@ -140,7 +140,7 @@ describe AutocompleteController do
get(:users, params: { project_id: project.id }) get(:users, params: { project_id: project.id })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(:not_found) }
end end
describe 'GET #users with unknown project' do describe 'GET #users with unknown project' do
...@@ -148,7 +148,7 @@ describe AutocompleteController do ...@@ -148,7 +148,7 @@ describe AutocompleteController do
get(:users, params: { project_id: 'unknown' }) get(:users, params: { project_id: 'unknown' })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(:not_found) }
end end
describe 'GET #users with inaccessible group' do describe 'GET #users with inaccessible group' do
...@@ -157,7 +157,7 @@ describe AutocompleteController do ...@@ -157,7 +157,7 @@ describe AutocompleteController do
get(:users, params: { group_id: user.namespace.id }) get(:users, params: { group_id: user.namespace.id })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(:not_found) }
end end
describe 'GET #users with no project' do describe 'GET #users with no project' do
...@@ -372,7 +372,7 @@ describe AutocompleteController do ...@@ -372,7 +372,7 @@ describe AutocompleteController do
it 'returns empty json' do it 'returns empty json' do
get :merge_request_target_branches, params: { project_id: project.id } 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 expect(json_response).to be_empty
end end
end end
...@@ -383,7 +383,7 @@ describe AutocompleteController do ...@@ -383,7 +383,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: { project_id: project.id } 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 expect(json_response).to be_empty
end end
end end
...@@ -404,7 +404,7 @@ describe AutocompleteController do ...@@ -404,7 +404,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: params 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' }) expect(json_response).to eq({ 'error' => 'At least one of group_id or project_id must be specified' })
end end
end end
...@@ -416,7 +416,7 @@ describe AutocompleteController do ...@@ -416,7 +416,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: { project_id: project.id } 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' }) expect(json_response).to contain_exactly({ 'title' => 'feature' })
end end
end end
...@@ -433,7 +433,7 @@ describe AutocompleteController do ...@@ -433,7 +433,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: { group_id: group.id } 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' }) expect(json_response).to contain_exactly({ 'title' => 'feature' })
end end
end end
......
...@@ -9,7 +9,7 @@ describe ChaosController do ...@@ -9,7 +9,7 @@ describe ChaosController do
get :leakmem get :leakmem
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'call synchronously with params' do it 'call synchronously with params' do
...@@ -17,7 +17,7 @@ describe ChaosController do ...@@ -17,7 +17,7 @@ describe ChaosController do
get :leakmem, params: { memory_mb: 1, duration_s: 2 } 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 end
it 'calls asynchronously' do it 'calls asynchronously' do
...@@ -25,7 +25,7 @@ describe ChaosController do ...@@ -25,7 +25,7 @@ describe ChaosController do
get :leakmem, params: { async: 1 } get :leakmem, params: { async: 1 }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -35,7 +35,7 @@ describe ChaosController do ...@@ -35,7 +35,7 @@ describe ChaosController do
get :cpu_spin get :cpu_spin
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'calls synchronously with params' do it 'calls synchronously with params' do
...@@ -43,7 +43,7 @@ describe ChaosController do ...@@ -43,7 +43,7 @@ describe ChaosController do
get :cpu_spin, params: { duration_s: 3 } get :cpu_spin, params: { duration_s: 3 }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'calls asynchronously' do it 'calls asynchronously' do
...@@ -51,7 +51,7 @@ describe ChaosController do ...@@ -51,7 +51,7 @@ describe ChaosController do
get :cpu_spin, params: { async: 1 } get :cpu_spin, params: { async: 1 }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -61,7 +61,7 @@ describe ChaosController do ...@@ -61,7 +61,7 @@ describe ChaosController do
get :db_spin get :db_spin
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'calls synchronously with params' do it 'calls synchronously with params' do
...@@ -69,7 +69,7 @@ describe ChaosController do ...@@ -69,7 +69,7 @@ describe ChaosController do
get :db_spin, params: { duration_s: 4, interval_s: 5 } 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 end
it 'calls asynchronously' do it 'calls asynchronously' do
...@@ -77,7 +77,7 @@ describe ChaosController do ...@@ -77,7 +77,7 @@ describe ChaosController do
get :db_spin, params: { async: 1 } get :db_spin, params: { async: 1 }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -87,7 +87,7 @@ describe ChaosController do ...@@ -87,7 +87,7 @@ describe ChaosController do
get :sleep get :sleep
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'calls synchronously with params' do it 'calls synchronously with params' do
...@@ -95,7 +95,7 @@ describe ChaosController do ...@@ -95,7 +95,7 @@ describe ChaosController do
get :sleep, params: { duration_s: 5 } get :sleep, params: { duration_s: 5 }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'calls asynchronously' do it 'calls asynchronously' do
...@@ -103,7 +103,7 @@ describe ChaosController do ...@@ -103,7 +103,7 @@ describe ChaosController do
get :sleep, params: { async: 1 } get :sleep, params: { async: 1 }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -113,7 +113,7 @@ describe ChaosController do ...@@ -113,7 +113,7 @@ describe ChaosController do
get :kill get :kill
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'calls asynchronously' do it 'calls asynchronously' do
...@@ -121,7 +121,7 @@ describe ChaosController do ...@@ -121,7 +121,7 @@ describe ChaosController do
get :kill, params: { async: 1 } get :kill, params: { async: 1 }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -39,7 +39,7 @@ describe GraphqlController do ...@@ -39,7 +39,7 @@ describe GraphqlController do
it 'returns 200 when user can access API' do it 'returns 200 when user can access API' do
post :execute post :execute
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'returns access denied template when user cannot access API' do it 'returns access denied template when user cannot access API' do
...@@ -59,7 +59,7 @@ describe GraphqlController do ...@@ -59,7 +59,7 @@ describe GraphqlController do
it 'returns 200' do it 'returns 200' do
post :execute post :execute
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
......
...@@ -136,7 +136,7 @@ describe GroupsController do ...@@ -136,7 +136,7 @@ describe GroupsController do
get :activity, params: { id: group.to_param }, format: :json 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(json_response['count']).to eq(3)
expect(assigns(:projects).limit_value).to be_nil expect(assigns(:projects).limit_value).to be_nil
end end
...@@ -151,7 +151,7 @@ describe GroupsController do ...@@ -151,7 +151,7 @@ describe GroupsController do
post :create, params: { group: { name: 'new_group', path: "new_group" } } post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1) 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
context 'authorization' do context 'authorization' do
...@@ -162,7 +162,7 @@ describe GroupsController do ...@@ -162,7 +162,7 @@ describe GroupsController do
post :create, params: { group: { name: 'new_group', path: "new_group" } } post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1) 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
end end
...@@ -367,7 +367,7 @@ describe GroupsController do ...@@ -367,7 +367,7 @@ describe GroupsController do
it 'updates the path successfully' do it 'updates the path successfully' do
post :update, params: { id: group.to_param, group: { path: 'new_path' } } 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] expect(controller).to set_flash[:notice]
end end
...@@ -382,7 +382,7 @@ describe GroupsController do ...@@ -382,7 +382,7 @@ describe GroupsController do
it 'updates the project_creation_level successfully' 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 } } 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) expect(group.reload.project_creation_level).to eq(::Gitlab::Access::MAINTAINER_PROJECT_ACCESS)
end end
...@@ -397,7 +397,7 @@ describe GroupsController do ...@@ -397,7 +397,7 @@ describe GroupsController do
post :update, params: { id: group.to_param, group: { name: 'new_name' } } post :update, params: { id: group.to_param, group: { name: 'new_name' } }
expect(controller).to set_flash[:notice] 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') expect(group.reload.name).to eq('new_name')
end end
...@@ -405,7 +405,7 @@ describe GroupsController do ...@@ -405,7 +405,7 @@ describe GroupsController do
post :update, params: { id: group.to_param, group: { path: 'new_path' } } 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(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 end
end end
...@@ -468,7 +468,7 @@ describe GroupsController do ...@@ -468,7 +468,7 @@ describe GroupsController do
it 'does not redirect' do it 'does not redirect' do
get :issues, params: { id: group.to_param } 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
end end
...@@ -487,7 +487,7 @@ describe GroupsController do ...@@ -487,7 +487,7 @@ describe GroupsController do
it 'does not redirect' do it 'does not redirect' do
get :show, params: { id: group.to_param } 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
end end
...@@ -554,13 +554,13 @@ describe GroupsController do ...@@ -554,13 +554,13 @@ describe GroupsController do
it 'does not 404' do it 'does not 404' do
post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } } 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 end
it 'does not redirect to the correct casing' do it 'does not redirect to the correct casing' do
post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } } 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
end end
...@@ -570,7 +570,7 @@ describe GroupsController do ...@@ -570,7 +570,7 @@ describe GroupsController do
it 'returns not found' do it 'returns not found' do
post :update, params: { id: redirect_route.path, group: { path: 'new_path' } } 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 end
end end
...@@ -580,13 +580,13 @@ describe GroupsController do ...@@ -580,13 +580,13 @@ describe GroupsController do
it 'does not 404' do it 'does not 404' do
delete :destroy, params: { id: group.to_param.upcase } 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 end
it 'does not redirect to the correct casing' do it 'does not redirect to the correct casing' do
delete :destroy, params: { id: group.to_param.upcase } 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
end end
...@@ -596,7 +596,7 @@ describe GroupsController do ...@@ -596,7 +596,7 @@ describe GroupsController do
it 'returns not found' do it 'returns not found' do
delete :destroy, params: { id: redirect_route.path } 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 end
end end
...@@ -693,7 +693,7 @@ describe GroupsController do ...@@ -693,7 +693,7 @@ describe GroupsController do
end end
it 'is denied' do it 'is denied' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -755,13 +755,13 @@ describe GroupsController do ...@@ -755,13 +755,13 @@ describe GroupsController do
it 'is successful' do it 'is successful' do
get :show, params: { id: group.to_param } get :show, params: { id: group.to_param }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'does not allow other formats' do it 'does not allow other formats' do
get :show, params: { id: group.to_param }, format: :atom 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
end end
...@@ -769,7 +769,7 @@ describe GroupsController do ...@@ -769,7 +769,7 @@ describe GroupsController do
it 'is successful' do it 'is successful' do
get :edit, params: { id: group.to_param } 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
end end
...@@ -777,7 +777,7 @@ describe GroupsController do ...@@ -777,7 +777,7 @@ describe GroupsController do
it 'is successful' do it 'is successful' do
get :new get :new
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -786,7 +786,7 @@ describe GroupsController do ...@@ -786,7 +786,7 @@ describe GroupsController do
get :index get :index
# Redirects to the dashboard # Redirects to the dashboard
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -810,7 +810,7 @@ describe GroupsController do ...@@ -810,7 +810,7 @@ describe GroupsController do
it 'deletes the group' do it 'deletes the group' do
delete :destroy, params: { id: group.to_param } 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 end
end end
......
...@@ -101,7 +101,7 @@ describe HealthCheckController, :request_store do ...@@ -101,7 +101,7 @@ describe HealthCheckController, :request_store do
it 'supports failure plaintext response' do it 'supports failure plaintext response' do
get :index 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.content_type).to eq 'text/plain'
expect(response.body).to include('The server is on fire') expect(response.body).to include('The server is on fire')
end end
...@@ -109,7 +109,7 @@ describe HealthCheckController, :request_store do ...@@ -109,7 +109,7 @@ describe HealthCheckController, :request_store do
it 'supports failure json response' do it 'supports failure json response' do
get :index, format: :json 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(response.content_type).to eq 'application/json'
expect(json_response['healthy']).to be false expect(json_response['healthy']).to be false
expect(json_response['message']).to include('The server is on fire') expect(json_response['message']).to include('The server is on fire')
...@@ -118,7 +118,7 @@ describe HealthCheckController, :request_store do ...@@ -118,7 +118,7 @@ describe HealthCheckController, :request_store do
it 'supports failure xml response' do it 'supports failure xml response' do
get :index, format: :xml 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(response.content_type).to eq 'application/xml'
expect(xml_response['healthy']).to be false expect(xml_response['healthy']).to be false
expect(xml_response['message']).to include('The server is on fire') expect(xml_response['message']).to include('The server is on fire')
...@@ -127,7 +127,7 @@ describe HealthCheckController, :request_store do ...@@ -127,7 +127,7 @@ describe HealthCheckController, :request_store do
it 'supports failure responses for specific checks' do it 'supports failure responses for specific checks' do
get :index, params: { checks: 'email' }, format: :json 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(response.content_type).to eq 'application/json'
expect(json_response['healthy']).to be false expect(json_response['healthy']).to be false
expect(json_response['message']).to include('Email is on fire') expect(json_response['message']).to include('Email is on fire')
......
...@@ -148,7 +148,7 @@ describe HelpController do ...@@ -148,7 +148,7 @@ describe HelpController do
context 'for UI Development Kit' do context 'for UI Development Kit' do
it 'renders found' do it 'renders found' do
get :ui get :ui
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
......
...@@ -17,7 +17,7 @@ describe InvitesController do ...@@ -17,7 +17,7 @@ describe InvitesController do
get :accept, params: { id: token } get :accept, params: { id: token }
member.reload 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(member.user).to eq(user)
expect(flash[:notice]).to include 'You have been granted' expect(flash[:notice]).to include 'You have been granted'
end end
...@@ -28,7 +28,7 @@ describe InvitesController do ...@@ -28,7 +28,7 @@ describe InvitesController do
get :decline, params: { id: token } get :decline, params: { id: token }
expect {member.reload}.to raise_error ActiveRecord::RecordNotFound 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' expect(flash[:notice]).to include 'You have declined the invitation to join'
end end
end end
......
...@@ -125,7 +125,7 @@ describe NotificationSettingsController do ...@@ -125,7 +125,7 @@ describe NotificationSettingsController do
notification_setting: { level: :participating } notification_setting: { level: :participating }
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -195,7 +195,7 @@ describe NotificationSettingsController do ...@@ -195,7 +195,7 @@ describe NotificationSettingsController do
notification_setting: { level: :participating } notification_setting: { level: :participating }
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -172,7 +172,7 @@ describe OmniauthCallbacksController, type: :controller, do_not_mock_admin_mode: ...@@ -172,7 +172,7 @@ describe OmniauthCallbacksController, type: :controller, do_not_mock_admin_mode:
it 'returns 403' do it 'returns 403' do
post provider post provider
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
end end
......
...@@ -15,7 +15,7 @@ describe PasswordsController do ...@@ -15,7 +15,7 @@ describe PasswordsController do
post :create 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.') expect(flash[:alert]).to eq _('Password authentication is unavailable.')
end end
end end
......
...@@ -87,7 +87,7 @@ describe ProfilesController, :request_store do ...@@ -87,7 +87,7 @@ describe ProfilesController, :request_store do
put :update, params: { user: { status: { message: 'Working hard!' } } } put :update, params: { user: { status: { message: 'Working hard!' } } }
expect(user.reload.status.message).to eq('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
end end
......
...@@ -30,7 +30,7 @@ describe RegistrationsController do ...@@ -30,7 +30,7 @@ describe RegistrationsController do
it 'renders new template and sets the resource variable' do it 'renders new template and sets the resource variable' do
expect(subject).to render_template(:new) 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) expect(assigns(:resource)).to be_a(User)
end end
end end
...@@ -48,7 +48,7 @@ describe RegistrationsController do ...@@ -48,7 +48,7 @@ describe RegistrationsController do
it 'renders new template and sets the resource variable' do it 'renders new template and sets the resource variable' do
subject 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')) expect(response).to redirect_to(new_user_session_path(anchor: 'register-pane'))
end end
end end
...@@ -200,7 +200,7 @@ describe RegistrationsController do ...@@ -200,7 +200,7 @@ describe RegistrationsController do
.and_call_original .and_call_original
expect(Gitlab::AuthLogger).to receive(:error).with(auth_log_attributes).once 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 { 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 expect(response.body).to be_empty
end end
end end
......
...@@ -21,13 +21,13 @@ describe SearchController do ...@@ -21,13 +21,13 @@ describe SearchController do
it 'blocks access without a project_id' do it 'blocks access without a project_id' do
get action, params: params get action, params: params
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
it 'allows access with a project_id' do it 'allows access with a project_id' do
get action, params: params.merge(project_id: create(:project, :public).id) 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
end end
...@@ -42,13 +42,13 @@ describe SearchController do ...@@ -42,13 +42,13 @@ describe SearchController do
it 'renders a 403 when no project is given' do it 'renders a 403 when no project is given' do
get action, params: params get action, params: params
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
it 'renders a 200 when a project was set' do it 'renders a 200 when a project was set' do
get action, params: params.merge(project_id: project.id) 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
end end
...@@ -57,7 +57,7 @@ describe SearchController do ...@@ -57,7 +57,7 @@ describe SearchController do
it 'still allows accessing the search page' do it 'still allows accessing the search page' do
get :show get :show
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -195,7 +195,7 @@ describe SearchController do ...@@ -195,7 +195,7 @@ describe SearchController do
get :count, params: { search: 'hello', scope: 'projects' } 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' }) expect(json_response).to eq({ 'count' => '1' })
end end
......
...@@ -22,7 +22,7 @@ describe SessionsController do ...@@ -22,7 +22,7 @@ describe SessionsController do
it 'redirects to :omniauth_authorize_path' do it 'redirects to :omniauth_authorize_path' do
get(:new) get(:new)
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to('/saml') expect(response).to redirect_to('/saml')
end end
end end
...@@ -31,7 +31,7 @@ describe SessionsController do ...@@ -31,7 +31,7 @@ describe SessionsController do
it 'responds with 200' do it 'responds with 200' do
get(:new, params: { auto_sign_in: 'false' }) 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 end
end end
......
...@@ -51,7 +51,7 @@ describe SnippetsController do ...@@ -51,7 +51,7 @@ describe SnippetsController do
it 'responds with status 200' do it 'responds with status 200' do
get :new get :new
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
context 'when user is not allowed to create a personal snippet' do context 'when user is not allowed to create a personal snippet' do
...@@ -60,7 +60,7 @@ describe SnippetsController do ...@@ -60,7 +60,7 @@ describe SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
get :new get :new
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -90,7 +90,7 @@ describe SnippetsController do ...@@ -90,7 +90,7 @@ describe SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
get :show, params: { id: other_personal_snippet.to_param } 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
end end
...@@ -99,13 +99,13 @@ describe SnippetsController do ...@@ -99,13 +99,13 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param } get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet) 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
it 'responds with status 404 when embeddable content is requested' do it 'responds with status 404 when embeddable content is requested' do
get :show, params: { id: personal_snippet.to_param }, format: :js 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 end
end end
...@@ -131,13 +131,13 @@ describe SnippetsController do ...@@ -131,13 +131,13 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param } get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet) 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
it 'responds with status 404 when embeddable content is requested' do it 'responds with status 404 when embeddable content is requested' do
get :show, params: { id: personal_snippet.to_param }, format: :js 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 end
...@@ -162,14 +162,14 @@ describe SnippetsController do ...@@ -162,14 +162,14 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param } get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet) 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
it 'responds with status 200 when embeddable content is requested' do it 'responds with status 200 when embeddable content is requested' do
get :show, params: { id: personal_snippet.to_param }, format: :js get :show, params: { id: personal_snippet.to_param }, format: :js
expect(assigns(:snippet)).to eq(personal_snippet) 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 end
...@@ -178,7 +178,7 @@ describe SnippetsController do ...@@ -178,7 +178,7 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param } get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet) 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 end
end end
...@@ -192,7 +192,7 @@ describe SnippetsController do ...@@ -192,7 +192,7 @@ describe SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
get :show, params: { id: 'doesntexist' } get :show, params: { id: 'doesntexist' }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -234,7 +234,7 @@ describe SnippetsController do ...@@ -234,7 +234,7 @@ describe SnippetsController do
create_snippet(visibility_level: Snippet::PUBLIC) create_snippet(visibility_level: Snippet::PUBLIC)
end.not_to change { Snippet.count } 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 end
end end
...@@ -496,7 +496,7 @@ describe SnippetsController do ...@@ -496,7 +496,7 @@ describe SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
get :raw, params: { id: other_personal_snippet.to_param } 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
end end
...@@ -507,7 +507,7 @@ describe SnippetsController do ...@@ -507,7 +507,7 @@ describe SnippetsController do
it 'responds with status 200' do it 'responds with status 200' do
expect(assigns(:snippet)).to eq(personal_snippet) 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
it 'has expected headers' do it 'has expected headers' do
...@@ -517,7 +517,7 @@ describe SnippetsController do ...@@ -517,7 +517,7 @@ describe SnippetsController do
end end
it "sets #{Gitlab::Workhorse::DETECT_HEADER} header" do 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" expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
end end
end end
...@@ -544,7 +544,7 @@ describe SnippetsController do ...@@ -544,7 +544,7 @@ describe SnippetsController do
get :raw, params: { id: personal_snippet.to_param } get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet) 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 end
...@@ -569,7 +569,7 @@ describe SnippetsController do ...@@ -569,7 +569,7 @@ describe SnippetsController do
get :raw, params: { id: personal_snippet.to_param } get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet) 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
context 'CRLF line ending' do context 'CRLF line ending' do
...@@ -596,7 +596,7 @@ describe SnippetsController do ...@@ -596,7 +596,7 @@ describe SnippetsController do
get :raw, params: { id: personal_snippet.to_param } get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet) 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 end
end end
...@@ -610,7 +610,7 @@ describe SnippetsController do ...@@ -610,7 +610,7 @@ describe SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
get :raw, params: { id: 'doesntexist' } get :raw, params: { id: 'doesntexist' }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -712,7 +712,7 @@ describe SnippetsController do ...@@ -712,7 +712,7 @@ describe SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
delete :destroy, params: { id: snippet.to_param } 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 end
end end
......
This diff is collapsed.
...@@ -28,7 +28,7 @@ describe UsersController do ...@@ -28,7 +28,7 @@ describe UsersController do
it 'renders the show template' do it 'renders the show template' do
get :show, params: { username: user.username } 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') expect(response).to render_template('show')
end end
end end
...@@ -53,7 +53,7 @@ describe UsersController do ...@@ -53,7 +53,7 @@ describe UsersController do
it 'renders show' do it 'renders show' do
get :show, params: { username: user.username } 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') expect(response).to render_template('show')
end end
end end
...@@ -74,7 +74,7 @@ describe UsersController do ...@@ -74,7 +74,7 @@ describe UsersController do
it 'renders 404' do it 'renders 404' do
get :show, params: { username: 'nonexistent' } 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 end
end end
...@@ -130,7 +130,7 @@ describe UsersController do ...@@ -130,7 +130,7 @@ describe UsersController do
get :calendar, params: { username: public_user.username }, format: :json 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
end end
...@@ -285,7 +285,7 @@ describe UsersController do ...@@ -285,7 +285,7 @@ describe UsersController do
context 'format html' do context 'format html' do
it 'renders snippets page' do it 'renders snippets page' do
get :snippets, params: { username: user.username } 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') expect(response).to render_template('show')
end end
end end
...@@ -293,7 +293,7 @@ describe UsersController do ...@@ -293,7 +293,7 @@ describe UsersController do
context 'format json' do context 'format json' do
it 'response with snippets json data' do it 'response with snippets json data' do
get :snippets, params: { username: user.username }, format: :json 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') expect(json_response).to have_key('html')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment