Commit 1dd566a1 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'pl-rubocop-have-gitlab-http-status-spec-controllers-2' into 'master'

Add http status cop in project controller specs

See merge request gitlab-org/gitlab!23801
parents 93244cf9 b629325a
...@@ -347,6 +347,8 @@ RSpec/HaveGitlabHttpStatus: ...@@ -347,6 +347,8 @@ RSpec/HaveGitlabHttpStatus:
- 'ee/spec/features/**/*' - 'ee/spec/features/**/*'
- 'spec/controllers/*.rb' - 'spec/controllers/*.rb'
- 'ee/spec/controllers/*.rb' - 'ee/spec/controllers/*.rb'
- 'spec/controllers/projects/*.rb'
- 'ee/spec/controllers/projects/*.rb'
- 'spec/requests/*.rb' - 'spec/requests/*.rb'
- 'ee/spec/requests/*.rb' - 'ee/spec/requests/*.rb'
......
...@@ -33,7 +33,7 @@ describe Projects::ApproverGroupsController do ...@@ -33,7 +33,7 @@ describe Projects::ApproverGroupsController do
it 'returns a 404' do it 'returns a 404' do
destroy_merge_request_approver_group destroy_merge_request_approver_group
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'does not destroy any approver groups' do it 'does not destroy any approver groups' do
...@@ -51,7 +51,7 @@ describe Projects::ApproverGroupsController do ...@@ -51,7 +51,7 @@ describe Projects::ApproverGroupsController do
it 'returns a 404' do it 'returns a 404' do
destroy_merge_request_approver_group destroy_merge_request_approver_group
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'does not destroy any approver groups' do it 'does not destroy any approver groups' do
...@@ -88,7 +88,7 @@ describe Projects::ApproverGroupsController do ...@@ -88,7 +88,7 @@ describe Projects::ApproverGroupsController do
it 'returns a 404' do it 'returns a 404' do
destroy_project_approver_group destroy_project_approver_group
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'does not destroy any approver groups' do it 'does not destroy any approver groups' do
......
...@@ -33,7 +33,7 @@ describe Projects::ApproversController do ...@@ -33,7 +33,7 @@ describe Projects::ApproversController do
it 'returns a 404' do it 'returns a 404' do
destroy_merge_request_approver destroy_merge_request_approver
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'does not destroy any approvers' do it 'does not destroy any approvers' do
...@@ -51,7 +51,7 @@ describe Projects::ApproversController do ...@@ -51,7 +51,7 @@ describe Projects::ApproversController do
it 'returns a 404' do it 'returns a 404' do
destroy_merge_request_approver destroy_merge_request_approver
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'does not destroy any approvers' do it 'does not destroy any approvers' do
...@@ -88,7 +88,7 @@ describe Projects::ApproversController do ...@@ -88,7 +88,7 @@ describe Projects::ApproversController do
it 'returns a 404' do it 'returns a 404' do
destroy_project_approver destroy_project_approver
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'does not destroy any approvers' do it 'does not destroy any approvers' do
......
...@@ -30,7 +30,7 @@ describe Projects::AuditEventsController do ...@@ -30,7 +30,7 @@ describe Projects::AuditEventsController do
request request
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
...@@ -55,7 +55,7 @@ describe Projects::AuditEventsController do ...@@ -55,7 +55,7 @@ describe Projects::AuditEventsController do
it 'renders 404' do it 'renders 404' do
request request
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -69,7 +69,7 @@ describe Projects::AuditEventsController do ...@@ -69,7 +69,7 @@ describe Projects::AuditEventsController do
it 'renders 404' do it 'renders 404' do
request request
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -43,7 +43,7 @@ describe Projects::BoardsController do ...@@ -43,7 +43,7 @@ describe Projects::BoardsController do
list_boards(recent: true) list_boards(recent: true)
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
...@@ -72,7 +72,7 @@ describe Projects::BoardsController do ...@@ -72,7 +72,7 @@ describe Projects::BoardsController do
it 'returns a successful 200 response' do it 'returns a successful 200 response' do
create_board create_params create_board create_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'returns the created board' do it 'returns the created board' do
...@@ -96,7 +96,7 @@ describe Projects::BoardsController do ...@@ -96,7 +96,7 @@ describe Projects::BoardsController do
it 'returns an unprocessable entity 422 response' do it 'returns an unprocessable entity 422 response' do
create_board name: nil create_board name: nil
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
end end
end end
...@@ -110,7 +110,7 @@ describe Projects::BoardsController do ...@@ -110,7 +110,7 @@ describe Projects::BoardsController do
create_board name: 'Backend' create_board name: 'Backend'
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -143,7 +143,7 @@ describe Projects::BoardsController do ...@@ -143,7 +143,7 @@ describe Projects::BoardsController do
it 'returns a successful 200 response' do it 'returns a successful 200 response' do
update_board board, update_params update_board board, update_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'returns the updated board' do it 'returns the updated board' do
...@@ -164,7 +164,7 @@ describe Projects::BoardsController do ...@@ -164,7 +164,7 @@ describe Projects::BoardsController do
it 'returns an unprocessable entity 422 response' do it 'returns an unprocessable entity 422 response' do
update_board board, name: nil update_board board, name: nil
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
end end
end end
...@@ -172,7 +172,7 @@ describe Projects::BoardsController do ...@@ -172,7 +172,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
update_board 999, name: nil update_board 999, name: nil
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -186,7 +186,7 @@ describe Projects::BoardsController do ...@@ -186,7 +186,7 @@ describe Projects::BoardsController do
update_board board, update_params update_board board, update_params
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -221,7 +221,7 @@ describe Projects::BoardsController do ...@@ -221,7 +221,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
remove_board board: 999 remove_board board: 999
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 Projects::BoardsController do ...@@ -234,7 +234,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
remove_board board: board remove_board board: board
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
......
...@@ -33,7 +33,7 @@ describe Projects::DependenciesController do ...@@ -33,7 +33,7 @@ describe Projects::DependenciesController do
get :index, params: params, format: :html get :index, params: params, format: :html
end end
it { expect(response).to have_http_status(:ok) } it { expect(response).to have_gitlab_http_status(:ok) }
it 'renders the side navigation with the correct submenu set as active' do it 'renders the side navigation with the correct submenu set as active' do
expect(response.body).to have_active_sub_navigation('Dependency List') expect(response.body).to have_active_sub_navigation('Dependency List')
...@@ -76,7 +76,7 @@ describe Projects::DependenciesController do ...@@ -76,7 +76,7 @@ describe Projects::DependenciesController do
end end
it 'returns success code' do it 'returns success code' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -231,13 +231,13 @@ describe Projects::DependenciesController do ...@@ -231,13 +231,13 @@ describe Projects::DependenciesController do
it 'returns 403 for a JSON request' do it 'returns 403 for a JSON request' do
get :index, params: params, format: :json get :index, params: params, format: :json
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
it 'returns a 404 for an HTML request' do it 'returns a 404 for an HTML request' do
get :index, params: params, format: :html get :index, params: params, format: :html
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -254,13 +254,13 @@ describe Projects::DependenciesController do ...@@ -254,13 +254,13 @@ describe Projects::DependenciesController do
it 'returns 403 for a JSON request' do it 'returns 403 for a JSON request' do
get :index, params: params, format: :json get :index, params: params, format: :json
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
it 'returns a 404 for an HTML request' do it 'returns a 404 for an HTML request' do
get :index, params: params, format: :html get :index, params: params, format: :html
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -55,7 +55,7 @@ describe Projects::DeployKeysController do ...@@ -55,7 +55,7 @@ describe Projects::DeployKeysController do
it 'returns 404' do it 'returns 404' do
put :enable, params: { id: 0, namespace_id: project.namespace, project_id: project } put :enable, params: { id: 0, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -93,7 +93,7 @@ describe Projects::EnvironmentsController do ...@@ -93,7 +93,7 @@ describe Projects::EnvironmentsController do
end end
it 'responds with access denied' do it 'responds with access denied' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -105,7 +105,7 @@ describe Projects::EnvironmentsController do ...@@ -105,7 +105,7 @@ describe Projects::EnvironmentsController do
end end
it 'is successful' do it 'is successful' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -114,7 +114,7 @@ describe Projects::EnvironmentsController do ...@@ -114,7 +114,7 @@ describe Projects::EnvironmentsController do
it 'is successful' do it 'is successful' do
get :terminal, params: environment_params get :terminal, params: environment_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
......
...@@ -38,7 +38,7 @@ describe Projects::FeatureFlagsClientsController do ...@@ -38,7 +38,7 @@ describe Projects::FeatureFlagsClientsController do
it 'returns 404' do it 'returns 404' do
reset_token reset_token
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -51,7 +51,7 @@ describe Projects::FeatureFlagsClientsController do ...@@ -51,7 +51,7 @@ describe Projects::FeatureFlagsClientsController do
it 'returns 404' do it 'returns 404' do
reset_token reset_token
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -55,7 +55,7 @@ describe Projects::FeatureFlagsController do ...@@ -55,7 +55,7 @@ describe Projects::FeatureFlagsController do
end end
it 'shows not found' do it 'shows not found' do
expect(subject).to have_gitlab_http_status(404) expect(subject).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -268,7 +268,7 @@ describe Projects::FeatureFlagsController do ...@@ -268,7 +268,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -278,7 +278,7 @@ describe Projects::FeatureFlagsController do ...@@ -278,7 +278,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -340,7 +340,7 @@ describe Projects::FeatureFlagsController do ...@@ -340,7 +340,7 @@ describe Projects::FeatureFlagsController do
it 'returns 200' do it 'returns 200' do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'creates a new feature flag' do it 'creates a new feature flag' do
...@@ -372,7 +372,7 @@ describe Projects::FeatureFlagsController do ...@@ -372,7 +372,7 @@ describe Projects::FeatureFlagsController do
it 'returns 400' do it 'returns 400' do
subject subject
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
it 'returns an error message' do it 'returns an error message' do
...@@ -409,7 +409,7 @@ describe Projects::FeatureFlagsController do ...@@ -409,7 +409,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -428,7 +428,7 @@ describe Projects::FeatureFlagsController do ...@@ -428,7 +428,7 @@ describe Projects::FeatureFlagsController do
it 'creates feature flag scopes successfully' do it 'creates feature flag scopes successfully' do
expect { subject }.to change { Operations::FeatureFlagScope.count }.by(2) expect { subject }.to change { Operations::FeatureFlagScope.count }.by(2)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'creates feature flag scopes in a correct order' do it 'creates feature flag scopes in a correct order' do
...@@ -453,7 +453,7 @@ describe Projects::FeatureFlagsController do ...@@ -453,7 +453,7 @@ describe Projects::FeatureFlagsController do
it 'returns 400' do it 'returns 400' do
subject subject
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']) expect(json_response['message'])
.to include('Default scope has to be the first element') .to include('Default scope has to be the first element')
end end
...@@ -543,7 +543,7 @@ describe Projects::FeatureFlagsController do ...@@ -543,7 +543,7 @@ describe Projects::FeatureFlagsController do
it 'returns 200' do it 'returns 200' do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'deletes one feature flag' do it 'deletes one feature flag' do
...@@ -566,7 +566,7 @@ describe Projects::FeatureFlagsController do ...@@ -566,7 +566,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -603,7 +603,7 @@ describe Projects::FeatureFlagsController do ...@@ -603,7 +603,7 @@ describe Projects::FeatureFlagsController do
it 'returns 200' do it 'returns 200' do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'updates the name of the feature flag name' do it 'updates the name of the feature flag name' do
...@@ -666,7 +666,7 @@ describe Projects::FeatureFlagsController do ...@@ -666,7 +666,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -705,7 +705,7 @@ describe Projects::FeatureFlagsController do ...@@ -705,7 +705,7 @@ describe Projects::FeatureFlagsController do
it 'returns 400' do it 'returns 400' do
subject subject
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
...@@ -755,7 +755,7 @@ describe Projects::FeatureFlagsController do ...@@ -755,7 +755,7 @@ describe Projects::FeatureFlagsController do
it 'returns 400' do it 'returns 400' do
subject subject
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
......
...@@ -37,7 +37,7 @@ describe Projects::IssueLinksController do ...@@ -37,7 +37,7 @@ describe Projects::IssueLinksController do
it 'returns success response' do it 'returns success response' do
get_link(user, issue1) get_link(user, issue1)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
link = json_response.first link = json_response.first
expect(link['id']).to eq(issue2.id) expect(link['id']).to eq(issue2.id)
...@@ -53,7 +53,7 @@ describe Projects::IssueLinksController do ...@@ -53,7 +53,7 @@ describe Projects::IssueLinksController do
it 'does not return issue_link_type' do it 'does not return issue_link_type' do
get_link(user, issue1) get_link(user, issue1)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
link = json_response.first link = json_response.first
expect(link['id']).to eq(issue2.id) expect(link['id']).to eq(issue2.id)
...@@ -87,7 +87,7 @@ describe Projects::IssueLinksController do ...@@ -87,7 +87,7 @@ describe Projects::IssueLinksController do
it 'returns success response' do it 'returns success response' do
create_link(user, issue1, issue2) create_link(user, issue1, issue2)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
link = json_response['issuables'].first link = json_response['issuables'].first
expect(link['id']).to eq(issue2.id) expect(link['id']).to eq(issue2.id)
...@@ -103,7 +103,7 @@ describe Projects::IssueLinksController do ...@@ -103,7 +103,7 @@ describe Projects::IssueLinksController do
it 'returns 403' do it 'returns 403' do
create_link(user, issue1, issue2) create_link(user, issue1, issue2)
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
end end
......
...@@ -108,7 +108,7 @@ describe Projects::IssuesController do ...@@ -108,7 +108,7 @@ describe Projects::IssuesController do
perform :get, :index, sort: 'weight' perform :get, :index, sort: 'weight'
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:issues)).to eq(expected) expect(assigns(:issues)).to eq(expected)
end end
...@@ -118,7 +118,7 @@ describe Projects::IssuesController do ...@@ -118,7 +118,7 @@ describe Projects::IssuesController do
perform :get, :index, weight: 1 perform :get, :index, weight: 1
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:issues)).to eq([issue2]) expect(assigns(:issues)).to eq([issue2])
end end
end end
...@@ -127,7 +127,7 @@ describe Projects::IssuesController do ...@@ -127,7 +127,7 @@ describe Projects::IssuesController do
it 'sets issue weight' do it 'sets issue weight' do
perform :put, :update, id: issue.to_param, issue: { weight: 6 }, format: :json perform :put, :update, id: issue.to_param, issue: { weight: 6 }, format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(issue.reload.weight).to eq(6) expect(issue.reload.weight).to eq(6)
end end
end end
...@@ -136,7 +136,7 @@ describe Projects::IssuesController do ...@@ -136,7 +136,7 @@ describe Projects::IssuesController do
it 'sets issue weight' do it 'sets issue weight' do
perform :post, :create, issue: new_issue.attributes perform :post, :create, issue: new_issue.attributes
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(Issue.count).to eq(1) expect(Issue.count).to eq(1)
issue = Issue.first issue = Issue.first
...@@ -156,7 +156,7 @@ describe Projects::IssuesController do ...@@ -156,7 +156,7 @@ describe Projects::IssuesController do
perform :get, :index, weight: 1 perform :get, :index, weight: 1
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:issues)).to match_array(expected) expect(assigns(:issues)).to match_array(expected)
end end
end end
...@@ -165,7 +165,7 @@ describe Projects::IssuesController do ...@@ -165,7 +165,7 @@ describe Projects::IssuesController do
it 'does not set issue weight' do it 'does not set issue weight' do
perform :put, :update, id: issue.to_param, issue: { weight: 6 }, format: :json perform :put, :update, id: issue.to_param, issue: { weight: 6 }, format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(issue.reload.weight).to be_nil expect(issue.reload.weight).to be_nil
expect(issue.reload.read_attribute(:weight)).to eq(5) # pre-existing data is not overwritten expect(issue.reload.read_attribute(:weight)).to eq(5) # pre-existing data is not overwritten
end end
...@@ -175,7 +175,7 @@ describe Projects::IssuesController do ...@@ -175,7 +175,7 @@ describe Projects::IssuesController do
it 'does not set issue weight' do it 'does not set issue weight' do
perform :post, :create, issue: new_issue.attributes perform :post, :create, issue: new_issue.attributes
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(Issue.count).to eq(1) expect(Issue.count).to eq(1)
issue = Issue.first issue = Issue.first
...@@ -234,7 +234,7 @@ describe Projects::IssuesController do ...@@ -234,7 +234,7 @@ describe Projects::IssuesController do
it 'returns a 404' do it 'returns a 404' do
get_service_desk get_service_desk
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -261,7 +261,7 @@ describe Projects::IssuesController do ...@@ -261,7 +261,7 @@ describe Projects::IssuesController do
} }
expect(response).to redirect_to(designs_project_issue_path(new_project, issue)) expect(response).to redirect_to(designs_project_issue_path(new_project, issue))
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
......
...@@ -26,7 +26,7 @@ describe Projects::LicensesController do ...@@ -26,7 +26,7 @@ describe Projects::LicensesController do
it 'responds to an HTML request' do it 'responds to an HTML request' do
get :index, params: params get :index, params: params
expect(response).to have_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
end end
it 'counts usage of the feature' do it 'counts usage of the feature' do
...@@ -43,7 +43,7 @@ describe Projects::LicensesController do ...@@ -43,7 +43,7 @@ describe Projects::LicensesController do
end end
it 'returns success code' do it 'returns success code' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'returns a hash with licenses' do it 'returns a hash with licenses' do
...@@ -91,7 +91,7 @@ describe Projects::LicensesController do ...@@ -91,7 +91,7 @@ describe Projects::LicensesController do
}, format: :json }, format: :json
end end
it { expect(response).to have_http_status(:ok) } it { expect(response).to have_gitlab_http_status(:ok) }
it { expect(json_response["licenses"].count).to be(4) } it { expect(json_response["licenses"].count).to be(4) }
it 'includes a policy for an unclassified and known license that was detected in the scan report' do it 'includes a policy for an unclassified and known license that was detected in the scan report' do
...@@ -144,7 +144,7 @@ describe Projects::LicensesController do ...@@ -144,7 +144,7 @@ describe Projects::LicensesController do
}, format: :json }, format: :json
end end
it { expect(response).to have_http_status(:ok) } it { expect(response).to have_gitlab_http_status(:ok) }
it 'only includes policies for licenses detected in the most recent scan report' do it 'only includes policies for licenses detected in the most recent scan report' do
expect(json_response["licenses"].count).to be(3) expect(json_response["licenses"].count).to be(3)
...@@ -186,7 +186,7 @@ describe Projects::LicensesController do ...@@ -186,7 +186,7 @@ describe Projects::LicensesController do
}, format: :json }, format: :json
end end
it { expect(response).to have_http_status(:ok) } it { expect(response).to have_gitlab_http_status(:ok) }
it { expect(json_response["licenses"].count).to be(1) } it { expect(json_response["licenses"].count).to be(1) }
it 'includes only `allowed` policies' do it 'includes only `allowed` policies' do
...@@ -207,7 +207,7 @@ describe Projects::LicensesController do ...@@ -207,7 +207,7 @@ describe Projects::LicensesController do
}, format: :json }, format: :json
end end
it { expect(response).to have_http_status(:ok) } it { expect(response).to have_gitlab_http_status(:ok) }
it { expect(json_response["licenses"].count).to be(2) } it { expect(json_response["licenses"].count).to be(2) }
it 'includes `denied` policies' do it 'includes `denied` policies' do
...@@ -247,7 +247,7 @@ describe Projects::LicensesController do ...@@ -247,7 +247,7 @@ describe Projects::LicensesController do
end end
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -260,7 +260,7 @@ describe Projects::LicensesController do ...@@ -260,7 +260,7 @@ describe Projects::LicensesController do
end end
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -292,7 +292,7 @@ describe Projects::LicensesController do ...@@ -292,7 +292,7 @@ describe Projects::LicensesController do
post :create, xhr: true, params: default_params post :create, xhr: true, params: default_params
end end
it { expect(response).to have_http_status(:not_found) } it { expect(response).to have_gitlab_http_status(:not_found) }
end end
context "when the current user is a member of the project but not authorized to create policies" do context "when the current user is a member of the project but not authorized to create policies" do
...@@ -302,7 +302,7 @@ describe Projects::LicensesController do ...@@ -302,7 +302,7 @@ describe Projects::LicensesController do
post :create, xhr: true, params: default_params post :create, xhr: true, params: default_params
end end
it { expect(response).to have_http_status(:not_found) } it { expect(response).to have_gitlab_http_status(:not_found) }
end end
context "when authorized as a maintainer" do context "when authorized as a maintainer" do
...@@ -322,7 +322,7 @@ describe Projects::LicensesController do ...@@ -322,7 +322,7 @@ describe Projects::LicensesController do
}) })
end end
it { expect(response).to have_http_status(:created) } it { expect(response).to have_gitlab_http_status(:created) }
it 'creates a new policy' do it 'creates a new policy' do
expect(project.reload.software_license_policies.denied.count).to be(1) expect(project.reload.software_license_policies.denied.count).to be(1)
...@@ -349,7 +349,7 @@ describe Projects::LicensesController do ...@@ -349,7 +349,7 @@ describe Projects::LicensesController do
}) })
end end
it { expect(response).to have_http_status(:created) } it { expect(response).to have_gitlab_http_status(:created) }
it 'creates a new policy' do it 'creates a new policy' do
expect(project.reload.software_license_policies.allowed.count).to be(1) expect(project.reload.software_license_policies.allowed.count).to be(1)
...@@ -376,7 +376,7 @@ describe Projects::LicensesController do ...@@ -376,7 +376,7 @@ describe Projects::LicensesController do
}) })
end end
it { expect(response).to have_http_status(:unprocessable_entity) } it { expect(response).to have_gitlab_http_status(:unprocessable_entity) }
it { expect(json).to eq({ 'errors' => { "software_license" => ["can't be blank"] } }) } it { expect(json).to eq({ 'errors' => { "software_license" => ["can't be blank"] } }) }
end end
end end
...@@ -410,7 +410,7 @@ describe Projects::LicensesController do ...@@ -410,7 +410,7 @@ describe Projects::LicensesController do
patch :update, xhr: true, params: default_params patch :update, xhr: true, params: default_params
end end
it { expect(response).to have_http_status(:not_found) } it { expect(response).to have_gitlab_http_status(:not_found) }
end end
context "when the current user is a member of the project but not authorized to update policies" do context "when the current user is a member of the project but not authorized to update policies" do
...@@ -420,7 +420,7 @@ describe Projects::LicensesController do ...@@ -420,7 +420,7 @@ describe Projects::LicensesController do
patch :update, xhr: true, params: default_params patch :update, xhr: true, params: default_params
end end
it { expect(response).to have_http_status(:not_found) } it { expect(response).to have_gitlab_http_status(:not_found) }
end end
context "when authorized as a maintainer" do context "when authorized as a maintainer" do
...@@ -439,7 +439,7 @@ describe Projects::LicensesController do ...@@ -439,7 +439,7 @@ describe Projects::LicensesController do
}) })
end end
it { expect(response).to have_http_status(:ok) } it { expect(response).to have_gitlab_http_status(:ok) }
it { expect(software_license_policy.reload).to be_denied } it { expect(software_license_policy.reload).to be_denied }
it "generates the proper JSON response" do it "generates the proper JSON response" do
...@@ -459,7 +459,7 @@ describe Projects::LicensesController do ...@@ -459,7 +459,7 @@ describe Projects::LicensesController do
}) })
end end
it { expect(response).to have_http_status(:unprocessable_entity) } it { expect(response).to have_gitlab_http_status(:unprocessable_entity) }
it { expect(json).to eq({ "errors" => { "classification" => ["is invalid"] } }) } it { expect(json).to eq({ "errors" => { "classification" => ["is invalid"] } }) }
end end
end end
......
...@@ -473,7 +473,7 @@ describe Projects::MergeRequestsController do ...@@ -473,7 +473,7 @@ describe Projects::MergeRequestsController do
it 'restricts unauthorized access' do it 'restricts unauthorized access' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -556,7 +556,7 @@ describe Projects::MergeRequestsController do ...@@ -556,7 +556,7 @@ describe Projects::MergeRequestsController do
it 'restricts unauthorized access' do it 'restricts unauthorized access' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -639,7 +639,7 @@ describe Projects::MergeRequestsController do ...@@ -639,7 +639,7 @@ describe Projects::MergeRequestsController do
it 'restricts unauthorized access' do it 'restricts unauthorized access' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -720,7 +720,7 @@ describe Projects::MergeRequestsController do ...@@ -720,7 +720,7 @@ describe Projects::MergeRequestsController do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'restricts access to other users' do it 'restricts access to other users' do
...@@ -728,7 +728,7 @@ describe Projects::MergeRequestsController do ...@@ -728,7 +728,7 @@ describe Projects::MergeRequestsController do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -144,14 +144,14 @@ describe Projects::MirrorsController do ...@@ -144,14 +144,14 @@ describe Projects::MirrorsController do
it 'processes a successful update' do it 'processes a successful update' do
do_put(project, { import_url: 'https://updated.example.com' }, format: :json) do_put(project, { import_url: 'https://updated.example.com' }, format: :json)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['import_url']).to eq('https://updated.example.com') expect(json_response['import_url']).to eq('https://updated.example.com')
end end
it 'processes an unsuccessful update' do it 'processes an unsuccessful update' do
do_put(project, { import_url: 'ftp://invalid.invalid' }, format: :json) do_put(project, { import_url: 'ftp://invalid.invalid' }, format: :json)
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['import_url'].first).to match /is blocked/ expect(json_response['import_url'].first).to match /is blocked/
end end
...@@ -160,14 +160,14 @@ describe Projects::MirrorsController do ...@@ -160,14 +160,14 @@ describe Projects::MirrorsController do
do_put(project, { import_data_attributes: { password: 'update' } }, format: :json) do_put(project, { import_data_attributes: { password: 'update' } }, format: :json)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(project.reload_import_data.id).to eq(import_data_id) expect(project.reload_import_data.id).to eq(import_data_id)
end end
it 'sets ssh_known_hosts_verified_at and verified_by when the update sets known hosts' do it 'sets ssh_known_hosts_verified_at and verified_by when the update sets known hosts' do
do_put(project, { import_data_attributes: { ssh_known_hosts: 'update' } }, format: :json) do_put(project, { import_data_attributes: { ssh_known_hosts: 'update' } }, format: :json)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
import_data = project.reload_import_data import_data = project.reload_import_data
expect(import_data.ssh_known_hosts_verified_at).to be_within(1.minute).of(Time.now) expect(import_data.ssh_known_hosts_verified_at).to be_within(1.minute).of(Time.now)
...@@ -179,7 +179,7 @@ describe Projects::MirrorsController do ...@@ -179,7 +179,7 @@ describe Projects::MirrorsController do
do_put(project, { import_data_attributes: { ssh_known_hosts: '' } }, format: :json) do_put(project, { import_data_attributes: { ssh_known_hosts: '' } }, format: :json)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
import_data = project.reload_import_data import_data = project.reload_import_data
expect(import_data.ssh_known_hosts_verified_at).to be_nil expect(import_data.ssh_known_hosts_verified_at).to be_nil
...@@ -192,7 +192,7 @@ describe Projects::MirrorsController do ...@@ -192,7 +192,7 @@ describe Projects::MirrorsController do
do_put(project, { mirror_user_id: other_user.id }, format: :json) do_put(project, { mirror_user_id: other_user.id }, format: :json)
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['mirror_user_id'].first).to eq("is invalid") expect(json_response['mirror_user_id'].first).to eq("is invalid")
end end
end end
......
...@@ -17,7 +17,7 @@ describe Projects::PathLocksController do ...@@ -17,7 +17,7 @@ describe Projects::PathLocksController do
it 'displays the lock paths' do it 'displays the lock paths' do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
context 'when the user does not have access' do context 'when the user does not have access' do
...@@ -27,7 +27,7 @@ describe Projects::PathLocksController do ...@@ -27,7 +27,7 @@ describe Projects::PathLocksController do
it 'does not allow access' do it 'does not allow access' do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -43,7 +43,7 @@ describe Projects::PathLocksController do ...@@ -43,7 +43,7 @@ describe Projects::PathLocksController do
toggle_lock(file_path) toggle_lock(file_path)
expect(PathLock.count).to eq(1) expect(PathLock.count).to eq(1)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it "locks the file in LFS" do it "locks the file in LFS" do
...@@ -61,13 +61,13 @@ describe Projects::PathLocksController do ...@@ -61,13 +61,13 @@ describe Projects::PathLocksController do
it 'locks the directory' do it 'locks the directory' do
expect { toggle_lock('bar/') }.to change { PathLock.count }.to(1) expect { toggle_lock('bar/') }.to change { PathLock.count }.to(1)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'does not locks the directory through LFS' do it 'does not locks the directory through LFS' do
expect { toggle_lock('bar/') }.not_to change { LfsFileLock.count } expect { toggle_lock('bar/') }.not_to change { LfsFileLock.count }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -80,7 +80,7 @@ describe Projects::PathLocksController do ...@@ -80,7 +80,7 @@ describe Projects::PathLocksController do
it 'unlocks the file' do it 'unlocks the file' do
expect { toggle_lock(file_path) }.to change { PathLock.count }.to(0) expect { toggle_lock(file_path) }.to change { PathLock.count }.to(0)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it "unlocks the file in LFS" do it "unlocks the file in LFS" do
...@@ -97,7 +97,7 @@ describe Projects::PathLocksController do ...@@ -97,7 +97,7 @@ describe Projects::PathLocksController do
it 'unlocks the directory' do it 'unlocks the directory' do
expect { toggle_lock('bar') }.to change { PathLock.count }.to(0) expect { toggle_lock('bar') }.to change { PathLock.count }.to(0)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'does not call the LFS unlock service' do it 'does not call the LFS unlock service' do
...@@ -112,7 +112,7 @@ describe Projects::PathLocksController do ...@@ -112,7 +112,7 @@ describe Projects::PathLocksController do
it 'locks the file' do it 'locks the file' do
expect { toggle_lock(file_path) }.to change { PathLock.count }.to(1) expect { toggle_lock(file_path) }.to change { PathLock.count }.to(1)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it "doesn't lock the file in LFS" do it "doesn't lock the file in LFS" do
...@@ -124,7 +124,7 @@ describe Projects::PathLocksController do ...@@ -124,7 +124,7 @@ describe Projects::PathLocksController do
expect { toggle_lock(file_path) }.to change { PathLock.count }.to(0) expect { toggle_lock(file_path) }.to change { PathLock.count }.to(0)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -135,7 +135,7 @@ describe Projects::PathLocksController do ...@@ -135,7 +135,7 @@ describe Projects::PathLocksController do
it 'does not allow access' do it 'does not allow access' do
toggle_lock(file_path) toggle_lock(file_path)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -27,7 +27,7 @@ describe Projects::PipelinesController do ...@@ -27,7 +27,7 @@ describe Projects::PipelinesController do
end end
it do it do
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
...@@ -89,7 +89,7 @@ describe Projects::PipelinesController do ...@@ -89,7 +89,7 @@ describe Projects::PipelinesController do
end end
it do it do
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
...@@ -133,7 +133,7 @@ describe Projects::PipelinesController do ...@@ -133,7 +133,7 @@ describe Projects::PipelinesController do
end end
it 'will not return report' do it 'will not return report' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -157,7 +157,7 @@ describe Projects::PipelinesController do ...@@ -157,7 +157,7 @@ describe Projects::PipelinesController do
end end
it 'will return 404' do it 'will return 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -177,7 +177,7 @@ describe Projects::PipelinesController do ...@@ -177,7 +177,7 @@ describe Projects::PipelinesController do
end end
it 'will return 404' do it 'will return 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -79,7 +79,7 @@ describe Projects::ProtectedEnvironmentsController do ...@@ -79,7 +79,7 @@ describe Projects::ProtectedEnvironmentsController do
it 'renders 404' do it 'renders 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -123,7 +123,7 @@ describe Projects::ProtectedEnvironmentsController do ...@@ -123,7 +123,7 @@ describe Projects::ProtectedEnvironmentsController do
end end
it 'is successful' do it 'is successful' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -135,7 +135,7 @@ describe Projects::ProtectedEnvironmentsController do ...@@ -135,7 +135,7 @@ describe Projects::ProtectedEnvironmentsController do
end end
it 'is not successful' do it 'is not successful' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -184,7 +184,7 @@ describe Projects::ProtectedEnvironmentsController do ...@@ -184,7 +184,7 @@ describe Projects::ProtectedEnvironmentsController do
it 'is not successful' do it 'is not successful' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -20,7 +20,7 @@ describe Projects::PushRulesController do ...@@ -20,7 +20,7 @@ describe Projects::PushRulesController do
it 'updates the push rule' do it 'updates the push rule' do
do_update do_update
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(project.reload_push_rule.prevent_secrets).to be_truthy expect(project.reload_push_rule.prevent_secrets).to be_truthy
end end
...@@ -32,7 +32,7 @@ describe Projects::PushRulesController do ...@@ -32,7 +32,7 @@ describe Projects::PushRulesController do
it 'returns 404' do it 'returns 404' do
do_update do_update
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
......
...@@ -23,7 +23,7 @@ describe Projects::ThreatMonitoringController do ...@@ -23,7 +23,7 @@ describe Projects::ThreatMonitoringController do
it 'renders the show template' do it 'renders the show template' do
subject subject
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
...@@ -37,7 +37,7 @@ describe Projects::ThreatMonitoringController do ...@@ -37,7 +37,7 @@ describe Projects::ThreatMonitoringController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -55,7 +55,7 @@ describe Projects::ThreatMonitoringController do ...@@ -55,7 +55,7 @@ describe Projects::ThreatMonitoringController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -64,7 +64,7 @@ describe Projects::ThreatMonitoringController do ...@@ -64,7 +64,7 @@ describe Projects::ThreatMonitoringController do
it 'returns 302' do it 'returns 302' 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) expect(response).to redirect_to(new_user_session_path)
end end
end end
......
...@@ -16,7 +16,7 @@ describe Projects::TracingsController do ...@@ -16,7 +16,7 @@ describe Projects::TracingsController do
it 'renders OK' do it 'renders OK' do
get :show, params: { namespace_id: project.namespace, project_id: project } get :show, 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(:show) expect(response).to render_template(:show)
end end
end end
......
...@@ -28,7 +28,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -28,7 +28,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a successful 200 response' do it 'returns a successful 200 response' do
list_feedbacks list_feedbacks
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'returns project feedbacks list' do it 'returns project feedbacks list' do
...@@ -72,7 +72,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -72,7 +72,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a 404 response' do it 'returns a 404 response' do
list_feedbacks list_feedbacks
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 Projects::VulnerabilityFeedbackController do ...@@ -131,13 +131,13 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a forbidden 403 response when feedbback_type is nil' do it 'returns a forbidden 403 response when feedbback_type is nil' do
create_feedback user: user, project: project, params: create_params.except(:feedback_type) create_feedback user: user, project: project, params: create_params.except(:feedback_type)
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
it 'returns a forbidden 403 response when feedbback_type is invalid' do it 'returns a forbidden 403 response when feedbback_type is invalid' do
create_feedback user: user, project: project, params: create_params.merge(feedback_type: 'foo') create_feedback user: user, project: project, params: create_params.merge(feedback_type: 'foo')
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -148,7 +148,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -148,7 +148,7 @@ describe Projects::VulnerabilityFeedbackController do
create_feedback user: guest, project: project, params: create_params.merge(feedback_type: 'issue') create_feedback user: guest, project: project, params: create_params.merge(feedback_type: 'issue')
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -158,7 +158,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -158,7 +158,7 @@ describe Projects::VulnerabilityFeedbackController do
create_feedback user: guest, project: project, params: create_params.merge(feedback_type: 'merge_request') create_feedback user: guest, project: project, params: create_params.merge(feedback_type: 'merge_request')
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -168,7 +168,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -168,7 +168,7 @@ describe Projects::VulnerabilityFeedbackController do
create_feedback user: guest, project: project, params: create_params.merge(feedback_type: 'dismissal') create_feedback user: guest, project: project, params: create_params.merge(feedback_type: 'dismissal')
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
end end
...@@ -180,7 +180,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -180,7 +180,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a 404 response' do it 'returns a 404 response' do
create_feedback user: unauthorized_user, project: project, params: create_params create_feedback user: unauthorized_user, project: project, params: create_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -216,7 +216,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -216,7 +216,7 @@ describe Projects::VulnerabilityFeedbackController do
end end
it 'returns a successful 200 response' do it 'returns a successful 200 response' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'updates the comment attributes' do it 'updates the comment attributes' do
...@@ -229,7 +229,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -229,7 +229,7 @@ describe Projects::VulnerabilityFeedbackController do
vuln_feedback.id = 123 vuln_feedback.id = 123
update_feedback user: user, params: vuln_feedback update_feedback user: user, params: vuln_feedback
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -239,7 +239,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -239,7 +239,7 @@ describe Projects::VulnerabilityFeedbackController do
update_feedback user: guest, params: vuln_feedback update_feedback user: guest, params: vuln_feedback
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -250,7 +250,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -250,7 +250,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a 404 response' do it 'returns a 404 response' do
update_feedback user: unauthorized_user, params: vuln_feedback update_feedback user: unauthorized_user, params: vuln_feedback
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -274,7 +274,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -274,7 +274,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a successful 204 response' do it 'returns a successful 204 response' do
destroy_feedback user: user, project: project, id: vuln_feedback.id destroy_feedback user: user, project: project, id: vuln_feedback.id
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
end end
end end
...@@ -282,7 +282,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -282,7 +282,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a not found 404 response for invalid vulnerability feedback id' do it 'returns a not found 404 response for invalid vulnerability feedback id' do
destroy_feedback user: user, project: project, id: 123 destroy_feedback user: user, project: project, id: 123
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -292,7 +292,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -292,7 +292,7 @@ describe Projects::VulnerabilityFeedbackController do
destroy_feedback user: guest, project: project, id: vuln_feedback.id destroy_feedback user: guest, project: project, id: vuln_feedback.id
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -303,7 +303,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -303,7 +303,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a 404 response' do it 'returns a 404 response' do
destroy_feedback user: unauthorized_user, project: project, id: vuln_feedback.id destroy_feedback user: unauthorized_user, project: project, id: vuln_feedback.id
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -313,7 +313,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -313,7 +313,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a forbidden 403 response' do it 'returns a forbidden 403 response' do
destroy_feedback user: user, project: project, id: vuln_feedback.id destroy_feedback user: user, project: project, id: vuln_feedback.id
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -323,7 +323,7 @@ describe Projects::VulnerabilityFeedbackController do ...@@ -323,7 +323,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a forbidden 403 response' do it 'returns a forbidden 403 response' do
destroy_feedback user: user, project: project, id: vuln_feedback.id destroy_feedback user: user, project: project, id: vuln_feedback.id
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
......
...@@ -30,7 +30,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -30,7 +30,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { admin } let(:user) { admin }
it 'returns 200' do it 'returns 200' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -38,7 +38,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -38,7 +38,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { owner } let(:user) { owner }
it 'returns 200' do it 'returns 200' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -46,7 +46,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -46,7 +46,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { maintainer } let(:user) { maintainer }
it 'returns 200' do it 'returns 200' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -54,7 +54,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -54,7 +54,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { developer } let(:user) { developer }
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -62,7 +62,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -62,7 +62,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { reporter } let(:user) { reporter }
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -70,7 +70,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -70,7 +70,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { guest } let(:user) { guest }
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -78,7 +78,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -78,7 +78,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { create(:user) } let(:user) { create(:user) }
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -89,7 +89,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -89,7 +89,7 @@ describe Projects::WebIdeTerminalsController do
let(:pipeline) { create(:ci_pipeline, project: project, source: :chat, user: user) } let(:pipeline) { create(:ci_pipeline, project: project, source: :chat, user: user) }
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -124,7 +124,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -124,7 +124,7 @@ describe Projects::WebIdeTerminalsController do
let(:result) { { status: :error } } let(:result) { { status: :error } }
it 'returns 422' do it 'returns 422' do
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
end end
end end
end end
...@@ -161,7 +161,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -161,7 +161,7 @@ describe Projects::WebIdeTerminalsController do
it 'returns 400' do it 'returns 400' do
subject subject
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
...@@ -174,7 +174,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -174,7 +174,7 @@ describe Projects::WebIdeTerminalsController do
subject subject
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
end end
...@@ -197,7 +197,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -197,7 +197,7 @@ describe Projects::WebIdeTerminalsController do
let!(:job) { create(:ci_build, :failed, pipeline: pipeline, user: user) } let!(:job) { create(:ci_build, :failed, pipeline: pipeline, user: user) }
it 'returns 422' do it 'returns 422' do
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
end end
end end
end end
...@@ -220,7 +220,7 @@ describe Projects::WebIdeTerminalsController do ...@@ -220,7 +220,7 @@ describe Projects::WebIdeTerminalsController do
let!(:job) { create(:ci_build, :running, pipeline: pipeline, user: user) } let!(:job) { create(:ci_build, :running, pipeline: pipeline, user: user) }
it 'returns 422' do it 'returns 422' do
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
end end
end end
end end
......
...@@ -156,7 +156,7 @@ describe Projects::ArtifactsController do ...@@ -156,7 +156,7 @@ describe Projects::ArtifactsController do
it 'returns 404' do it 'returns 404' do
download_artifact(file_type: file_type) download_artifact(file_type: file_type)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -236,7 +236,7 @@ describe Projects::ArtifactsController do ...@@ -236,7 +236,7 @@ describe Projects::ArtifactsController do
it 'renders the file view' do it 'renders the file view' do
get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt' } get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt' }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -302,7 +302,7 @@ describe Projects::ArtifactsController do ...@@ -302,7 +302,7 @@ describe Projects::ArtifactsController do
it 'renders the file view' do it 'renders the file view' do
get :file, params: { namespace_id: private_project.namespace, project_id: private_project, job_id: job, path: 'ci_artifacts.txt' } get :file, params: { namespace_id: private_project.namespace, project_id: private_project, job_id: job, path: 'ci_artifacts.txt' }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
...@@ -317,7 +317,7 @@ describe Projects::ArtifactsController do ...@@ -317,7 +317,7 @@ describe Projects::ArtifactsController do
it 'serves the file using workhorse' do it 'serves the file using workhorse' do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(send_data).to start_with('artifacts-entry:') expect(send_data).to start_with('artifacts-entry:')
expect(params.keys).to eq(%w(Archive Entry)) expect(params.keys).to eq(%w(Archive Entry))
......
...@@ -65,7 +65,7 @@ describe Projects::AutocompleteSourcesController do ...@@ -65,7 +65,7 @@ describe Projects::AutocompleteSourcesController do
get :milestones, format: :json, params: { namespace_id: group.path, project_id: project.path } get :milestones, format: :json, params: { namespace_id: group.path, project_id: project.path }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -16,7 +16,7 @@ describe Projects::AvatarsController do ...@@ -16,7 +16,7 @@ describe Projects::AvatarsController do
it 'shows 404' do it 'shows 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -31,7 +31,7 @@ describe Projects::AvatarsController do ...@@ -31,7 +31,7 @@ describe Projects::AvatarsController do
it 'sends the avatar' do it 'sends the avatar' do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.header['Content-Disposition']).to eq('inline') expect(response.header['Content-Disposition']).to eq('inline')
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:') expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:')
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true" expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
......
...@@ -232,7 +232,7 @@ describe Projects::BlobController do ...@@ -232,7 +232,7 @@ describe Projects::BlobController do
end end
it 'redirects to blob show' do it 'redirects to blob show' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -246,7 +246,7 @@ describe Projects::BlobController do ...@@ -246,7 +246,7 @@ describe Projects::BlobController do
end end
it 'redirects to blob show' do it 'redirects to blob show' do
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 Projects::BoardsController do ...@@ -39,7 +39,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
list_boards list_boards
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html' expect(response.content_type).to eq 'text/html'
end end
end end
...@@ -82,7 +82,7 @@ describe Projects::BoardsController do ...@@ -82,7 +82,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
list_boards format: :json list_boards format: :json
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
end end
end end
...@@ -94,7 +94,7 @@ describe Projects::BoardsController do ...@@ -94,7 +94,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
list_boards list_boards
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -137,7 +137,7 @@ describe Projects::BoardsController do ...@@ -137,7 +137,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
read_board board: board read_board board: board
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html' expect(response.content_type).to eq 'text/html'
end end
end end
...@@ -174,7 +174,7 @@ describe Projects::BoardsController do ...@@ -174,7 +174,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
read_board board: board, format: :json read_board board: board, format: :json
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
end end
end end
...@@ -186,7 +186,7 @@ describe Projects::BoardsController do ...@@ -186,7 +186,7 @@ describe Projects::BoardsController do
read_board board: another_board read_board board: another_board
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
......
...@@ -217,7 +217,7 @@ describe Projects::BranchesController do ...@@ -217,7 +217,7 @@ describe Projects::BranchesController do
} }
expect(response.location).to include(project_new_blob_path(project, branch)) expect(response.location).to include(project_new_blob_path(project, branch))
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -238,7 +238,7 @@ describe Projects::BranchesController do ...@@ -238,7 +238,7 @@ describe Projects::BranchesController do
} }
expect(response.location).to include(project_new_blob_path(project, branch)) expect(response.location).to include(project_new_blob_path(project, branch))
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -289,7 +289,7 @@ describe Projects::BranchesController do ...@@ -289,7 +289,7 @@ describe Projects::BranchesController do
it 'returns a successful 200 response' do it 'returns a successful 200 response' do
create_branch name: 'my-branch', ref: 'master' create_branch name: 'my-branch', ref: 'master'
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'returns the created branch' do it 'returns the created branch' do
...@@ -303,7 +303,7 @@ describe Projects::BranchesController do ...@@ -303,7 +303,7 @@ describe Projects::BranchesController do
it 'returns an unprocessable entity 422 response' do it 'returns an unprocessable entity 422 response' do
create_branch name: "<script>alert('merge');</script>", ref: "<script>alert('ref');</script>" create_branch name: "<script>alert('merge');</script>", ref: "<script>alert('ref');</script>"
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
end end
end end
...@@ -335,7 +335,7 @@ describe Projects::BranchesController do ...@@ -335,7 +335,7 @@ describe Projects::BranchesController do
project_id: project project_id: project
} }
expect(response).to have_gitlab_http_status(303) expect(response).to have_gitlab_http_status(:see_other)
end end
end end
...@@ -361,28 +361,28 @@ describe Projects::BranchesController do ...@@ -361,28 +361,28 @@ describe Projects::BranchesController do
context "valid branch name, valid source" do context "valid branch name, valid source" do
let(:branch) { "feature" } let(:branch) { "feature" }
it { expect(response).to have_gitlab_http_status(200) } it { expect(response).to have_gitlab_http_status(:ok) }
it { expect(response.body).to be_blank } it { expect(response.body).to be_blank }
end end
context "valid branch name with unencoded slashes" do context "valid branch name with unencoded slashes" do
let(:branch) { "improve/awesome" } let(:branch) { "improve/awesome" }
it { expect(response).to have_gitlab_http_status(200) } it { expect(response).to have_gitlab_http_status(:ok) }
it { expect(response.body).to be_blank } it { expect(response.body).to be_blank }
end end
context "valid branch name with encoded slashes" do context "valid branch name with encoded slashes" do
let(:branch) { "improve%2Fawesome" } let(:branch) { "improve%2Fawesome" }
it { expect(response).to have_gitlab_http_status(200) } it { expect(response).to have_gitlab_http_status(:ok) }
it { expect(response.body).to be_blank } it { expect(response.body).to be_blank }
end end
context "invalid branch name, valid ref" do context "invalid branch name, valid ref" do
let(:branch) { "no-branch" } let(:branch) { "no-branch" }
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(:not_found) }
it { expect(response.body).to be_blank } it { expect(response.body).to be_blank }
end end
end end
...@@ -398,7 +398,7 @@ describe Projects::BranchesController do ...@@ -398,7 +398,7 @@ describe Projects::BranchesController do
expect(json_response).to eql("message" => 'Branch was deleted') expect(json_response).to eql("message" => 'Branch was deleted')
end end
it { expect(response).to have_gitlab_http_status(200) } it { expect(response).to have_gitlab_http_status(:ok) }
end end
context 'valid branch name with unencoded slashes' do context 'valid branch name with unencoded slashes' do
...@@ -408,7 +408,7 @@ describe Projects::BranchesController do ...@@ -408,7 +408,7 @@ describe Projects::BranchesController do
expect(json_response).to eql('message' => 'Branch was deleted') expect(json_response).to eql('message' => 'Branch was deleted')
end end
it { expect(response).to have_gitlab_http_status(200) } it { expect(response).to have_gitlab_http_status(:ok) }
end end
context "valid branch name with encoded slashes" do context "valid branch name with encoded slashes" do
...@@ -418,7 +418,7 @@ describe Projects::BranchesController do ...@@ -418,7 +418,7 @@ describe Projects::BranchesController do
expect(json_response).to eql('message' => 'Branch was deleted') expect(json_response).to eql('message' => 'Branch was deleted')
end end
it { expect(response).to have_gitlab_http_status(200) } it { expect(response).to have_gitlab_http_status(:ok) }
end end
context 'invalid branch name, valid ref' do context 'invalid branch name, valid ref' do
...@@ -428,7 +428,7 @@ describe Projects::BranchesController do ...@@ -428,7 +428,7 @@ describe Projects::BranchesController do
expect(json_response).to eql('message' => 'No such branch') expect(json_response).to eql('message' => 'No such branch')
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
...@@ -478,7 +478,7 @@ describe Projects::BranchesController do ...@@ -478,7 +478,7 @@ describe Projects::BranchesController do
it 'responds with status 404' do it 'responds with status 404' do
destroy_all_merged destroy_all_merged
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -519,7 +519,7 @@ describe Projects::BranchesController do ...@@ -519,7 +519,7 @@ describe Projects::BranchesController do
state: 'all' state: 'all'
} }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -537,7 +537,7 @@ describe Projects::BranchesController do ...@@ -537,7 +537,7 @@ describe Projects::BranchesController do
state: 'all' state: 'all'
} }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -594,7 +594,7 @@ describe Projects::BranchesController do ...@@ -594,7 +594,7 @@ describe Projects::BranchesController do
names: %w[fix add-pdf-file branch-merged] names: %w[fix add-pdf-file branch-merged]
} }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq( expect(json_response).to eq(
"fix" => { "behind" => 29, "ahead" => 2 }, "fix" => { "behind" => 29, "ahead" => 2 },
"branch-merged" => { "behind" => 1, "ahead" => 0 }, "branch-merged" => { "behind" => 1, "ahead" => 0 },
...@@ -612,7 +612,7 @@ describe Projects::BranchesController do ...@@ -612,7 +612,7 @@ describe Projects::BranchesController do
project_id: project project_id: project
} }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response.count).to be > 1 expect(json_response.count).to be > 1
end end
...@@ -629,7 +629,7 @@ describe Projects::BranchesController do ...@@ -629,7 +629,7 @@ describe Projects::BranchesController do
project_id: project project_id: project
} }
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['error']).to eq("Specify at least one and at most #{Kaminari.config.default_per_page} branch names") expect(json_response['error']).to eq("Specify at least one and at most #{Kaminari.config.default_per_page} branch names")
end end
...@@ -642,7 +642,7 @@ describe Projects::BranchesController do ...@@ -642,7 +642,7 @@ describe Projects::BranchesController do
names: %w[fix add-pdf-file branch-merged] names: %w[fix add-pdf-file branch-merged]
} }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response.count).to be > 1 expect(json_response.count).to be > 1
end end
end end
......
...@@ -648,7 +648,7 @@ describe Projects::ClustersController do ...@@ -648,7 +648,7 @@ describe Projects::ClustersController do
go(format: :json) go(format: :json)
cluster.reload cluster.reload
expect(response).to have_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
expect(cluster.enabled).to be_falsey expect(cluster.enabled).to be_falsey
expect(cluster.name).to eq('my-new-cluster-name') expect(cluster.name).to eq('my-new-cluster-name')
expect(cluster).not_to be_managed expect(cluster).not_to be_managed
...@@ -671,7 +671,7 @@ describe Projects::ClustersController do ...@@ -671,7 +671,7 @@ describe Projects::ClustersController do
it "rejects changes" do it "rejects changes" do
go(format: :json) go(format: :json)
expect(response).to have_http_status(:bad_request) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
end end
......
...@@ -179,7 +179,7 @@ describe Projects::CommitController do ...@@ -179,7 +179,7 @@ describe Projects::CommitController do
}) })
expect(response).not_to be_successful expect(response).not_to be_successful
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -236,7 +236,7 @@ describe Projects::CommitController do ...@@ -236,7 +236,7 @@ describe Projects::CommitController do
}) })
expect(response).not_to be_successful expect(response).not_to be_successful
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -322,7 +322,7 @@ describe Projects::CommitController do ...@@ -322,7 +322,7 @@ describe Projects::CommitController do
end end
it 'returns a 404' do it 'returns a 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -334,7 +334,7 @@ describe Projects::CommitController do ...@@ -334,7 +334,7 @@ describe Projects::CommitController do
end end
it 'returns a 404' do it 'returns a 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -345,7 +345,7 @@ describe Projects::CommitController do ...@@ -345,7 +345,7 @@ describe Projects::CommitController do
end end
it 'returns a 404' do it 'returns a 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -393,7 +393,7 @@ describe Projects::CommitController do ...@@ -393,7 +393,7 @@ describe Projects::CommitController do
end end
it 'returns a 404' do it 'returns a 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -108,7 +108,7 @@ describe Projects::CompareController do ...@@ -108,7 +108,7 @@ describe Projects::CompareController do
show_request show_request
expect(flash[:alert]).to eq('Invalid branch name') expect(flash[:alert]).to eq('Invalid branch name')
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -120,7 +120,7 @@ describe Projects::CompareController do ...@@ -120,7 +120,7 @@ describe Projects::CompareController do
show_request show_request
expect(flash[:alert]).to eq('Invalid branch name') expect(flash[:alert]).to eq('Invalid branch name')
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
...@@ -164,7 +164,7 @@ describe Projects::CompareController do ...@@ -164,7 +164,7 @@ describe Projects::CompareController do
end end
it 'returns a 404' do it 'returns a 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -176,7 +176,7 @@ describe Projects::CompareController do ...@@ -176,7 +176,7 @@ describe Projects::CompareController do
end end
it 'returns a 404' do it 'returns a 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -187,7 +187,7 @@ describe Projects::CompareController do ...@@ -187,7 +187,7 @@ describe Projects::CompareController do
end end
it 'returns a 404' do it 'returns a 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -197,7 +197,7 @@ describe Projects::CompareController do ...@@ -197,7 +197,7 @@ describe Projects::CompareController do
end end
it 'returns a 404' do it 'returns a 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -301,7 +301,7 @@ describe Projects::CompareController do ...@@ -301,7 +301,7 @@ describe Projects::CompareController do
it 'returns only the commit with a signature' do it 'returns only the commit with a signature' do
signatures_request signatures_request
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
signatures = json_response['signatures'] signatures = json_response['signatures']
expect(signatures.size).to eq(1) expect(signatures.size).to eq(1)
...@@ -318,7 +318,7 @@ describe Projects::CompareController do ...@@ -318,7 +318,7 @@ describe Projects::CompareController do
it 'returns a 404' do it 'returns a 404' do
signatures_request signatures_request
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -330,7 +330,7 @@ describe Projects::CompareController do ...@@ -330,7 +330,7 @@ describe Projects::CompareController do
it 'returns no signatures' do it 'returns no signatures' do
signatures_request signatures_request
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['signatures']).to be_empty expect(json_response['signatures']).to be_empty
end end
end end
...@@ -342,7 +342,7 @@ describe Projects::CompareController do ...@@ -342,7 +342,7 @@ describe Projects::CompareController do
it 'returns no signatures' do it 'returns no signatures' do
signatures_request signatures_request
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['signatures']).to be_empty expect(json_response['signatures']).to be_empty
end end
end end
......
...@@ -122,7 +122,7 @@ describe Projects::DeployKeysController do ...@@ -122,7 +122,7 @@ describe Projects::DeployKeysController do
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project } put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
end.not_to change { DeployKeysProject.count } end.not_to change { DeployKeysProject.count }
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(new_user_session_path) expect(response).to redirect_to(new_user_session_path)
end end
end end
...@@ -137,7 +137,7 @@ describe Projects::DeployKeysController do ...@@ -137,7 +137,7 @@ describe Projects::DeployKeysController do
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project } put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
end.not_to change { DeployKeysProject.count } end.not_to change { DeployKeysProject.count }
expect(response).to have_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -152,14 +152,14 @@ describe Projects::DeployKeysController do ...@@ -152,14 +152,14 @@ describe Projects::DeployKeysController do
end.to change { DeployKeysProject.count }.by(1) end.to change { DeployKeysProject.count }.by(1)
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1) expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings')) expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
end end
it 'returns 404' do it 'returns 404' do
put :enable, params: { id: 0, namespace_id: project.namespace, project_id: project } put :enable, params: { id: 0, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -174,7 +174,7 @@ describe Projects::DeployKeysController do ...@@ -174,7 +174,7 @@ describe Projects::DeployKeysController do
end.to change { DeployKeysProject.count }.by(1) end.to change { DeployKeysProject.count }.by(1)
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1) expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings')) expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
end end
end end
...@@ -192,7 +192,7 @@ describe Projects::DeployKeysController do ...@@ -192,7 +192,7 @@ describe Projects::DeployKeysController do
it 'redirects to login' do it 'redirects to login' do
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project } put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(new_user_session_path) expect(response).to redirect_to(new_user_session_path)
expect(DeployKey.find(deploy_key.id)).to eq(deploy_key) expect(DeployKey.find(deploy_key.id)).to eq(deploy_key)
end end
...@@ -206,7 +206,7 @@ describe Projects::DeployKeysController do ...@@ -206,7 +206,7 @@ describe Projects::DeployKeysController do
it 'returns 404' do it 'returns 404' do
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project } put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(DeployKey.find(deploy_key.id)).to eq(deploy_key) expect(DeployKey.find(deploy_key.id)).to eq(deploy_key)
end end
end end
...@@ -215,7 +215,7 @@ describe Projects::DeployKeysController do ...@@ -215,7 +215,7 @@ describe Projects::DeployKeysController do
it 'returns 302' do it 'returns 302' do
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project } put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings')) expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
expect { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound) expect { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound)
...@@ -224,7 +224,7 @@ describe Projects::DeployKeysController do ...@@ -224,7 +224,7 @@ describe Projects::DeployKeysController do
it 'returns 404' do it 'returns 404' do
put :disable, params: { id: 0, namespace_id: project.namespace, project_id: project } put :disable, params: { id: 0, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -238,7 +238,7 @@ describe Projects::DeployKeysController do ...@@ -238,7 +238,7 @@ describe Projects::DeployKeysController do
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project } put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
end.to change { DeployKey.count }.by(-1) end.to change { DeployKey.count }.by(-1)
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings')) expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
expect { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound) expect { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound)
......
...@@ -61,7 +61,7 @@ describe Projects::DeploymentsController do ...@@ -61,7 +61,7 @@ describe Projects::DeploymentsController do
it 'returns a empty response 204 resposne' do it 'returns a empty response 204 resposne' do
get :metrics, params: deployment_params(id: deployment.to_param) get :metrics, params: deployment_params(id: deployment.to_param)
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
expect(response.body).to eq('') expect(response.body).to eq('')
end end
end end
...@@ -100,7 +100,7 @@ describe Projects::DeploymentsController do ...@@ -100,7 +100,7 @@ describe Projects::DeploymentsController do
get :metrics, params: deployment_params(id: failed_deployment.to_param) get :metrics, params: deployment_params(id: failed_deployment.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
...@@ -129,7 +129,7 @@ describe Projects::DeploymentsController do ...@@ -129,7 +129,7 @@ describe Projects::DeploymentsController do
it 'returns a empty response 204 response' do it 'returns a empty response 204 response' do
get :additional_metrics, params: deployment_params(id: deployment.to_param, format: :json) get :additional_metrics, params: deployment_params(id: deployment.to_param, format: :json)
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
expect(response.body).to eq('') expect(response.body).to eq('')
end end
end end
......
...@@ -27,7 +27,7 @@ describe Projects::DiscussionsController do ...@@ -27,7 +27,7 @@ describe Projects::DiscussionsController do
it 'returns 404' do it 'returns 404' do
get :show, params: request_params, session: { format: :json } get :show, params: request_params, session: { format: :json }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -39,7 +39,7 @@ describe Projects::DiscussionsController do ...@@ -39,7 +39,7 @@ describe Projects::DiscussionsController do
it 'returns status 200' do it 'returns status 200' do
get :show, params: request_params, session: { format: :json } get :show, params: request_params, session: { format: :json }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'returns status 404 if MR does not exists' do it 'returns status 404 if MR does not exists' do
...@@ -47,7 +47,7 @@ describe Projects::DiscussionsController do ...@@ -47,7 +47,7 @@ describe Projects::DiscussionsController do
get :show, params: request_params, session: { format: :json } get :show, params: request_params, session: { format: :json }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -60,7 +60,7 @@ describe Projects::DiscussionsController do ...@@ -60,7 +60,7 @@ describe Projects::DiscussionsController do
it 'returns status 200' do it 'returns status 200' do
get :show, params: request_params, session: { format: :json } get :show, params: request_params, session: { format: :json }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -74,7 +74,7 @@ describe Projects::DiscussionsController do ...@@ -74,7 +74,7 @@ describe Projects::DiscussionsController do
it "returns status 404" do it "returns status 404" do
post :resolve, params: request_params post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -91,7 +91,7 @@ describe Projects::DiscussionsController do ...@@ -91,7 +91,7 @@ describe Projects::DiscussionsController do
it "returns status 404" do it "returns status 404" do
post :resolve, params: request_params post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -120,7 +120,7 @@ describe Projects::DiscussionsController do ...@@ -120,7 +120,7 @@ describe Projects::DiscussionsController do
it "returns status 200" do it "returns status 200" do
post :resolve, params: request_params post :resolve, params: request_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it "renders discussion with serializer" do it "renders discussion with serializer" do
...@@ -157,7 +157,7 @@ describe Projects::DiscussionsController do ...@@ -157,7 +157,7 @@ describe Projects::DiscussionsController do
it "returns status 404" do it "returns status 404" do
delete :unresolve, params: request_params delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -174,7 +174,7 @@ describe Projects::DiscussionsController do ...@@ -174,7 +174,7 @@ describe Projects::DiscussionsController do
it "returns status 404" do it "returns status 404" do
delete :unresolve, params: request_params delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -188,7 +188,7 @@ describe Projects::DiscussionsController do ...@@ -188,7 +188,7 @@ describe Projects::DiscussionsController do
it "returns status 200" do it "returns status 200" do
delete :unresolve, params: request_params delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
context "when vue_mr_discussions cookie is present" do context "when vue_mr_discussions cookie is present" do
......
...@@ -179,7 +179,7 @@ describe Projects::EnvironmentsController do ...@@ -179,7 +179,7 @@ describe Projects::EnvironmentsController do
params[:id] = 12345 params[:id] = 12345
get :show, params: params get :show, params: params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -197,7 +197,7 @@ describe Projects::EnvironmentsController do ...@@ -197,7 +197,7 @@ describe Projects::EnvironmentsController do
patch_params = environment_params.merge(environment: { external_url: 'https://git.gitlab.com' }) patch_params = environment_params.merge(environment: { external_url: 'https://git.gitlab.com' })
patch :update, params: patch_params patch :update, params: patch_params
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -208,7 +208,7 @@ describe Projects::EnvironmentsController do ...@@ -208,7 +208,7 @@ describe Projects::EnvironmentsController do
patch :stop, params: environment_params(format: :json) patch :stop, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -221,7 +221,7 @@ describe Projects::EnvironmentsController do ...@@ -221,7 +221,7 @@ describe Projects::EnvironmentsController do
patch :stop, params: environment_params(format: :json) patch :stop, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq( expect(json_response).to eq(
{ 'redirect_url' => { 'redirect_url' =>
project_job_url(project, action) }) project_job_url(project, action) })
...@@ -235,7 +235,7 @@ describe Projects::EnvironmentsController do ...@@ -235,7 +235,7 @@ describe Projects::EnvironmentsController do
patch :stop, params: environment_params(format: :json) patch :stop, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq( expect(json_response).to eq(
{ 'redirect_url' => { 'redirect_url' =>
project_environment_url(project, environment) }) project_environment_url(project, environment) })
...@@ -278,7 +278,7 @@ describe Projects::EnvironmentsController do ...@@ -278,7 +278,7 @@ describe Projects::EnvironmentsController do
it 'responds with a status code 200' do it 'responds with a status code 200' do
get :terminal, params: environment_params get :terminal, params: environment_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'loads the terminals for the environment' do it 'loads the terminals for the environment' do
...@@ -295,7 +295,7 @@ describe Projects::EnvironmentsController do ...@@ -295,7 +295,7 @@ describe Projects::EnvironmentsController do
it 'responds with a status code 404' do it 'responds with a status code 404' do
get :terminal, params: environment_params(id: 666) get :terminal, params: environment_params(id: 666)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -321,7 +321,7 @@ describe Projects::EnvironmentsController do ...@@ -321,7 +321,7 @@ describe Projects::EnvironmentsController do
get :terminal_websocket_authorize, params: environment_params get :terminal_websocket_authorize, params: environment_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(response.body).to eq('{"workhorse":"response"}') expect(response.body).to eq('{"workhorse":"response"}')
end end
...@@ -331,7 +331,7 @@ describe Projects::EnvironmentsController do ...@@ -331,7 +331,7 @@ describe Projects::EnvironmentsController do
it 'returns 404' do it 'returns 404' do
get :terminal_websocket_authorize, params: environment_params(id: 666) get :terminal_websocket_authorize, params: environment_params(id: 666)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -386,7 +386,7 @@ describe Projects::EnvironmentsController do ...@@ -386,7 +386,7 @@ describe Projects::EnvironmentsController do
get :metrics, params: environment_params(format: :json) get :metrics, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
expect(json_response).to eq({}) expect(json_response).to eq({})
end end
end end
...@@ -428,7 +428,7 @@ describe Projects::EnvironmentsController do ...@@ -428,7 +428,7 @@ describe Projects::EnvironmentsController do
it 'returns a metrics JSON document' do it 'returns a metrics JSON document' do
additional_metrics(window_params) additional_metrics(window_params)
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
expect(json_response).to eq({}) expect(json_response).to eq({})
end end
end end
......
...@@ -23,7 +23,7 @@ describe Projects::ForksController do ...@@ -23,7 +23,7 @@ describe Projects::ForksController do
it 'returns with 404' do it 'returns with 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -167,7 +167,7 @@ describe Projects::ForksController do ...@@ -167,7 +167,7 @@ describe Projects::ForksController do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -205,7 +205,7 @@ describe Projects::ForksController do ...@@ -205,7 +205,7 @@ describe Projects::ForksController do
it 'responds with status 302' do it 'responds with status 302' do
subject subject
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_import_path(user.namespace, project)) expect(response).to redirect_to(namespace_project_import_path(user.namespace, project))
end end
...@@ -228,7 +228,7 @@ describe Projects::ForksController do ...@@ -228,7 +228,7 @@ describe Projects::ForksController do
it 'passes continue params to the redirect' do it 'passes continue params to the redirect' do
subject subject
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_import_path(user.namespace, project, continue: continue_params)) expect(response).to redirect_to(namespace_project_import_path(user.namespace, project, continue: continue_params))
end end
end end
......
...@@ -33,7 +33,7 @@ describe Projects::GroupLinksController do ...@@ -33,7 +33,7 @@ describe Projects::GroupLinksController do
include_context 'link project to group' include_context 'link project to group'
it 'responds with status 404' do it 'responds with status 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
......
...@@ -42,7 +42,7 @@ describe Projects::HooksController do ...@@ -42,7 +42,7 @@ describe Projects::HooksController do
post :create, params: { namespace_id: project.namespace, project_id: project, hook: hook_params } post :create, params: { namespace_id: project.namespace, project_id: project, hook: hook_params }
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(ProjectHook.all.size).to eq(1) expect(ProjectHook.all.size).to eq(1)
expect(ProjectHook.first).to have_attributes(hook_params) expect(ProjectHook.first).to have_attributes(hook_params)
end end
......
...@@ -24,7 +24,7 @@ describe Projects::IssuesController do ...@@ -24,7 +24,7 @@ describe Projects::IssuesController do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -32,7 +32,7 @@ describe Projects::IssuesController do ...@@ -32,7 +32,7 @@ describe Projects::IssuesController do
it 'renders the "index" template' do it 'renders the "index" template' do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, 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(:index) expect(response).to render_template(:index)
end end
end end
...@@ -51,14 +51,14 @@ describe Projects::IssuesController do ...@@ -51,14 +51,14 @@ describe Projects::IssuesController do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to redirect_to(project_issues_path(new_project)) expect(response).to redirect_to(project_issues_path(new_project))
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
it 'redirects from an old issue correctly' do it 'redirects from an old issue correctly' do
get :show, params: { namespace_id: project.namespace, project_id: project, id: issue } get :show, params: { namespace_id: project.namespace, project_id: project, id: issue }
expect(response).to redirect_to(project_issue_path(new_project, issue)) expect(response).to redirect_to(project_issue_path(new_project, issue))
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
...@@ -78,7 +78,7 @@ describe Projects::IssuesController do ...@@ -78,7 +78,7 @@ describe Projects::IssuesController do
it "returns index" do it "returns index" do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it "returns 301 if request path doesn't match project path" do it "returns 301 if request path doesn't match project path" do
...@@ -92,7 +92,7 @@ describe Projects::IssuesController do ...@@ -92,7 +92,7 @@ describe Projects::IssuesController do
project.save! project.save!
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -118,7 +118,7 @@ describe Projects::IssuesController do ...@@ -118,7 +118,7 @@ describe Projects::IssuesController do
get :index, params: params.merge(page: last_page + 1) get :index, params: params.merge(page: last_page + 1)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:issues).size).to eq(2) expect(assigns(:issues).size).to eq(2)
end end
end end
...@@ -227,7 +227,7 @@ describe Projects::IssuesController do ...@@ -227,7 +227,7 @@ describe Projects::IssuesController do
get :new, params: { namespace_id: project.namespace, project_id: project } get :new, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -235,7 +235,7 @@ describe Projects::IssuesController do ...@@ -235,7 +235,7 @@ describe Projects::IssuesController do
it 'renders the "new" template' do it 'renders the "new" template' do
get :new, params: { namespace_id: project.namespace, project_id: project } get :new, 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(:new) expect(response).to render_template(:new)
end end
end end
...@@ -330,7 +330,7 @@ describe Projects::IssuesController do ...@@ -330,7 +330,7 @@ describe Projects::IssuesController do
[issue1, issue2, issue3].map(&:reload) [issue1, issue2, issue3].map(&:reload)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(issue1.relative_position) expect(issue1.relative_position)
.to be_between(issue2.relative_position, issue3.relative_position) .to be_between(issue2.relative_position, issue3.relative_position)
end end
...@@ -340,7 +340,7 @@ describe Projects::IssuesController do ...@@ -340,7 +340,7 @@ describe Projects::IssuesController do
it 'returns a unprocessable entity 422 response for invalid move ids' do it 'returns a unprocessable entity 422 response for invalid move ids' do
reorder_issue(issue1, move_after_id: 99, move_before_id: 999) reorder_issue(issue1, move_after_id: 99, move_before_id: 999)
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
end end
it 'returns a not found 404 response for invalid issue id' do it 'returns a not found 404 response for invalid issue id' do
...@@ -348,7 +348,7 @@ describe Projects::IssuesController do ...@@ -348,7 +348,7 @@ describe Projects::IssuesController do
move_after_id: issue2.id, move_after_id: issue2.id,
move_before_id: issue3.id) move_before_id: issue3.id)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'returns a unprocessable entity 422 response for issues not in group' do it 'returns a unprocessable entity 422 response for issues not in group' do
...@@ -359,7 +359,7 @@ describe Projects::IssuesController do ...@@ -359,7 +359,7 @@ describe Projects::IssuesController do
move_before_id: issue3.id, move_before_id: issue3.id,
group_full_path: another_group.full_path) group_full_path: another_group.full_path)
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
end end
end end
end end
...@@ -415,7 +415,7 @@ describe Projects::IssuesController do ...@@ -415,7 +415,7 @@ describe Projects::IssuesController do
it 'updates the issue' do it 'updates the issue' do
subject subject
expect(response).to have_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(issue.reload.title).to eq('New title') expect(issue.reload.title).to eq('New title')
end end
...@@ -443,7 +443,7 @@ describe Projects::IssuesController do ...@@ -443,7 +443,7 @@ describe Projects::IssuesController do
it 'updates the issue' do it 'updates the issue' do
subject subject
expect(response).to have_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(issue.reload.title).to eq('New title') expect(issue.reload.title).to eq('New title')
end end
end end
...@@ -458,7 +458,7 @@ describe Projects::IssuesController do ...@@ -458,7 +458,7 @@ describe Projects::IssuesController do
it 'responds with 404' do it 'responds with 404' do
subject subject
expect(response).to have_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -505,7 +505,7 @@ describe Projects::IssuesController do ...@@ -505,7 +505,7 @@ describe Projects::IssuesController do
it 'returns 200' do it 'returns 200' do
go(id: issue.iid) go(id: issue.iid)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -749,7 +749,7 @@ describe Projects::IssuesController do ...@@ -749,7 +749,7 @@ describe Projects::IssuesController do
it 'returns 200 status' do it 'returns 200 status' do
update_issue update_issue
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -769,7 +769,7 @@ describe Projects::IssuesController do ...@@ -769,7 +769,7 @@ describe Projects::IssuesController do
it 'returns 200 status' do it 'returns 200 status' do
update_issue update_issue
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -785,7 +785,7 @@ describe Projects::IssuesController do ...@@ -785,7 +785,7 @@ describe Projects::IssuesController do
end end
it 'returns 200 status' do it 'returns 200 status' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'accepts an issue after recaptcha is verified' do it 'accepts an issue after recaptcha is verified' do
...@@ -1131,7 +1131,7 @@ describe Projects::IssuesController do ...@@ -1131,7 +1131,7 @@ describe Projects::IssuesController do
it "rejects a developer to destroy an issue" do it "rejects a developer to destroy an issue" do
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -1147,14 +1147,14 @@ describe Projects::IssuesController do ...@@ -1147,14 +1147,14 @@ describe Projects::IssuesController do
it "deletes the issue" do it "deletes the issue" do
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid, destroy_confirm: true } delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid, destroy_confirm: true }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./) expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./)
end end
it "deletes the issue" do it "deletes the issue" do
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid, destroy_confirm: true } delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid, destroy_confirm: true }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./) expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./)
end end
...@@ -1163,7 +1163,7 @@ describe Projects::IssuesController do ...@@ -1163,7 +1163,7 @@ describe Projects::IssuesController do
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(controller).to set_flash[:notice].to('Destroy confirmation not provided for issue') expect(controller).to set_flash[:notice].to('Destroy confirmation not provided for issue')
end end
...@@ -1172,7 +1172,7 @@ describe Projects::IssuesController do ...@@ -1172,7 +1172,7 @@ describe Projects::IssuesController do
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid, format: 'json' } delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid, format: 'json' }
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response).to eq({ 'errors' => 'Destroy confirmation not provided for issue' }) expect(json_response).to eq({ 'errors' => 'Destroy confirmation not provided for issue' })
end end
...@@ -1206,7 +1206,7 @@ describe Projects::IssuesController do ...@@ -1206,7 +1206,7 @@ describe Projects::IssuesController do
subject subject
end.to change { issue.award_emoji.count }.by(1) end.to change { issue.award_emoji.count }.by(1)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it "removes the already awarded emoji" do it "removes the already awarded emoji" do
...@@ -1214,7 +1214,7 @@ describe Projects::IssuesController do ...@@ -1214,7 +1214,7 @@ describe Projects::IssuesController do
expect { subject }.to change { AwardEmoji.count }.by(-1) expect { subject }.to change { AwardEmoji.count }.by(-1)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'marks Todos on the Issue as done' do it 'marks Todos on the Issue as done' do
...@@ -1250,7 +1250,7 @@ describe Projects::IssuesController do ...@@ -1250,7 +1250,7 @@ describe Projects::IssuesController do
create_merge_request create_merge_request
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'is not available for users who cannot create merge requests' do it 'is not available for users who cannot create merge requests' do
...@@ -1258,7 +1258,7 @@ describe Projects::IssuesController do ...@@ -1258,7 +1258,7 @@ describe Projects::IssuesController do
create_merge_request create_merge_request
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
context 'target_project_id is set' do context 'target_project_id is set' do
......
...@@ -1183,7 +1183,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -1183,7 +1183,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
get_terminal_websocket(id: job.id) get_terminal_websocket(id: job.id)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(response.body).to eq('{"workhorse":"response"}') expect(response.body).to eq('{"workhorse":"response"}')
end end
...@@ -1193,7 +1193,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -1193,7 +1193,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
it 'returns 404' do it 'returns 404' do
get_terminal_websocket(id: 1234) get_terminal_websocket(id: 1234)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -80,7 +80,7 @@ describe Projects::LabelsController do ...@@ -80,7 +80,7 @@ describe Projects::LabelsController do
it 'creates labels' do it 'creates labels' do
post :generate, params: { namespace_id: personal_project.namespace.to_param, project_id: personal_project } post :generate, params: { namespace_id: personal_project.namespace.to_param, project_id: personal_project }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -88,7 +88,7 @@ describe Projects::LabelsController do ...@@ -88,7 +88,7 @@ describe Projects::LabelsController do
it 'creates labels' do it 'creates labels' do
post :generate, params: { namespace_id: project.namespace.to_param, project_id: project } post :generate, params: { namespace_id: project.namespace.to_param, project_id: project }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
...@@ -99,7 +99,7 @@ describe Projects::LabelsController do ...@@ -99,7 +99,7 @@ describe Projects::LabelsController do
toggle_subscription(label) toggle_subscription(label)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'allows user to toggle subscription on group labels' do it 'allows user to toggle subscription on group labels' do
...@@ -107,7 +107,7 @@ describe Projects::LabelsController do ...@@ -107,7 +107,7 @@ describe Projects::LabelsController do
toggle_subscription(group_label) toggle_subscription(group_label)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
def toggle_subscription(label) def toggle_subscription(label)
...@@ -123,7 +123,7 @@ describe Projects::LabelsController do ...@@ -123,7 +123,7 @@ describe Projects::LabelsController do
it 'denies access' do it 'denies access' do
post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param } post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -180,7 +180,7 @@ describe Projects::LabelsController do ...@@ -180,7 +180,7 @@ describe Projects::LabelsController do
it 'does not redirect' do it 'does not redirect' do
get :index, params: { namespace_id: project.namespace, project_id: project.to_param } get :index, params: { namespace_id: project.namespace, project_id: project.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
...@@ -231,13 +231,13 @@ describe Projects::LabelsController do ...@@ -231,13 +231,13 @@ describe Projects::LabelsController do
it 'does not 404' do it 'does not 404' do
post :generate, params: { namespace_id: project.namespace, project_id: project } post :generate, params: { namespace_id: project.namespace, project_id: project }
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 :generate, params: { namespace_id: project.namespace, project_id: project } post :generate, params: { namespace_id: project.namespace, project_id: project }
expect(response).not_to have_gitlab_http_status(301) expect(response).not_to have_gitlab_http_status(:moved_permanently)
end end
end end
...@@ -247,7 +247,7 @@ describe Projects::LabelsController do ...@@ -247,7 +247,7 @@ describe Projects::LabelsController do
it 'returns not found' do it 'returns not found' do
post :generate, params: { namespace_id: project.namespace, project_id: project.to_param + 'old' } post :generate, params: { namespace_id: project.namespace, project_id: project.to_param + 'old' }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -25,7 +25,7 @@ describe Projects::MattermostsController do ...@@ -25,7 +25,7 @@ describe Projects::MattermostsController do
project_id: project project_id: project
}) })
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 Projects::MergeRequestsController do ...@@ -113,7 +113,7 @@ describe Projects::MergeRequestsController do
} }
expect(response).to redirect_to(project_merge_request_path(new_project, merge_request)) expect(response).to redirect_to(project_merge_request_path(new_project, merge_request))
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
it 'redirects from an old merge request commits correctly' do it 'redirects from an old merge request commits correctly' do
...@@ -125,7 +125,7 @@ describe Projects::MergeRequestsController do ...@@ -125,7 +125,7 @@ describe Projects::MergeRequestsController do
} }
expect(response).to redirect_to(commits_project_merge_request_path(new_project, merge_request)) expect(response).to redirect_to(commits_project_merge_request_path(new_project, merge_request))
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
...@@ -229,7 +229,7 @@ describe Projects::MergeRequestsController do ...@@ -229,7 +229,7 @@ describe Projects::MergeRequestsController do
get_merge_requests(last_page) get_merge_requests(last_page)
expect(assigns(:merge_requests).current_page).to eq(last_page) expect(assigns(:merge_requests).current_page).to eq(last_page)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'does not redirect to external sites when provided a host field' do it 'does not redirect to external sites when provided a host field' do
...@@ -306,7 +306,7 @@ describe Projects::MergeRequestsController do ...@@ -306,7 +306,7 @@ describe Projects::MergeRequestsController do
it 'responds with 404' do it 'responds with 404' do
update_merge_request(title: 'New title') update_merge_request(title: 'New title')
expect(response).to have_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -381,7 +381,7 @@ describe Projects::MergeRequestsController do ...@@ -381,7 +381,7 @@ describe Projects::MergeRequestsController do
end end
it 'returns 404' do it 'returns 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -615,7 +615,7 @@ describe Projects::MergeRequestsController do ...@@ -615,7 +615,7 @@ describe Projects::MergeRequestsController do
it "denies access to users unless they're admin or project owner" do it "denies access to users unless they're admin or project owner" do
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid } delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
context "when the user is owner" do context "when the user is owner" do
...@@ -630,7 +630,7 @@ describe Projects::MergeRequestsController do ...@@ -630,7 +630,7 @@ describe Projects::MergeRequestsController do
it "deletes the merge request" do it "deletes the merge request" do
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid, destroy_confirm: true } delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid, destroy_confirm: true }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(controller).to set_flash[:notice].to(/The merge request was successfully deleted\./) expect(controller).to set_flash[:notice].to(/The merge request was successfully deleted\./)
end end
...@@ -639,7 +639,7 @@ describe Projects::MergeRequestsController do ...@@ -639,7 +639,7 @@ describe Projects::MergeRequestsController do
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid } delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(controller).to set_flash[:notice].to('Destroy confirmation not provided for merge request') expect(controller).to set_flash[:notice].to('Destroy confirmation not provided for merge request')
end end
...@@ -648,7 +648,7 @@ describe Projects::MergeRequestsController do ...@@ -648,7 +648,7 @@ describe Projects::MergeRequestsController do
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid, format: 'json' } delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid, format: 'json' }
expect(response).to have_gitlab_http_status(422) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response).to eq({ 'errors' => 'Destroy confirmation not provided for merge request' }) expect(json_response).to eq({ 'errors' => 'Destroy confirmation not provided for merge request' })
end end
...@@ -842,7 +842,7 @@ describe Projects::MergeRequestsController do ...@@ -842,7 +842,7 @@ describe Projects::MergeRequestsController do
it 'responds with a 404' do it 'responds with a 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to be_blank expect(response.body).to be_blank
end end
end end
...@@ -855,7 +855,7 @@ describe Projects::MergeRequestsController do ...@@ -855,7 +855,7 @@ describe Projects::MergeRequestsController do
it 'responds with a 404' do it 'responds with a 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to be_blank expect(response.body).to be_blank
end end
end end
...@@ -898,7 +898,7 @@ describe Projects::MergeRequestsController do ...@@ -898,7 +898,7 @@ describe Projects::MergeRequestsController do
it 'returns exposed artifacts' do it 'returns exposed artifacts' do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['status']).to eq('parsed') expect(json_response['status']).to eq('parsed')
expect(json_response['data']).to eq([{ expect(json_response['data']).to eq([{
'job_name' => 'test', 'job_name' => 'test',
...@@ -951,7 +951,7 @@ describe Projects::MergeRequestsController do ...@@ -951,7 +951,7 @@ describe Projects::MergeRequestsController do
it 'returns no content' do it 'returns no content' do
subject subject
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
expect(response.body).to be_empty expect(response.body).to be_empty
end end
end end
...@@ -998,7 +998,7 @@ describe Projects::MergeRequestsController do ...@@ -998,7 +998,7 @@ describe Projects::MergeRequestsController do
it 'responds with a 404' do it 'responds with a 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to be_blank expect(response.body).to be_blank
end end
end end
...@@ -1011,7 +1011,7 @@ describe Projects::MergeRequestsController do ...@@ -1011,7 +1011,7 @@ describe Projects::MergeRequestsController do
it 'responds with a 404' do it 'responds with a 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to be_blank expect(response.body).to be_blank
end end
end end
......
...@@ -30,14 +30,14 @@ describe Projects::MilestonesController do ...@@ -30,14 +30,14 @@ describe Projects::MilestonesController do
it 'shows milestone page' do it 'shows milestone page' do
view_milestone view_milestone
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'text/html' expect(response.content_type).to eq 'text/html'
end end
it 'returns milestone json' do it 'returns milestone json' do
view_milestone format: :json view_milestone format: :json
expect(response).to have_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
end end
end end
...@@ -171,7 +171,7 @@ describe Projects::MilestonesController do ...@@ -171,7 +171,7 @@ describe Projects::MilestonesController do
it 'renders 404' do it 'renders 404' do
post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid } post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -190,7 +190,7 @@ describe Projects::MilestonesController do ...@@ -190,7 +190,7 @@ describe Projects::MilestonesController do
get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
expect(json_response['html']).not_to include(label.title) expect(json_response['html']).not_to include(label.title)
...@@ -201,7 +201,7 @@ describe Projects::MilestonesController do ...@@ -201,7 +201,7 @@ describe Projects::MilestonesController do
get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
expect(json_response['html']).to include(label.title) expect(json_response['html']).to include(label.title)
...@@ -240,7 +240,7 @@ describe Projects::MilestonesController do ...@@ -240,7 +240,7 @@ describe Projects::MilestonesController do
post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid } post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -263,7 +263,7 @@ describe Projects::MilestonesController do ...@@ -263,7 +263,7 @@ describe Projects::MilestonesController do
params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :json } params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :json }
get :participants, params: params get :participants, params: params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
expect(json_response['html']).to include(issue_assignee.name) expect(json_response['html']).to include(issue_assignee.name)
end end
...@@ -278,7 +278,7 @@ describe Projects::MilestonesController do ...@@ -278,7 +278,7 @@ describe Projects::MilestonesController do
params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :json } params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :json }
get :participants, params: params get :participants, params: params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
expect(json_response['html']).not_to include(issue_assignee.name) expect(json_response['html']).not_to include(issue_assignee.name)
end end
......
...@@ -103,7 +103,7 @@ describe Projects::MirrorsController do ...@@ -103,7 +103,7 @@ describe Projects::MirrorsController do
it "returns an error with a 400 response for URL #{url.inspect}" do it "returns an error with a 400 response for URL #{url.inspect}" do
do_get(project, url) do_get(project, url)
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response).to eq('message' => 'Invalid URL') expect(json_response).to eq('message' => 'Invalid URL')
end end
end end
...@@ -115,7 +115,7 @@ describe Projects::MirrorsController do ...@@ -115,7 +115,7 @@ describe Projects::MirrorsController do
do_get(project) do_get(project)
expect(response).to have_gitlab_http_status(204) expect(response).to have_gitlab_http_status(:no_content)
end end
end end
...@@ -125,7 +125,7 @@ describe Projects::MirrorsController do ...@@ -125,7 +125,7 @@ describe Projects::MirrorsController do
do_get(project) do_get(project)
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response).to eq('message' => 'An error') expect(json_response).to eq('message' => 'An error')
end end
end end
...@@ -139,7 +139,7 @@ describe Projects::MirrorsController do ...@@ -139,7 +139,7 @@ describe Projects::MirrorsController do
do_get(project) do_get(project)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq('known_hosts' => ssh_key, 'fingerprints' => [ssh_fp.stringify_keys], 'host_keys_changed' => true) expect(json_response).to eq('known_hosts' => ssh_key, 'fingerprints' => [ssh_fp.stringify_keys], 'host_keys_changed' => true)
end end
end end
......
...@@ -23,7 +23,7 @@ describe Projects::PagesController do ...@@ -23,7 +23,7 @@ describe Projects::PagesController do
it 'returns 200 status' do it 'returns 200 status' do
get :show, params: request_params get :show, params: request_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
context 'when the project is in a subgroup' do context 'when the project is in a subgroup' do
...@@ -33,7 +33,7 @@ describe Projects::PagesController do ...@@ -33,7 +33,7 @@ describe Projects::PagesController do
it 'returns a 200 status code' do it 'returns a 200 status code' do
get :show, params: request_params get :show, params: request_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -42,7 +42,7 @@ describe Projects::PagesController do ...@@ -42,7 +42,7 @@ describe Projects::PagesController do
it 'returns 302 status' do it 'returns 302 status' do
delete :destroy, params: request_params delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
context 'when user is developer' do context 'when user is developer' do
...@@ -53,7 +53,7 @@ describe Projects::PagesController do ...@@ -53,7 +53,7 @@ describe Projects::PagesController do
it 'returns 404 status' do it 'returns 404 status' do
delete :destroy, params: request_params delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -67,7 +67,7 @@ describe Projects::PagesController do ...@@ -67,7 +67,7 @@ describe Projects::PagesController do
it 'returns 404 status' do it 'returns 404 status' do
get :show, params: request_params get :show, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -75,7 +75,7 @@ describe Projects::PagesController do ...@@ -75,7 +75,7 @@ describe Projects::PagesController do
it 'returns 404 status' do it 'returns 404 status' do
delete :destroy, params: request_params delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -35,7 +35,7 @@ describe Projects::PagesDomainsController do ...@@ -35,7 +35,7 @@ describe Projects::PagesDomainsController do
it "displays to the 'show' page" do it "displays to the 'show' page" do
make_request make_request
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
...@@ -47,7 +47,7 @@ describe Projects::PagesDomainsController do ...@@ -47,7 +47,7 @@ describe Projects::PagesDomainsController do
it 'renders 404 page' do it 'renders 404 page' do
make_request make_request
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -56,7 +56,7 @@ describe Projects::PagesDomainsController do ...@@ -56,7 +56,7 @@ describe Projects::PagesDomainsController do
it "displays the 'new' page" do it "displays the 'new' page" do
get(:new, params: request_params) get(:new, params: request_params)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('new') expect(response).to render_template('new')
end end
end end
...@@ -78,7 +78,7 @@ describe Projects::PagesDomainsController do ...@@ -78,7 +78,7 @@ describe Projects::PagesDomainsController do
it "displays the 'show' page" do it "displays the 'show' page" do
get(:show, params: request_params.merge(id: pages_domain.domain)) get(:show, params: request_params.merge(id: pages_domain.domain))
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
...@@ -177,7 +177,7 @@ describe Projects::PagesDomainsController do ...@@ -177,7 +177,7 @@ describe Projects::PagesDomainsController do
it 'returns a 404 response for an unknown domain' do it 'returns a 404 response for an unknown domain' do
post :verify, params: request_params.merge(id: 'unknown-domain') post :verify, params: request_params.merge(id: 'unknown-domain')
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -250,7 +250,7 @@ describe Projects::PagesDomainsController do ...@@ -250,7 +250,7 @@ describe Projects::PagesDomainsController do
it 'returns 404 status' do it 'returns 404 status' do
get(:show, params: request_params.merge(id: pages_domain.domain)) get(:show, params: request_params.merge(id: pages_domain.domain))
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -258,7 +258,7 @@ describe Projects::PagesDomainsController do ...@@ -258,7 +258,7 @@ describe Projects::PagesDomainsController do
it 'returns 404 status' do it 'returns 404 status' do
get :new, params: request_params get :new, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -266,7 +266,7 @@ describe Projects::PagesDomainsController do ...@@ -266,7 +266,7 @@ describe Projects::PagesDomainsController do
it "returns 404 status" do it "returns 404 status" do
post(:create, params: request_params.merge(pages_domain: pages_domain_params)) post(:create, params: request_params.merge(pages_domain: pages_domain_params))
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -274,7 +274,7 @@ describe Projects::PagesDomainsController do ...@@ -274,7 +274,7 @@ describe Projects::PagesDomainsController do
it "deletes the pages domain" do it "deletes the pages domain" do
delete(:destroy, params: request_params.merge(id: pages_domain.domain)) delete(:destroy, params: request_params.merge(id: pages_domain.domain))
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -396,7 +396,7 @@ describe Projects::PipelineSchedulesController do ...@@ -396,7 +396,7 @@ describe Projects::PipelineSchedulesController do
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id } post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -407,7 +407,7 @@ describe Projects::PipelineSchedulesController do ...@@ -407,7 +407,7 @@ describe Projects::PipelineSchedulesController do
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id } post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
expect(flash[:notice]).to start_with 'Successfully scheduled a pipeline to run' expect(flash[:notice]).to start_with 'Successfully scheduled a pipeline to run'
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
it 'prevents users from scheduling the same pipeline repeatedly' do it 'prevents users from scheduling the same pipeline repeatedly' do
...@@ -417,7 +417,7 @@ describe Projects::PipelineSchedulesController do ...@@ -417,7 +417,7 @@ describe Projects::PipelineSchedulesController do
expect(flash.to_a.size).to eq(2) expect(flash.to_a.size).to eq(2)
expect(flash[:alert]).to eq _('You cannot play this scheduled pipeline at the moment. Please wait a minute.') expect(flash[:alert]).to eq _('You cannot play this scheduled pipeline at the moment. Please wait a minute.')
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -430,7 +430,7 @@ describe Projects::PipelineSchedulesController do ...@@ -430,7 +430,7 @@ describe Projects::PipelineSchedulesController do
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: protected_schedule.id } post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: protected_schedule.id }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -460,7 +460,7 @@ describe Projects::PipelineSchedulesController do ...@@ -460,7 +460,7 @@ describe Projects::PipelineSchedulesController do
delete :destroy, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id } delete :destroy, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
end.to change { project.pipeline_schedules.count }.by(-1) end.to change { project.pipeline_schedules.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
......
...@@ -703,7 +703,7 @@ describe Projects::PipelinesController do ...@@ -703,7 +703,7 @@ describe Projects::PipelinesController do
it 'shows latest pipeline for the default project branch' do it 'shows latest pipeline for the default project branch' do
get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: nil } get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: nil }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:pipeline)).to have_attributes(id: pipeline_master.id) expect(assigns(:pipeline)).to have_attributes(id: pipeline_master.id)
end end
end end
...@@ -716,7 +716,7 @@ describe Projects::PipelinesController do ...@@ -716,7 +716,7 @@ describe Projects::PipelinesController do
it 'shows the latest pipeline for the provided ref' do it 'shows the latest pipeline for the provided ref' do
get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: branch_secondary.name } get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: branch_secondary.name }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:pipeline)).to have_attributes(id: pipeline_secondary.id) expect(assigns(:pipeline)).to have_attributes(id: pipeline_secondary.id)
end end
...@@ -728,7 +728,7 @@ describe Projects::PipelinesController do ...@@ -728,7 +728,7 @@ describe Projects::PipelinesController do
it 'shows the provided ref with the last sha/pipeline combo' do it 'shows the provided ref with the last sha/pipeline combo' do
get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: branch_secondary.name } get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: branch_secondary.name }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:pipeline)).to have_attributes(id: pipeline_secondary.id) expect(assigns(:pipeline)).to have_attributes(id: pipeline_secondary.id)
end end
end end
...@@ -737,7 +737,7 @@ describe Projects::PipelinesController do ...@@ -737,7 +737,7 @@ describe Projects::PipelinesController do
it 'renders a 404 if no pipeline is found for the ref' do it 'renders a 404 if no pipeline is found for the ref' do
get :show, params: { namespace_id: project.namespace, project_id: project, ref: 'no-branch' } get :show, params: { namespace_id: project.namespace, project_id: project, ref: 'no-branch' }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -754,7 +754,7 @@ describe Projects::PipelinesController do ...@@ -754,7 +754,7 @@ describe Projects::PipelinesController do
it 'deletes pipeline and redirects' do it 'deletes pipeline and redirects' do
delete_pipeline delete_pipeline
expect(response).to have_gitlab_http_status(303) expect(response).to have_gitlab_http_status(:see_other)
expect(Ci::Build.exists?(build.id)).to be_falsy expect(Ci::Build.exists?(build.id)).to be_falsy
expect(Ci::Pipeline.exists?(pipeline.id)).to be_falsy expect(Ci::Pipeline.exists?(pipeline.id)).to be_falsy
...@@ -766,7 +766,7 @@ describe Projects::PipelinesController do ...@@ -766,7 +766,7 @@ describe Projects::PipelinesController do
it 'fails to delete pipeline' do it 'fails to delete pipeline' do
delete_pipeline delete_pipeline
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -775,7 +775,7 @@ describe Projects::PipelinesController do ...@@ -775,7 +775,7 @@ describe Projects::PipelinesController do
it 'fails to delete pipeline' do it 'fails to delete pipeline' do
delete_pipeline delete_pipeline
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
......
...@@ -17,7 +17,7 @@ describe Projects::PipelinesSettingsController do ...@@ -17,7 +17,7 @@ describe Projects::PipelinesSettingsController do
it 'redirects with 302 status code' do it 'redirects with 302 status code' do
get :show, params: { namespace_id: project.namespace, project_id: project } get :show, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
...@@ -11,7 +11,7 @@ describe Projects::ProjectMembersController do ...@@ -11,7 +11,7 @@ describe Projects::ProjectMembersController do
it 'has the project_members address with a 200 status code' do it 'has the project_members address with a 200 status code' do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
context 'when project belongs to group' do context 'when project belongs to group' do
...@@ -64,7 +64,7 @@ describe Projects::ProjectMembersController do ...@@ -64,7 +64,7 @@ describe Projects::ProjectMembersController do
access_level: Gitlab::Access::GUEST access_level: Gitlab::Access::GUEST
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(project.users).not_to include project_user expect(project.users).not_to include project_user
end end
end end
...@@ -145,7 +145,7 @@ describe Projects::ProjectMembersController do ...@@ -145,7 +145,7 @@ describe Projects::ProjectMembersController do
id: 42 id: 42
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -162,7 +162,7 @@ describe Projects::ProjectMembersController do ...@@ -162,7 +162,7 @@ describe Projects::ProjectMembersController do
id: member id: member
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(project.members).to include member expect(project.members).to include member
end end
end end
...@@ -211,7 +211,7 @@ describe Projects::ProjectMembersController do ...@@ -211,7 +211,7 @@ describe Projects::ProjectMembersController do
project_id: project project_id: project
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -246,7 +246,7 @@ describe Projects::ProjectMembersController do ...@@ -246,7 +246,7 @@ describe Projects::ProjectMembersController do
project_id: project project_id: project
} }
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -305,7 +305,7 @@ describe Projects::ProjectMembersController do ...@@ -305,7 +305,7 @@ describe Projects::ProjectMembersController do
id: 42 id: 42
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -322,7 +322,7 @@ describe Projects::ProjectMembersController do ...@@ -322,7 +322,7 @@ describe Projects::ProjectMembersController do
id: member id: member
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(project.members).not_to include member expect(project.members).not_to include member
end end
end end
......
...@@ -23,7 +23,7 @@ describe Projects::RawController do ...@@ -23,7 +23,7 @@ describe Projects::RawController do
it 'delivers ASCII file' do it 'delivers ASCII file' do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.header['Content-Type']).to eq('text/plain; charset=utf-8') expect(response.header['Content-Type']).to eq('text/plain; charset=utf-8')
expect(response.header['Content-Disposition']).to eq('inline') expect(response.header['Content-Disposition']).to eq('inline')
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true" expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
...@@ -37,7 +37,7 @@ describe Projects::RawController do ...@@ -37,7 +37,7 @@ describe Projects::RawController do
it 'leaves image content disposition' do it 'leaves image content disposition' do
subject subject
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.header['Content-Disposition']).to eq('inline') expect(response.header['Content-Disposition']).to eq('inline')
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true" expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:') expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:')
...@@ -63,7 +63,7 @@ describe Projects::RawController do ...@@ -63,7 +63,7 @@ describe Projects::RawController do
.to change { Gitlab::GitalyClient.get_request_count }.by(0) .to change { Gitlab::GitalyClient.get_request_count }.by(0)
expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.')) expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.'))
expect(response).to have_gitlab_http_status(429) expect(response).to have_gitlab_http_status(:too_many_requests)
end end
it 'logs the event on auth.log' do it 'logs the event on auth.log' do
...@@ -94,7 +94,7 @@ describe Projects::RawController do ...@@ -94,7 +94,7 @@ describe Projects::RawController do
request.headers['X-Gitlab-External-Storage-Token'] = token request.headers['X-Gitlab-External-Storage-Token'] = token
execute_raw_requests(requests: 6, project: project, file_path: file_path) execute_raw_requests(requests: 6, project: project, file_path: file_path)
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 Projects::RawController do ...@@ -113,7 +113,7 @@ describe Projects::RawController do
execute_raw_requests(requests: 3, project: project, file_path: modified_path) execute_raw_requests(requests: 3, project: project, file_path: modified_path)
expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.')) expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.'))
expect(response).to have_gitlab_http_status(429) expect(response).to have_gitlab_http_status(:too_many_requests)
end end
end end
...@@ -125,7 +125,7 @@ describe Projects::RawController do ...@@ -125,7 +125,7 @@ describe Projects::RawController do
it 'does not prevent from accessing the raw file' do it 'does not prevent from accessing the raw file' do
execute_raw_requests(requests: 10, project: project, file_path: file_path) execute_raw_requests(requests: 10, project: project, file_path: file_path)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -141,14 +141,14 @@ describe Projects::RawController do ...@@ -141,14 +141,14 @@ describe Projects::RawController do
execute_raw_requests(requests: 6, project: project, file_path: file_path) execute_raw_requests(requests: 6, project: project, file_path: file_path)
expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.')) expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.'))
expect(response).to have_gitlab_http_status(429) expect(response).to have_gitlab_http_status(:too_many_requests)
# Accessing upcase version of readme # Accessing upcase version of readme
file_path = "#{commit_sha}/README.md" file_path = "#{commit_sha}/README.md"
execute_raw_requests(requests: 1, project: project, file_path: file_path) execute_raw_requests(requests: 1, project: project, file_path: file_path)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -166,7 +166,7 @@ describe Projects::RawController do ...@@ -166,7 +166,7 @@ describe Projects::RawController do
it 'redirects to sign in page' do it 'redirects to sign in page' do
execute_raw_requests(requests: 1, project: project, file_path: file_path) execute_raw_requests(requests: 1, project: project, file_path: file_path)
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response.location).to end_with('/users/sign_in') expect(response.location).to end_with('/users/sign_in')
end end
end end
...@@ -176,7 +176,7 @@ describe Projects::RawController do ...@@ -176,7 +176,7 @@ describe Projects::RawController do
it 'calls the action normally' do it 'calls the action normally' do
execute_raw_requests(requests: 1, project: project, file_path: file_path, token: user.static_object_token) execute_raw_requests(requests: 1, project: project, file_path: file_path, token: user.static_object_token)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -184,7 +184,7 @@ describe Projects::RawController do ...@@ -184,7 +184,7 @@ describe Projects::RawController do
it 'redirects to sign in page' do it 'redirects to sign in page' do
execute_raw_requests(requests: 1, project: project, file_path: file_path, token: 'foobar') execute_raw_requests(requests: 1, project: project, file_path: file_path, token: 'foobar')
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response.location).to end_with('/users/sign_in') expect(response.location).to end_with('/users/sign_in')
end end
end end
...@@ -196,7 +196,7 @@ describe Projects::RawController do ...@@ -196,7 +196,7 @@ describe Projects::RawController do
request.headers['X-Gitlab-Static-Object-Token'] = user.static_object_token request.headers['X-Gitlab-Static-Object-Token'] = user.static_object_token
execute_raw_requests(requests: 1, project: project, file_path: file_path) execute_raw_requests(requests: 1, project: project, file_path: file_path)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -205,7 +205,7 @@ describe Projects::RawController do ...@@ -205,7 +205,7 @@ describe Projects::RawController do
request.headers['X-Gitlab-Static-Object-Token'] = 'foobar' request.headers['X-Gitlab-Static-Object-Token'] = 'foobar'
execute_raw_requests(requests: 1, project: project, file_path: file_path) execute_raw_requests(requests: 1, project: project, file_path: file_path)
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(response.location).to end_with('/users/sign_in') expect(response.location).to end_with('/users/sign_in')
end end
end end
......
...@@ -45,7 +45,7 @@ describe Projects::RepositoriesController do ...@@ -45,7 +45,7 @@ describe Projects::RepositoriesController do
it 'handles legacy queries with the ref specified as ref in params' do it 'handles legacy queries with the ref specified as ref in params' do
get :archive, params: { namespace_id: project.namespace, project_id: project, ref: 'feature' }, format: 'zip' get :archive, params: { namespace_id: project.namespace, project_id: project, ref: 'feature' }, format: 'zip'
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:ref)).to eq('feature') expect(assigns(:ref)).to eq('feature')
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:") expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end end
...@@ -53,7 +53,7 @@ describe Projects::RepositoriesController do ...@@ -53,7 +53,7 @@ describe Projects::RepositoriesController do
it 'handles legacy queries with the ref specified as id in params' do it 'handles legacy queries with the ref specified as id in params' do
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'feature' }, format: 'zip' get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'feature' }, format: 'zip'
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:ref)).to eq('feature') expect(assigns(:ref)).to eq('feature')
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:") expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end end
...@@ -61,7 +61,7 @@ describe Projects::RepositoriesController do ...@@ -61,7 +61,7 @@ describe Projects::RepositoriesController do
it 'prioritizes the id param over the ref param when both are specified' do it 'prioritizes the id param over the ref param when both are specified' do
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'feature', ref: 'feature_conflict' }, format: 'zip' get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'feature', ref: 'feature_conflict' }, format: 'zip'
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:ref)).to eq('feature') expect(assigns(:ref)).to eq('feature')
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:") expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end end
...@@ -74,7 +74,7 @@ describe Projects::RepositoriesController do ...@@ -74,7 +74,7 @@ describe Projects::RepositoriesController do
it "renders Not Found" do it "renders Not Found" do
get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master" }, format: "zip" get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master" }, format: "zip"
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -82,7 +82,7 @@ describe Projects::RepositoriesController do ...@@ -82,7 +82,7 @@ describe Projects::RepositoriesController do
it 'sets appropriate caching headers' do it 'sets appropriate caching headers' do
get_archive get_archive
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.header['ETag']).to be_present expect(response.header['ETag']).to be_present
expect(response.header['Cache-Control']).to include('max-age=60, private') expect(response.header['Cache-Control']).to include('max-age=60, private')
end end
...@@ -93,7 +93,7 @@ describe Projects::RepositoriesController do ...@@ -93,7 +93,7 @@ describe Projects::RepositoriesController do
it 'sets appropriate caching headers' do it 'sets appropriate caching headers' do
get_archive get_archive
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.header['ETag']).to be_present expect(response.header['ETag']).to be_present
expect(response.header['Cache-Control']).to include('max-age=60, public') expect(response.header['Cache-Control']).to include('max-age=60, public')
end end
...@@ -103,7 +103,7 @@ describe Projects::RepositoriesController do ...@@ -103,7 +103,7 @@ describe Projects::RepositoriesController do
it 'max-age is set to 3600 in Cache-Control header' do it 'max-age is set to 3600 in Cache-Control header' do
get_archive('ddd0f15ae83993f5cb66a927a28673882e99100b') get_archive('ddd0f15ae83993f5cb66a927a28673882e99100b')
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.header['Cache-Control']).to include('max-age=3600') expect(response.header['Cache-Control']).to include('max-age=3600')
end end
end end
...@@ -116,7 +116,7 @@ describe Projects::RepositoriesController do ...@@ -116,7 +116,7 @@ describe Projects::RepositoriesController do
request.headers['If-None-Match'] = response.headers['ETag'] request.headers['If-None-Match'] = response.headers['ETag']
get_archive get_archive
expect(response).to have_gitlab_http_status(304) expect(response).to have_gitlab_http_status(:not_modified)
end end
end end
...@@ -137,7 +137,7 @@ describe Projects::RepositoriesController do ...@@ -137,7 +137,7 @@ describe Projects::RepositoriesController do
it 'redirects to sign in page' do it 'redirects to sign in page' do
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: 'zip' get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: 'zip'
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -146,7 +146,7 @@ describe Projects::RepositoriesController do ...@@ -146,7 +146,7 @@ describe Projects::RepositoriesController do
it 'calls the action normally' do it 'calls the action normally' do
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master', token: user.static_object_token }, format: 'zip' get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master', token: user.static_object_token }, format: 'zip'
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -154,7 +154,7 @@ describe Projects::RepositoriesController do ...@@ -154,7 +154,7 @@ describe Projects::RepositoriesController do
it 'redirects to sign in page' do it 'redirects to sign in page' do
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master', token: 'foobar' }, format: 'zip' get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master', token: 'foobar' }, format: 'zip'
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
...@@ -165,7 +165,7 @@ describe Projects::RepositoriesController do ...@@ -165,7 +165,7 @@ describe Projects::RepositoriesController do
request.headers['X-Gitlab-Static-Object-Token'] = user.static_object_token request.headers['X-Gitlab-Static-Object-Token'] = user.static_object_token
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: 'zip' get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: 'zip'
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -174,7 +174,7 @@ describe Projects::RepositoriesController do ...@@ -174,7 +174,7 @@ describe Projects::RepositoriesController do
request.headers['X-Gitlab-Static-Object-Token'] = 'foobar' request.headers['X-Gitlab-Static-Object-Token'] = 'foobar'
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: 'zip' get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: 'zip'
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
......
...@@ -30,7 +30,7 @@ describe Projects::RunnersController do ...@@ -30,7 +30,7 @@ describe Projects::RunnersController do
runner.reload runner.reload
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(runner.description).to eq(new_desc) expect(runner.description).to eq(new_desc)
end end
end end
...@@ -39,7 +39,7 @@ describe Projects::RunnersController do ...@@ -39,7 +39,7 @@ describe Projects::RunnersController do
it 'destroys the runner' do it 'destroys the runner' do
delete :destroy, params: params delete :destroy, params: params
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(Ci::Runner.find_by(id: runner.id)).to be_nil expect(Ci::Runner.find_by(id: runner.id)).to be_nil
end end
end end
...@@ -54,7 +54,7 @@ describe Projects::RunnersController do ...@@ -54,7 +54,7 @@ describe Projects::RunnersController do
runner.reload runner.reload
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(runner.active).to eq(true) expect(runner.active).to eq(true)
end end
end end
...@@ -69,7 +69,7 @@ describe Projects::RunnersController do ...@@ -69,7 +69,7 @@ describe Projects::RunnersController do
runner.reload runner.reload
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(runner.active).to eq(false) expect(runner.active).to eq(false)
end end
end end
......
...@@ -35,7 +35,7 @@ describe Projects::SnippetsController do ...@@ -35,7 +35,7 @@ describe Projects::SnippetsController do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(assigns(:snippets)).not_to include(project_snippet) expect(assigns(:snippets)).not_to include(project_snippet)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -48,7 +48,7 @@ describe Projects::SnippetsController do ...@@ -48,7 +48,7 @@ describe Projects::SnippetsController do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(assigns(:snippets)).to include(project_snippet) expect(assigns(:snippets)).to include(project_snippet)
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 Projects::SnippetsController do ...@@ -61,7 +61,7 @@ describe Projects::SnippetsController do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(assigns(:snippets)).to include(project_snippet) expect(assigns(:snippets)).to include(project_snippet)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -318,7 +318,7 @@ describe Projects::SnippetsController do ...@@ -318,7 +318,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param } get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -331,7 +331,7 @@ describe Projects::SnippetsController do ...@@ -331,7 +331,7 @@ describe Projects::SnippetsController do
get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param } get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
expect(assigns(:snippet)).to eq(project_snippet) expect(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -344,7 +344,7 @@ describe Projects::SnippetsController do ...@@ -344,7 +344,7 @@ describe Projects::SnippetsController do
get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param } get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
expect(assigns(:snippet)).to eq(project_snippet) expect(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -354,7 +354,7 @@ describe Projects::SnippetsController do ...@@ -354,7 +354,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
get action, params: { namespace_id: project.namespace, project_id: project, id: 42 } get action, params: { namespace_id: project.namespace, project_id: project, id: 42 }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -366,7 +366,7 @@ describe Projects::SnippetsController do ...@@ -366,7 +366,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
get action, params: { namespace_id: project.namespace, project_id: project, id: 42 } get action, params: { namespace_id: project.namespace, project_id: project, id: 42 }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -386,7 +386,7 @@ describe Projects::SnippetsController do ...@@ -386,7 +386,7 @@ describe Projects::SnippetsController do
let(:snippet_permission) { :private } let(:snippet_permission) { :private }
it 'responds with status 404' do it 'responds with status 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -395,7 +395,7 @@ describe Projects::SnippetsController do ...@@ -395,7 +395,7 @@ describe Projects::SnippetsController do
it 'responds with status 200' do it 'responds with status 200' do
expect(assigns(:snippet)).to eq(project_snippet) expect(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -407,7 +407,7 @@ describe Projects::SnippetsController do ...@@ -407,7 +407,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
expect(assigns(:snippet)).to eq(project_snippet) expect(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -501,7 +501,7 @@ describe Projects::SnippetsController do ...@@ -501,7 +501,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do it 'responds with status 404' do
delete :destroy, params: params delete :destroy, params: params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -25,7 +25,7 @@ describe Projects::StagesController do ...@@ -25,7 +25,7 @@ describe Projects::StagesController do
it 'returns not authorized' do it 'returns not authorized' do
play_manual_stage! play_manual_stage!
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
......
...@@ -110,7 +110,7 @@ describe Projects::TemplatesController do ...@@ -110,7 +110,7 @@ describe Projects::TemplatesController do
it 'returns the template names' do it 'returns the template names' do
get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json) get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response.size).to eq(1) expect(json_response.size).to eq(1)
expect(json_response[0]['name']).to eq(expected_template_name) expect(json_response[0]['name']).to eq(expected_template_name)
end end
...@@ -121,7 +121,7 @@ describe Projects::TemplatesController do ...@@ -121,7 +121,7 @@ describe Projects::TemplatesController do
get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json) get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
......
...@@ -22,7 +22,7 @@ describe Projects::TodosController do ...@@ -22,7 +22,7 @@ describe Projects::TodosController do
it "doesn't create todo" do it "doesn't create todo" do
expect { post_create }.not_to change { user.todos.count } expect { post_create }.not_to change { user.todos.count }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -85,7 +85,7 @@ describe Projects::TreeController do ...@@ -85,7 +85,7 @@ describe Projects::TreeController do
context "valid SHA commit ID with path" do context "valid SHA commit ID with path" do
let(:id) { '6d39438/.gitignore' } let(:id) { '6d39438/.gitignore' }
it { expect(response).to have_gitlab_http_status(302) } it { expect(response).to have_gitlab_http_status(:found) }
end end
end end
......
...@@ -49,7 +49,7 @@ describe Projects::UploadsController do ...@@ -49,7 +49,7 @@ describe Projects::UploadsController do
it "responds with status internal_server_error" do it "responds with status internal_server_error" do
post_authorize post_authorize
expect(response).to have_gitlab_http_status(500) expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.body).to eq(_('Error uploading file')) expect(response.body).to eq(_('Error uploading file'))
end end
end end
......
...@@ -24,7 +24,7 @@ describe Projects::UsagePingController do ...@@ -24,7 +24,7 @@ describe Projects::UsagePingController do
it 'returns 302' do it 'returns 302' do
subject subject
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -32,7 +32,7 @@ describe Projects::UsagePingController do ...@@ -32,7 +32,7 @@ describe Projects::UsagePingController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -57,7 +57,7 @@ describe Projects::UsagePingController do ...@@ -57,7 +57,7 @@ describe Projects::UsagePingController do
it 'returns 404' do it 'returns 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -25,7 +25,7 @@ describe Projects::WikisController do ...@@ -25,7 +25,7 @@ describe Projects::WikisController do
it 'redirects to #show and appends a `random_title` param' do it 'redirects to #show and appends a `random_title` param' do
subject subject
expect(response).to have_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(Rails.application.routes.recognize_path(response.redirect_url)).to include( expect(Rails.application.routes.recognize_path(response.redirect_url)).to include(
controller: 'projects/wikis', controller: 'projects/wikis',
action: 'show' action: 'show'
...@@ -70,7 +70,7 @@ describe Projects::WikisController do ...@@ -70,7 +70,7 @@ describe Projects::WikisController do
end end
it "returns status #{expected_status}" do it "returns status #{expected_status}" do
expect(response).to have_http_status(expected_status) expect(response).to have_gitlab_http_status(expected_status)
end end
end end
...@@ -103,7 +103,7 @@ describe Projects::WikisController do ...@@ -103,7 +103,7 @@ describe Projects::WikisController do
subject subject
expect(response).to have_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:page).title).to eq(wiki_title) expect(assigns(:page).title).to eq(wiki_title)
end end
...@@ -113,7 +113,7 @@ describe Projects::WikisController do ...@@ -113,7 +113,7 @@ describe Projects::WikisController do
subject subject
expect(response).to have_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(flash[:notice]).to eq(_('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.')) expect(flash[:notice]).to eq(_('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.'))
end end
end end
...@@ -204,7 +204,7 @@ describe Projects::WikisController do ...@@ -204,7 +204,7 @@ describe Projects::WikisController do
it 'shows the edit page' do it 'shows the edit page' do
subject subject
expect(response).to have_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(s_('Wiki|Edit Page')) expect(response.body).to include(s_('Wiki|Edit Page'))
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