Commit b629325a authored by Peter Leitzen's avatar Peter Leitzen

Add http status cop in project controller specs

126 files inspected, 429 offenses detected, 429 offenses corrected
parent cbc62341
......@@ -347,6 +347,8 @@ RSpec/HaveGitlabHttpStatus:
- 'ee/spec/features/**/*'
- 'spec/controllers/*.rb'
- 'ee/spec/controllers/*.rb'
- 'spec/controllers/projects/*.rb'
- 'ee/spec/controllers/projects/*.rb'
- 'spec/requests/*.rb'
- 'ee/spec/requests/*.rb'
......
......@@ -33,7 +33,7 @@ describe Projects::ApproverGroupsController do
it 'returns a 404' do
destroy_merge_request_approver_group
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not destroy any approver groups' do
......@@ -51,7 +51,7 @@ describe Projects::ApproverGroupsController do
it 'returns a 404' do
destroy_merge_request_approver_group
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not destroy any approver groups' do
......@@ -88,7 +88,7 @@ describe Projects::ApproverGroupsController do
it 'returns a 404' do
destroy_project_approver_group
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not destroy any approver groups' do
......
......@@ -33,7 +33,7 @@ describe Projects::ApproversController do
it 'returns a 404' do
destroy_merge_request_approver
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not destroy any approvers' do
......@@ -51,7 +51,7 @@ describe Projects::ApproversController do
it 'returns a 404' do
destroy_merge_request_approver
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not destroy any approvers' do
......@@ -88,7 +88,7 @@ describe Projects::ApproversController do
it 'returns a 404' do
destroy_project_approver
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not destroy any approvers' do
......
......@@ -30,7 +30,7 @@ describe Projects::AuditEventsController do
request
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
......@@ -55,7 +55,7 @@ describe Projects::AuditEventsController do
it 'renders 404' do
request
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -69,7 +69,7 @@ describe Projects::AuditEventsController do
it 'renders 404' do
request
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -43,7 +43,7 @@ describe Projects::BoardsController do
list_boards(recent: true)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......@@ -72,7 +72,7 @@ describe Projects::BoardsController do
it 'returns a successful 200 response' do
create_board create_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the created board' do
......@@ -96,7 +96,7 @@ describe Projects::BoardsController do
it 'returns an unprocessable entity 422 response' do
create_board name: nil
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......@@ -110,7 +110,7 @@ describe Projects::BoardsController do
create_board name: 'Backend'
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
......@@ -143,7 +143,7 @@ describe Projects::BoardsController do
it 'returns a successful 200 response' do
update_board board, update_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the updated board' do
......@@ -164,7 +164,7 @@ describe Projects::BoardsController do
it 'returns an unprocessable entity 422 response' do
update_board board, name: nil
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......@@ -172,7 +172,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do
update_board 999, name: nil
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -186,7 +186,7 @@ describe Projects::BoardsController do
update_board board, update_params
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
......@@ -221,7 +221,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do
remove_board board: 999
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -234,7 +234,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do
remove_board board: board
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -33,7 +33,7 @@ describe Projects::DependenciesController do
get :index, params: params, format: :html
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
expect(response.body).to have_active_sub_navigation('Dependency List')
......@@ -76,7 +76,7 @@ describe Projects::DependenciesController do
end
it 'returns success code' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -231,13 +231,13 @@ describe Projects::DependenciesController do
it 'returns 403 for a JSON request' do
get :index, params: params, format: :json
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'returns a 404 for an HTML request' do
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
......@@ -254,13 +254,13 @@ describe Projects::DependenciesController do
it 'returns 403 for a JSON request' do
get :index, params: params, format: :json
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'returns a 404 for an HTML request' do
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
......
......@@ -55,7 +55,7 @@ describe Projects::DeployKeysController do
it 'returns 404' do
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
......
......@@ -93,7 +93,7 @@ describe Projects::EnvironmentsController do
end
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
......@@ -105,7 +105,7 @@ describe Projects::EnvironmentsController do
end
it 'is successful' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -114,7 +114,7 @@ describe Projects::EnvironmentsController do
it 'is successful' do
get :terminal, params: environment_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -38,7 +38,7 @@ describe Projects::FeatureFlagsClientsController do
it 'returns 404' do
reset_token
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -51,7 +51,7 @@ describe Projects::FeatureFlagsClientsController do
it 'returns 404' do
reset_token
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -55,7 +55,7 @@ describe Projects::FeatureFlagsController do
end
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
......@@ -268,7 +268,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -278,7 +278,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -340,7 +340,7 @@ describe Projects::FeatureFlagsController do
it 'returns 200' do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'creates a new feature flag' do
......@@ -372,7 +372,7 @@ describe Projects::FeatureFlagsController do
it 'returns 400' do
subject
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
it 'returns an error message' do
......@@ -409,7 +409,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -428,7 +428,7 @@ describe Projects::FeatureFlagsController do
it 'creates feature flag scopes successfully' do
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
it 'creates feature flag scopes in a correct order' do
......@@ -453,7 +453,7 @@ describe Projects::FeatureFlagsController do
it 'returns 400' do
subject
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message'])
.to include('Default scope has to be the first element')
end
......@@ -543,7 +543,7 @@ describe Projects::FeatureFlagsController do
it 'returns 200' do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'deletes one feature flag' do
......@@ -566,7 +566,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -603,7 +603,7 @@ describe Projects::FeatureFlagsController do
it 'returns 200' do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'updates the name of the feature flag name' do
......@@ -666,7 +666,7 @@ describe Projects::FeatureFlagsController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -705,7 +705,7 @@ describe Projects::FeatureFlagsController do
it 'returns 400' do
subject
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
end
......@@ -755,7 +755,7 @@ describe Projects::FeatureFlagsController do
it 'returns 400' do
subject
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
end
......
......@@ -37,7 +37,7 @@ describe Projects::IssueLinksController do
it 'returns success response' do
get_link(user, issue1)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
link = json_response.first
expect(link['id']).to eq(issue2.id)
......@@ -53,7 +53,7 @@ describe Projects::IssueLinksController do
it 'does not return issue_link_type' do
get_link(user, issue1)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
link = json_response.first
expect(link['id']).to eq(issue2.id)
......@@ -87,7 +87,7 @@ describe Projects::IssueLinksController do
it 'returns success response' do
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
expect(link['id']).to eq(issue2.id)
......@@ -103,7 +103,7 @@ describe Projects::IssueLinksController do
it 'returns 403' do
create_link(user, issue1, issue2)
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
......
......@@ -108,7 +108,7 @@ describe Projects::IssuesController do
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)
end
......@@ -118,7 +118,7 @@ describe Projects::IssuesController do
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])
end
end
......@@ -127,7 +127,7 @@ describe Projects::IssuesController do
it 'sets issue weight' do
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)
end
end
......@@ -136,7 +136,7 @@ describe Projects::IssuesController do
it 'sets issue weight' do
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)
issue = Issue.first
......@@ -156,7 +156,7 @@ describe Projects::IssuesController do
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)
end
end
......@@ -165,7 +165,7 @@ describe Projects::IssuesController do
it 'does not set issue weight' do
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.read_attribute(:weight)).to eq(5) # pre-existing data is not overwritten
end
......@@ -175,7 +175,7 @@ describe Projects::IssuesController do
it 'does not set issue weight' do
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)
issue = Issue.first
......@@ -234,7 +234,7 @@ describe Projects::IssuesController do
it 'returns a 404' do
get_service_desk
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -261,7 +261,7 @@ describe Projects::IssuesController do
}
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
......
......@@ -26,7 +26,7 @@ describe Projects::LicensesController do
it 'responds to an HTML request' do
get :index, params: params
expect(response).to have_http_status(:ok)
expect(response).to have_gitlab_http_status(:ok)
end
it 'counts usage of the feature' do
......@@ -43,7 +43,7 @@ describe Projects::LicensesController do
end
it 'returns success code' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns a hash with licenses' do
......@@ -91,7 +91,7 @@ describe Projects::LicensesController do
}, format: :json
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 '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
}, format: :json
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
expect(json_response["licenses"].count).to be(3)
......@@ -186,7 +186,7 @@ describe Projects::LicensesController do
}, format: :json
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 'includes only `allowed` policies' do
......@@ -207,7 +207,7 @@ describe Projects::LicensesController do
}, format: :json
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 'includes `denied` policies' do
......@@ -247,7 +247,7 @@ describe Projects::LicensesController do
end
it 'returns 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -260,7 +260,7 @@ describe Projects::LicensesController do
end
it 'returns 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -292,7 +292,7 @@ describe Projects::LicensesController do
post :create, xhr: true, params: default_params
end
it { expect(response).to have_http_status(:not_found) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
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
post :create, xhr: true, params: default_params
end
it { expect(response).to have_http_status(:not_found) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
context "when authorized as a maintainer" do
......@@ -322,7 +322,7 @@ describe Projects::LicensesController do
})
end
it { expect(response).to have_http_status(:created) }
it { expect(response).to have_gitlab_http_status(:created) }
it 'creates a new policy' do
expect(project.reload.software_license_policies.denied.count).to be(1)
......@@ -349,7 +349,7 @@ describe Projects::LicensesController do
})
end
it { expect(response).to have_http_status(:created) }
it { expect(response).to have_gitlab_http_status(:created) }
it 'creates a new policy' do
expect(project.reload.software_license_policies.allowed.count).to be(1)
......@@ -376,7 +376,7 @@ describe Projects::LicensesController do
})
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"] } }) }
end
end
......@@ -410,7 +410,7 @@ describe Projects::LicensesController do
patch :update, xhr: true, params: default_params
end
it { expect(response).to have_http_status(:not_found) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
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
patch :update, xhr: true, params: default_params
end
it { expect(response).to have_http_status(:not_found) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
context "when authorized as a maintainer" do
......@@ -439,7 +439,7 @@ describe Projects::LicensesController do
})
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 "generates the proper JSON response" do
......@@ -459,7 +459,7 @@ describe Projects::LicensesController do
})
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"] } }) }
end
end
......
......@@ -473,7 +473,7 @@ describe Projects::MergeRequestsController do
it 'restricts unauthorized access' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -556,7 +556,7 @@ describe Projects::MergeRequestsController do
it 'restricts unauthorized access' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -639,7 +639,7 @@ describe Projects::MergeRequestsController do
it 'restricts unauthorized access' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -720,7 +720,7 @@ describe Projects::MergeRequestsController do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'restricts access to other users' do
......@@ -728,7 +728,7 @@ describe Projects::MergeRequestsController do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -144,14 +144,14 @@ describe Projects::MirrorsController do
it 'processes a successful update' do
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')
end
it 'processes an unsuccessful update' do
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/
end
......@@ -160,14 +160,14 @@ describe Projects::MirrorsController do
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)
end
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)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
import_data = project.reload_import_data
expect(import_data.ssh_known_hosts_verified_at).to be_within(1.minute).of(Time.now)
......@@ -179,7 +179,7 @@ describe Projects::MirrorsController do
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
expect(import_data.ssh_known_hosts_verified_at).to be_nil
......@@ -192,7 +192,7 @@ describe Projects::MirrorsController do
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")
end
end
......
......@@ -17,7 +17,7 @@ describe Projects::PathLocksController do
it 'displays the lock paths' do
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
context 'when the user does not have access' do
......@@ -27,7 +27,7 @@ describe Projects::PathLocksController do
it 'does not allow access' do
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
......@@ -43,7 +43,7 @@ describe Projects::PathLocksController do
toggle_lock(file_path)
expect(PathLock.count).to eq(1)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it "locks the file in LFS" do
......@@ -61,13 +61,13 @@ describe Projects::PathLocksController do
it 'locks the directory' do
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
it 'does not locks the directory through LFS' do
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
......@@ -80,7 +80,7 @@ describe Projects::PathLocksController do
it 'unlocks the file' do
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
it "unlocks the file in LFS" do
......@@ -97,7 +97,7 @@ describe Projects::PathLocksController do
it 'unlocks the directory' do
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
it 'does not call the LFS unlock service' do
......@@ -112,7 +112,7 @@ describe Projects::PathLocksController do
it 'locks the file' do
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
it "doesn't lock the file in LFS" do
......@@ -124,7 +124,7 @@ describe Projects::PathLocksController do
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
......@@ -135,7 +135,7 @@ describe Projects::PathLocksController do
it 'does not allow access' do
toggle_lock(file_path)
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -27,7 +27,7 @@ describe Projects::PipelinesController do
end
it do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template :show
end
end
......@@ -89,7 +89,7 @@ describe Projects::PipelinesController do
end
it do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template :show
end
end
......@@ -133,7 +133,7 @@ describe Projects::PipelinesController do
end
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
......@@ -157,7 +157,7 @@ describe Projects::PipelinesController do
end
it 'will return 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -177,7 +177,7 @@ describe Projects::PipelinesController do
end
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
......
......@@ -79,7 +79,7 @@ describe Projects::ProtectedEnvironmentsController do
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -123,7 +123,7 @@ describe Projects::ProtectedEnvironmentsController do
end
it 'is successful' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -135,7 +135,7 @@ describe Projects::ProtectedEnvironmentsController do
end
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
......@@ -184,7 +184,7 @@ describe Projects::ProtectedEnvironmentsController do
it 'is not successful' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -20,7 +20,7 @@ describe Projects::PushRulesController do
it 'updates the push rule' do
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
end
......@@ -32,7 +32,7 @@ describe Projects::PushRulesController do
it 'returns 404' do
do_update
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -23,7 +23,7 @@ describe Projects::ThreatMonitoringController do
it 'renders the show template' do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show)
end
end
......@@ -37,7 +37,7 @@ describe Projects::ThreatMonitoringController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -55,7 +55,7 @@ describe Projects::ThreatMonitoringController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -64,7 +64,7 @@ describe Projects::ThreatMonitoringController do
it 'returns 302' do
subject
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(new_user_session_path)
end
end
......
......@@ -16,7 +16,7 @@ describe Projects::TracingsController do
it 'renders OK' do
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)
end
end
......
......@@ -28,7 +28,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a successful 200 response' do
list_feedbacks
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns project feedbacks list' do
......@@ -72,7 +72,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a 404 response' do
list_feedbacks
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -131,13 +131,13 @@ describe Projects::VulnerabilityFeedbackController 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)
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
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')
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -148,7 +148,7 @@ describe Projects::VulnerabilityFeedbackController do
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
......@@ -158,7 +158,7 @@ describe Projects::VulnerabilityFeedbackController do
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
......@@ -168,7 +168,7 @@ describe Projects::VulnerabilityFeedbackController do
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
......@@ -180,7 +180,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a 404 response' do
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
......@@ -216,7 +216,7 @@ describe Projects::VulnerabilityFeedbackController do
end
it 'returns a successful 200 response' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'updates the comment attributes' do
......@@ -229,7 +229,7 @@ describe Projects::VulnerabilityFeedbackController do
vuln_feedback.id = 123
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
......@@ -239,7 +239,7 @@ describe Projects::VulnerabilityFeedbackController do
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
......@@ -250,7 +250,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a 404 response' do
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
......@@ -274,7 +274,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a successful 204 response' do
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
......@@ -282,7 +282,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a not found 404 response for invalid vulnerability feedback id' do
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
......@@ -292,7 +292,7 @@ describe Projects::VulnerabilityFeedbackController do
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
......@@ -303,7 +303,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a 404 response' do
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
......@@ -313,7 +313,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a forbidden 403 response' do
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
......@@ -323,7 +323,7 @@ describe Projects::VulnerabilityFeedbackController do
it 'returns a forbidden 403 response' do
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
......
......@@ -30,7 +30,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { admin }
it 'returns 200' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -38,7 +38,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { owner }
it 'returns 200' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -46,7 +46,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { maintainer }
it 'returns 200' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -54,7 +54,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { developer }
it 'returns 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -62,7 +62,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { reporter }
it 'returns 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -70,7 +70,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { guest }
it 'returns 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -78,7 +78,7 @@ describe Projects::WebIdeTerminalsController do
let(:user) { create(:user) }
it 'returns 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -89,7 +89,7 @@ describe Projects::WebIdeTerminalsController do
let(:pipeline) { create(:ci_pipeline, project: project, source: :chat, user: user) }
it 'returns 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -124,7 +124,7 @@ describe Projects::WebIdeTerminalsController do
let(:result) { { status: :error } }
it 'returns 422' do
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
end
......@@ -161,7 +161,7 @@ describe Projects::WebIdeTerminalsController do
it 'returns 400' do
subject
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
end
......@@ -174,7 +174,7 @@ describe Projects::WebIdeTerminalsController do
subject
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
end
end
......@@ -197,7 +197,7 @@ describe Projects::WebIdeTerminalsController do
let!(:job) { create(:ci_build, :failed, pipeline: pipeline, user: user) }
it 'returns 422' do
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
end
......@@ -220,7 +220,7 @@ describe Projects::WebIdeTerminalsController do
let!(:job) { create(:ci_build, :running, pipeline: pipeline, user: user) }
it 'returns 422' do
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
end
......
......@@ -156,7 +156,7 @@ describe Projects::ArtifactsController do
it 'returns 404' do
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
......@@ -236,7 +236,7 @@ describe Projects::ArtifactsController do
it 'renders the file view' do
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
......@@ -302,7 +302,7 @@ describe Projects::ArtifactsController 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' }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......@@ -317,7 +317,7 @@ describe Projects::ArtifactsController do
it 'serves the file using workhorse' do
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(params.keys).to eq(%w(Archive Entry))
......
......@@ -65,7 +65,7 @@ describe Projects::AutocompleteSourcesController do
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
......
......@@ -16,7 +16,7 @@ describe Projects::AvatarsController do
it 'shows 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -31,7 +31,7 @@ describe Projects::AvatarsController do
it 'sends the avatar' do
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[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:')
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
......
......@@ -232,7 +232,7 @@ describe Projects::BlobController do
end
it 'redirects to blob show' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -246,7 +246,7 @@ describe Projects::BlobController do
end
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
......
......@@ -39,7 +39,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do
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'
end
end
......@@ -82,7 +82,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do
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'
end
end
......@@ -94,7 +94,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do
list_boards
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -137,7 +137,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do
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'
end
end
......@@ -174,7 +174,7 @@ describe Projects::BoardsController do
it 'returns a not found 404 response' do
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'
end
end
......@@ -186,7 +186,7 @@ describe Projects::BoardsController do
read_board board: another_board
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -217,7 +217,7 @@ describe Projects::BranchesController do
}
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
......@@ -238,7 +238,7 @@ describe Projects::BranchesController do
}
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
......@@ -289,7 +289,7 @@ describe Projects::BranchesController do
it 'returns a successful 200 response' do
create_branch name: 'my-branch', ref: 'master'
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the created branch' do
......@@ -303,7 +303,7 @@ describe Projects::BranchesController do
it 'returns an unprocessable entity 422 response' do
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
......@@ -335,7 +335,7 @@ describe Projects::BranchesController do
project_id: project
}
expect(response).to have_gitlab_http_status(303)
expect(response).to have_gitlab_http_status(:see_other)
end
end
......@@ -361,28 +361,28 @@ describe Projects::BranchesController do
context "valid branch name, valid source" do
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 }
end
context "valid branch name with unencoded slashes" do
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 }
end
context "valid branch name with encoded slashes" do
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 }
end
context "invalid branch name, valid ref" do
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 }
end
end
......@@ -398,7 +398,7 @@ describe Projects::BranchesController do
expect(json_response).to eql("message" => 'Branch was deleted')
end
it { expect(response).to have_gitlab_http_status(200) }
it { expect(response).to have_gitlab_http_status(:ok) }
end
context 'valid branch name with unencoded slashes' do
......@@ -408,7 +408,7 @@ describe Projects::BranchesController do
expect(json_response).to eql('message' => 'Branch was deleted')
end
it { expect(response).to have_gitlab_http_status(200) }
it { expect(response).to have_gitlab_http_status(:ok) }
end
context "valid branch name with encoded slashes" do
......@@ -418,7 +418,7 @@ describe Projects::BranchesController do
expect(json_response).to eql('message' => 'Branch was deleted')
end
it { expect(response).to have_gitlab_http_status(200) }
it { expect(response).to have_gitlab_http_status(:ok) }
end
context 'invalid branch name, valid ref' do
......@@ -428,7 +428,7 @@ describe Projects::BranchesController do
expect(json_response).to eql('message' => 'No such branch')
end
it { expect(response).to have_gitlab_http_status(404) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
end
......@@ -478,7 +478,7 @@ describe Projects::BranchesController do
it 'responds with status 404' do
destroy_all_merged
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -519,7 +519,7 @@ describe Projects::BranchesController do
state: 'all'
}
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -537,7 +537,7 @@ describe Projects::BranchesController do
state: 'all'
}
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -594,7 +594,7 @@ describe Projects::BranchesController do
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(
"fix" => { "behind" => 29, "ahead" => 2 },
"branch-merged" => { "behind" => 1, "ahead" => 0 },
......@@ -612,7 +612,7 @@ describe Projects::BranchesController do
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
end
......@@ -629,7 +629,7 @@ describe Projects::BranchesController do
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")
end
......@@ -642,7 +642,7 @@ describe Projects::BranchesController do
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
end
end
......
......@@ -648,7 +648,7 @@ describe Projects::ClustersController do
go(format: :json)
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.name).to eq('my-new-cluster-name')
expect(cluster).not_to be_managed
......@@ -671,7 +671,7 @@ describe Projects::ClustersController do
it "rejects changes" do
go(format: :json)
expect(response).to have_http_status(:bad_request)
expect(response).to have_gitlab_http_status(:bad_request)
end
end
end
......
......@@ -179,7 +179,7 @@ describe Projects::CommitController do
})
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
......@@ -236,7 +236,7 @@ describe Projects::CommitController do
})
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
......@@ -322,7 +322,7 @@ describe Projects::CommitController do
end
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
......@@ -334,7 +334,7 @@ describe Projects::CommitController do
end
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
......@@ -345,7 +345,7 @@ describe Projects::CommitController do
end
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
......@@ -393,7 +393,7 @@ describe Projects::CommitController do
end
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
......
......@@ -108,7 +108,7 @@ describe Projects::CompareController do
show_request
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
......@@ -120,7 +120,7 @@ describe Projects::CompareController do
show_request
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
......@@ -164,7 +164,7 @@ describe Projects::CompareController do
end
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
......@@ -176,7 +176,7 @@ describe Projects::CompareController do
end
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
......@@ -187,7 +187,7 @@ describe Projects::CompareController do
end
it 'returns a 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -197,7 +197,7 @@ describe Projects::CompareController do
end
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
......@@ -301,7 +301,7 @@ describe Projects::CompareController do
it 'returns only the commit with a signature' do
signatures_request
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
signatures = json_response['signatures']
expect(signatures.size).to eq(1)
......@@ -318,7 +318,7 @@ describe Projects::CompareController do
it 'returns a 404' do
signatures_request
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -330,7 +330,7 @@ describe Projects::CompareController do
it 'returns no signatures' do
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
end
end
......@@ -342,7 +342,7 @@ describe Projects::CompareController do
it 'returns no signatures' do
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
end
end
......
......@@ -122,7 +122,7 @@ describe Projects::DeployKeysController do
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
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)
end
end
......@@ -137,7 +137,7 @@ describe Projects::DeployKeysController do
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
end.not_to change { DeployKeysProject.count }
expect(response).to have_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -152,14 +152,14 @@ describe Projects::DeployKeysController do
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(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'))
end
it 'returns 404' do
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
......@@ -174,7 +174,7 @@ describe Projects::DeployKeysController do
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(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'))
end
end
......@@ -192,7 +192,7 @@ describe Projects::DeployKeysController do
it 'redirects to login' do
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(DeployKey.find(deploy_key.id)).to eq(deploy_key)
end
......@@ -206,7 +206,7 @@ describe Projects::DeployKeysController do
it 'returns 404' do
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)
end
end
......@@ -215,7 +215,7 @@ describe Projects::DeployKeysController do
it 'returns 302' do
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 { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound)
......@@ -224,7 +224,7 @@ describe Projects::DeployKeysController do
it 'returns 404' do
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
......@@ -238,7 +238,7 @@ describe Projects::DeployKeysController do
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
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 { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound)
......
......@@ -61,7 +61,7 @@ describe Projects::DeploymentsController do
it 'returns a empty response 204 resposne' do
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('')
end
end
......@@ -100,7 +100,7 @@ describe Projects::DeploymentsController do
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
......@@ -129,7 +129,7 @@ describe Projects::DeploymentsController do
it 'returns a empty response 204 response' do
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('')
end
end
......
......@@ -27,7 +27,7 @@ describe Projects::DiscussionsController do
it 'returns 404' do
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
......@@ -39,7 +39,7 @@ describe Projects::DiscussionsController do
it 'returns status 200' do
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
it 'returns status 404 if MR does not exists' do
......@@ -47,7 +47,7 @@ describe Projects::DiscussionsController do
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
......@@ -60,7 +60,7 @@ describe Projects::DiscussionsController do
it 'returns status 200' do
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
......@@ -74,7 +74,7 @@ describe Projects::DiscussionsController do
it "returns status 404" do
post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -91,7 +91,7 @@ describe Projects::DiscussionsController do
it "returns status 404" do
post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -120,7 +120,7 @@ describe Projects::DiscussionsController do
it "returns status 200" do
post :resolve, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it "renders discussion with serializer" do
......@@ -157,7 +157,7 @@ describe Projects::DiscussionsController do
it "returns status 404" do
delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -174,7 +174,7 @@ describe Projects::DiscussionsController do
it "returns status 404" do
delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -188,7 +188,7 @@ describe Projects::DiscussionsController do
it "returns status 200" do
delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
context "when vue_mr_discussions cookie is present" do
......
......@@ -179,7 +179,7 @@ describe Projects::EnvironmentsController do
params[:id] = 12345
get :show, params: params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -197,7 +197,7 @@ describe Projects::EnvironmentsController do
patch_params = environment_params.merge(environment: { external_url: 'https://git.gitlab.com' })
patch :update, params: patch_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -208,7 +208,7 @@ describe Projects::EnvironmentsController do
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
......@@ -221,7 +221,7 @@ describe Projects::EnvironmentsController do
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(
{ 'redirect_url' =>
project_job_url(project, action) })
......@@ -235,7 +235,7 @@ describe Projects::EnvironmentsController do
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(
{ 'redirect_url' =>
project_environment_url(project, environment) })
......@@ -278,7 +278,7 @@ describe Projects::EnvironmentsController do
it 'responds with a status code 200' do
get :terminal, params: environment_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'loads the terminals for the environment' do
......@@ -295,7 +295,7 @@ describe Projects::EnvironmentsController do
it 'responds with a status code 404' do
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
......@@ -321,7 +321,7 @@ describe Projects::EnvironmentsController do
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.body).to eq('{"workhorse":"response"}')
end
......@@ -331,7 +331,7 @@ describe Projects::EnvironmentsController do
it 'returns 404' do
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
......@@ -386,7 +386,7 @@ describe Projects::EnvironmentsController do
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({})
end
end
......@@ -428,7 +428,7 @@ describe Projects::EnvironmentsController do
it 'returns a metrics JSON document' do
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({})
end
end
......
......@@ -23,7 +23,7 @@ describe Projects::ForksController do
it 'returns with 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -167,7 +167,7 @@ describe Projects::ForksController do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -205,7 +205,7 @@ describe Projects::ForksController do
it 'responds with status 302' do
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))
end
......@@ -228,7 +228,7 @@ describe Projects::ForksController do
it 'passes continue params to the redirect' do
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))
end
end
......
......@@ -33,7 +33,7 @@ describe Projects::GroupLinksController do
include_context 'link project to group'
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
......
......@@ -42,7 +42,7 @@ describe Projects::HooksController do
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.first).to have_attributes(hook_params)
end
......
......@@ -24,7 +24,7 @@ describe Projects::IssuesController do
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
......@@ -32,7 +32,7 @@ describe Projects::IssuesController do
it 'renders the "index" template' do
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)
end
end
......@@ -51,14 +51,14 @@ describe Projects::IssuesController do
get :index, params: { namespace_id: project.namespace, project_id: 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
it 'redirects from an old issue correctly' do
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 have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......@@ -78,7 +78,7 @@ describe Projects::IssuesController do
it "returns index" do
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
it "returns 301 if request path doesn't match project path" do
......@@ -92,7 +92,7 @@ describe Projects::IssuesController do
project.save!
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
......@@ -118,7 +118,7 @@ describe Projects::IssuesController do
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)
end
end
......@@ -227,7 +227,7 @@ describe Projects::IssuesController do
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
......@@ -235,7 +235,7 @@ describe Projects::IssuesController do
it 'renders the "new" template' do
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)
end
end
......@@ -330,7 +330,7 @@ describe Projects::IssuesController do
[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)
.to be_between(issue2.relative_position, issue3.relative_position)
end
......@@ -340,7 +340,7 @@ describe Projects::IssuesController do
it 'returns a unprocessable entity 422 response for invalid move ids' do
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
it 'returns a not found 404 response for invalid issue id' do
......@@ -348,7 +348,7 @@ describe Projects::IssuesController do
move_after_id: issue2.id,
move_before_id: issue3.id)
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'returns a unprocessable entity 422 response for issues not in group' do
......@@ -359,7 +359,7 @@ describe Projects::IssuesController do
move_before_id: issue3.id,
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
......@@ -415,7 +415,7 @@ describe Projects::IssuesController do
it 'updates the issue' do
subject
expect(response).to have_http_status(:ok)
expect(response).to have_gitlab_http_status(:ok)
expect(issue.reload.title).to eq('New title')
end
......@@ -443,7 +443,7 @@ describe Projects::IssuesController do
it 'updates the issue' do
subject
expect(response).to have_http_status(:ok)
expect(response).to have_gitlab_http_status(:ok)
expect(issue.reload.title).to eq('New title')
end
end
......@@ -458,7 +458,7 @@ describe Projects::IssuesController do
it 'responds with 404' do
subject
expect(response).to have_http_status(:not_found)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -505,7 +505,7 @@ describe Projects::IssuesController do
it 'returns 200' do
go(id: issue.iid)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -749,7 +749,7 @@ describe Projects::IssuesController do
it 'returns 200 status' do
update_issue
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -769,7 +769,7 @@ describe Projects::IssuesController do
it 'returns 200 status' do
update_issue
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -785,7 +785,7 @@ describe Projects::IssuesController do
end
it 'returns 200 status' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'accepts an issue after recaptcha is verified' do
......@@ -1131,7 +1131,7 @@ describe Projects::IssuesController do
it "rejects a developer to destroy an issue" do
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
......@@ -1147,14 +1147,14 @@ describe Projects::IssuesController do
it "deletes the issue" do
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\./)
end
it "deletes the issue" do
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\./)
end
......@@ -1163,7 +1163,7 @@ describe Projects::IssuesController do
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')
end
......@@ -1172,7 +1172,7 @@ describe Projects::IssuesController do
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' })
end
......@@ -1206,7 +1206,7 @@ describe Projects::IssuesController do
subject
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
it "removes the already awarded emoji" do
......@@ -1214,7 +1214,7 @@ describe Projects::IssuesController do
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
it 'marks Todos on the Issue as done' do
......@@ -1250,7 +1250,7 @@ describe Projects::IssuesController do
create_merge_request
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'is not available for users who cannot create merge requests' do
......@@ -1258,7 +1258,7 @@ describe Projects::IssuesController do
create_merge_request
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
context 'target_project_id is set' do
......
......@@ -1183,7 +1183,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
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.body).to eq('{"workhorse":"response"}')
end
......@@ -1193,7 +1193,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
it 'returns 404' do
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
......
......@@ -80,7 +80,7 @@ describe Projects::LabelsController do
it 'creates labels' do
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
......@@ -88,7 +88,7 @@ describe Projects::LabelsController do
it 'creates labels' do
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
......@@ -99,7 +99,7 @@ describe Projects::LabelsController do
toggle_subscription(label)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'allows user to toggle subscription on group labels' do
......@@ -107,7 +107,7 @@ describe Projects::LabelsController do
toggle_subscription(group_label)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
def toggle_subscription(label)
......@@ -123,7 +123,7 @@ describe Projects::LabelsController do
it 'denies access' do
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
......@@ -180,7 +180,7 @@ describe Projects::LabelsController do
it 'does not redirect' do
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
......@@ -231,13 +231,13 @@ describe Projects::LabelsController do
it 'does not 404' do
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
it 'does not redirect to the correct casing' do
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
......@@ -247,7 +247,7 @@ describe Projects::LabelsController do
it 'returns not found' do
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
......
......@@ -25,7 +25,7 @@ describe Projects::MattermostsController do
project_id: project
})
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......
......@@ -113,7 +113,7 @@ describe Projects::MergeRequestsController do
}
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
it 'redirects from an old merge request commits correctly' 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 have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......@@ -229,7 +229,7 @@ describe Projects::MergeRequestsController do
get_merge_requests(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
it 'does not redirect to external sites when provided a host field' do
......@@ -306,7 +306,7 @@ describe Projects::MergeRequestsController do
it 'responds with 404' do
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
......@@ -381,7 +381,7 @@ describe Projects::MergeRequestsController do
end
it 'returns 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -615,7 +615,7 @@ describe Projects::MergeRequestsController 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 }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
context "when the user is owner" do
......@@ -630,7 +630,7 @@ describe Projects::MergeRequestsController do
it "deletes the merge request" do
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\./)
end
......@@ -639,7 +639,7 @@ describe Projects::MergeRequestsController do
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')
end
......@@ -648,7 +648,7 @@ describe Projects::MergeRequestsController do
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' })
end
......@@ -842,7 +842,7 @@ describe Projects::MergeRequestsController do
it 'responds with a 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to be_blank
end
end
......@@ -855,7 +855,7 @@ describe Projects::MergeRequestsController do
it 'responds with a 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to be_blank
end
end
......@@ -898,7 +898,7 @@ describe Projects::MergeRequestsController do
it 'returns exposed artifacts' do
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['data']).to eq([{
'job_name' => 'test',
......@@ -951,7 +951,7 @@ describe Projects::MergeRequestsController do
it 'returns no content' do
subject
expect(response).to have_gitlab_http_status(204)
expect(response).to have_gitlab_http_status(:no_content)
expect(response.body).to be_empty
end
end
......@@ -998,7 +998,7 @@ describe Projects::MergeRequestsController do
it 'responds with a 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to be_blank
end
end
......@@ -1011,7 +1011,7 @@ describe Projects::MergeRequestsController do
it 'responds with a 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to be_blank
end
end
......
......@@ -30,14 +30,14 @@ describe Projects::MilestonesController do
it 'shows milestone page' do
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'
end
it 'returns milestone json' do
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'
end
end
......@@ -171,7 +171,7 @@ describe Projects::MilestonesController do
it 'renders 404' do
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
......@@ -190,7 +190,7 @@ describe Projects::MilestonesController do
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(json_response['html']).not_to include(label.title)
......@@ -201,7 +201,7 @@ describe Projects::MilestonesController do
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(json_response['html']).to include(label.title)
......@@ -240,7 +240,7 @@ describe Projects::MilestonesController do
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
......@@ -263,7 +263,7 @@ describe Projects::MilestonesController do
params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :json }
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(json_response['html']).to include(issue_assignee.name)
end
......@@ -278,7 +278,7 @@ describe Projects::MilestonesController do
params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :json }
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(json_response['html']).not_to include(issue_assignee.name)
end
......
......@@ -103,7 +103,7 @@ describe Projects::MirrorsController do
it "returns an error with a 400 response for URL #{url.inspect}" do
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')
end
end
......@@ -115,7 +115,7 @@ describe Projects::MirrorsController do
do_get(project)
expect(response).to have_gitlab_http_status(204)
expect(response).to have_gitlab_http_status(:no_content)
end
end
......@@ -125,7 +125,7 @@ describe Projects::MirrorsController do
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')
end
end
......@@ -139,7 +139,7 @@ describe Projects::MirrorsController do
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)
end
end
......
......@@ -152,7 +152,7 @@ describe Projects::NotesController do
it 'renders 404' do
get :index, params: params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -246,7 +246,7 @@ describe Projects::NotesController do
context 'the project is publically available' do
context 'for HTML' do
it "returns status 302" do
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -254,7 +254,7 @@ describe Projects::NotesController do
let(:extra_request_params) { { format: :json } }
it "returns status 200 for json" do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -265,7 +265,7 @@ describe Projects::NotesController do
let(:extra_request_params) { { format: :json } }
it "returns status 422 for json" do
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
end
......@@ -278,7 +278,7 @@ describe Projects::NotesController do
let(:extra_request_params) { extra }
it "returns status 404" do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -296,7 +296,7 @@ describe Projects::NotesController do
it "returns status 302 (redirect)" do
create!
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -306,7 +306,7 @@ describe Projects::NotesController do
it "returns status 200" do
create!
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -316,7 +316,7 @@ describe Projects::NotesController do
it 'returns discussion JSON when the return_discussion param is set' do
create!
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to have_key 'discussion'
expect(json_response.dig('discussion', 'notes', 0, 'note')).to eq(request_params[:note][:note])
end
......@@ -330,7 +330,7 @@ describe Projects::NotesController do
it 'includes changes in commands_changes ' do
create!
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['commands_changes']).to include('emoji_award', 'time_estimate', 'spend_time')
expect(json_response['commands_changes']).not_to include('target_project', 'title')
end
......@@ -349,7 +349,7 @@ describe Projects::NotesController do
it 'does not include changes in commands_changes' do
create!
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['commands_changes']).not_to include('target_project', 'title')
end
end
......@@ -363,7 +363,7 @@ describe Projects::NotesController do
it "prevents a non-member user from creating a note on one of the project's merge requests" do
create!
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
context 'when the user is a team member' do
......@@ -424,7 +424,7 @@ describe Projects::NotesController do
it 'returns an error to the user' do
create!
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -436,7 +436,7 @@ describe Projects::NotesController do
it "prevents a non-member user from creating a note on one of the project's merge requests" do
create!
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
context 'when the user is a team member' do
......@@ -467,7 +467,7 @@ describe Projects::NotesController do
it "returns status 302 for html" do
create!
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -531,7 +531,7 @@ describe Projects::NotesController do
it 'returns a 404', :sidekiq_might_not_need_inline do
create!
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -540,7 +540,7 @@ describe Projects::NotesController do
it 'returns a 404', :sidekiq_might_not_need_inline do
create!
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -550,7 +550,7 @@ describe Projects::NotesController do
it 'is successful' do
create!
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'creates the note' do
......@@ -574,7 +574,7 @@ describe Projects::NotesController do
expect { post :create, params: request_params }.to change { issue.notes.count }.by(1)
.and change { locked_issue.notes.count }.by(0)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -588,7 +588,7 @@ describe Projects::NotesController do
request_params[:target_id] = 9999
post :create, params: request_params.merge(format: :json)
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -600,13 +600,13 @@ describe Projects::NotesController do
it 'returns 302 status for html' do
post :create, params: request_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'returns 200 status for json' do
post :create, params: request_params.merge(format: :json)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'creates a new note' do
......@@ -618,7 +618,7 @@ describe Projects::NotesController do
it 'returns 404 status' do
post :create, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not create a new note' do
......@@ -671,7 +671,7 @@ describe Projects::NotesController do
}
}
expect { put :update, params: request_params }.not_to change { note.reload.note }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -695,7 +695,7 @@ describe Projects::NotesController do
it "returns status 200 for html" do
delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it "deletes the note" do
......@@ -712,7 +712,7 @@ describe Projects::NotesController do
it "returns status 404" do
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
......@@ -732,7 +732,7 @@ describe Projects::NotesController do
subject
end.to change { note.award_emoji.count }.by(1)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it "removes the already awarded emoji" do
......@@ -740,7 +740,7 @@ describe Projects::NotesController do
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
it 'marks Todos on the Noteable as done' do
......@@ -766,7 +766,7 @@ describe Projects::NotesController do
it "returns status 404" do
post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -783,7 +783,7 @@ describe Projects::NotesController do
it "returns status 404" do
post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -812,7 +812,7 @@ describe Projects::NotesController do
it "returns status 200" do
post :resolve, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -829,7 +829,7 @@ describe Projects::NotesController do
it "returns status 404" do
delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -846,7 +846,7 @@ describe Projects::NotesController do
it "returns status 404" do
delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -860,7 +860,7 @@ describe Projects::NotesController do
it "returns status 200" do
delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -23,7 +23,7 @@ describe Projects::PagesController do
it 'returns 200 status' do
get :show, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
context 'when the project is in a subgroup' do
......@@ -33,7 +33,7 @@ describe Projects::PagesController do
it 'returns a 200 status code' do
get :show, params: request_params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -42,7 +42,7 @@ describe Projects::PagesController do
it 'returns 302 status' do
delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
context 'when user is developer' do
......@@ -53,7 +53,7 @@ describe Projects::PagesController do
it 'returns 404 status' do
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
......@@ -67,7 +67,7 @@ describe Projects::PagesController do
it 'returns 404 status' do
get :show, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -75,7 +75,7 @@ describe Projects::PagesController do
it 'returns 404 status' do
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
......
......@@ -35,7 +35,7 @@ describe Projects::PagesDomainsController do
it "displays to the 'show' page" do
make_request
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('show')
end
......@@ -47,7 +47,7 @@ describe Projects::PagesDomainsController do
it 'renders 404 page' do
make_request
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -56,7 +56,7 @@ describe Projects::PagesDomainsController do
it "displays the 'new' page" do
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')
end
end
......@@ -78,7 +78,7 @@ describe Projects::PagesDomainsController do
it "displays the 'show' page" do
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')
end
end
......@@ -177,7 +177,7 @@ describe Projects::PagesDomainsController do
it 'returns a 404 response for an unknown domain' do
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
......@@ -250,7 +250,7 @@ describe Projects::PagesDomainsController do
it 'returns 404 status' do
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
......@@ -258,7 +258,7 @@ describe Projects::PagesDomainsController do
it 'returns 404 status' do
get :new, params: request_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -266,7 +266,7 @@ describe Projects::PagesDomainsController do
it "returns 404 status" do
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
......@@ -274,7 +274,7 @@ describe Projects::PagesDomainsController do
it "deletes the pages domain" do
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
......
......@@ -396,7 +396,7 @@ describe Projects::PipelineSchedulesController do
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
......@@ -407,7 +407,7 @@ describe Projects::PipelineSchedulesController do
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(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'prevents users from scheduling the same pipeline repeatedly' do
......@@ -417,7 +417,7 @@ describe Projects::PipelineSchedulesController do
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(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -430,7 +430,7 @@ describe Projects::PipelineSchedulesController do
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
......@@ -460,7 +460,7 @@ describe Projects::PipelineSchedulesController do
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)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......
......@@ -703,7 +703,7 @@ describe Projects::PipelinesController 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 }
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)
end
end
......@@ -716,7 +716,7 @@ describe Projects::PipelinesController 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 }
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)
end
......@@ -728,7 +728,7 @@ describe Projects::PipelinesController 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 }
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)
end
end
......@@ -737,7 +737,7 @@ describe Projects::PipelinesController 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' }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -754,7 +754,7 @@ describe Projects::PipelinesController do
it 'deletes pipeline and redirects' do
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::Pipeline.exists?(pipeline.id)).to be_falsy
......@@ -766,7 +766,7 @@ describe Projects::PipelinesController do
it 'fails to delete pipeline' do
delete_pipeline
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -775,7 +775,7 @@ describe Projects::PipelinesController do
it 'fails to delete pipeline' do
delete_pipeline
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......
......@@ -17,7 +17,7 @@ describe Projects::PipelinesSettingsController do
it 'redirects with 302 status code' do
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
......@@ -11,7 +11,7 @@ describe Projects::ProjectMembersController do
it 'has the project_members address with a 200 status code' do
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
context 'when project belongs to group' do
......@@ -64,7 +64,7 @@ describe Projects::ProjectMembersController do
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
end
end
......@@ -145,7 +145,7 @@ describe Projects::ProjectMembersController do
id: 42
}
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -162,7 +162,7 @@ describe Projects::ProjectMembersController do
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
end
end
......@@ -211,7 +211,7 @@ describe Projects::ProjectMembersController do
project_id: project
}
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -246,7 +246,7 @@ describe Projects::ProjectMembersController do
project_id: project
}
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -305,7 +305,7 @@ describe Projects::ProjectMembersController do
id: 42
}
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -322,7 +322,7 @@ describe Projects::ProjectMembersController do
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
end
end
......
......@@ -23,7 +23,7 @@ describe Projects::RawController do
it 'delivers ASCII file' do
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-Disposition']).to eq('inline')
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
......@@ -37,7 +37,7 @@ describe Projects::RawController do
it 'leaves image content disposition' do
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[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:')
......@@ -63,7 +63,7 @@ describe Projects::RawController do
.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).to have_gitlab_http_status(429)
expect(response).to have_gitlab_http_status(:too_many_requests)
end
it 'logs the event on auth.log' do
......@@ -94,7 +94,7 @@ describe Projects::RawController do
request.headers['X-Gitlab-External-Storage-Token'] = token
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
......@@ -113,7 +113,7 @@ describe Projects::RawController do
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).to have_gitlab_http_status(429)
expect(response).to have_gitlab_http_status(:too_many_requests)
end
end
......@@ -125,7 +125,7 @@ describe Projects::RawController do
it 'does not prevent from accessing the raw file' do
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
......@@ -141,14 +141,14 @@ describe Projects::RawController do
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).to have_gitlab_http_status(429)
expect(response).to have_gitlab_http_status(:too_many_requests)
# Accessing upcase version of readme
file_path = "#{commit_sha}/README.md"
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
......@@ -166,7 +166,7 @@ describe Projects::RawController do
it 'redirects to sign in page' do
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')
end
end
......@@ -176,7 +176,7 @@ describe Projects::RawController do
it 'calls the action normally' do
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
......@@ -184,7 +184,7 @@ describe Projects::RawController do
it 'redirects to sign in page' do
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')
end
end
......@@ -196,7 +196,7 @@ describe Projects::RawController do
request.headers['X-Gitlab-Static-Object-Token'] = user.static_object_token
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
......@@ -205,7 +205,7 @@ describe Projects::RawController do
request.headers['X-Gitlab-Static-Object-Token'] = 'foobar'
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')
end
end
......
......@@ -45,7 +45,7 @@ describe Projects::RepositoriesController 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'
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:ref)).to eq('feature')
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end
......@@ -53,7 +53,7 @@ describe Projects::RepositoriesController 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'
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:ref)).to eq('feature')
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end
......@@ -61,7 +61,7 @@ describe Projects::RepositoriesController 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'
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:ref)).to eq('feature')
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end
......@@ -74,7 +74,7 @@ describe Projects::RepositoriesController do
it "renders Not Found" do
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
......@@ -82,7 +82,7 @@ describe Projects::RepositoriesController do
it 'sets appropriate caching headers' do
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['Cache-Control']).to include('max-age=60, private')
end
......@@ -93,7 +93,7 @@ describe Projects::RepositoriesController do
it 'sets appropriate caching headers' do
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['Cache-Control']).to include('max-age=60, public')
end
......@@ -103,7 +103,7 @@ describe Projects::RepositoriesController do
it 'max-age is set to 3600 in Cache-Control header' do
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')
end
end
......@@ -116,7 +116,7 @@ describe Projects::RepositoriesController do
request.headers['If-None-Match'] = response.headers['ETag']
get_archive
expect(response).to have_gitlab_http_status(304)
expect(response).to have_gitlab_http_status(:not_modified)
end
end
......@@ -137,7 +137,7 @@ describe Projects::RepositoriesController do
it 'redirects to sign in page' do
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
......@@ -146,7 +146,7 @@ describe Projects::RepositoriesController 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'
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -154,7 +154,7 @@ describe Projects::RepositoriesController do
it 'redirects to sign in page' do
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
......@@ -165,7 +165,7 @@ describe Projects::RepositoriesController do
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'
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -174,7 +174,7 @@ describe Projects::RepositoriesController do
request.headers['X-Gitlab-Static-Object-Token'] = 'foobar'
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
......
......@@ -30,7 +30,7 @@ describe Projects::RunnersController do
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)
end
end
......@@ -39,7 +39,7 @@ describe Projects::RunnersController do
it 'destroys the runner' do
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
end
end
......@@ -54,7 +54,7 @@ describe Projects::RunnersController do
runner.reload
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(runner.active).to eq(true)
end
end
......@@ -69,7 +69,7 @@ describe Projects::RunnersController do
runner.reload
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(runner.active).to eq(false)
end
end
......
......@@ -35,7 +35,7 @@ describe Projects::SnippetsController do
get :index, params: { namespace_id: project.namespace, project_id: project }
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
......@@ -48,7 +48,7 @@ describe Projects::SnippetsController do
get :index, params: { namespace_id: project.namespace, project_id: project }
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
......@@ -61,7 +61,7 @@ describe Projects::SnippetsController do
get :index, params: { namespace_id: project.namespace, project_id: project }
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
......@@ -318,7 +318,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do
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
......@@ -331,7 +331,7 @@ describe Projects::SnippetsController do
get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
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
......@@ -344,7 +344,7 @@ describe Projects::SnippetsController do
get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
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
......@@ -354,7 +354,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do
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
......@@ -366,7 +366,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do
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
......@@ -386,7 +386,7 @@ describe Projects::SnippetsController do
let(:snippet_permission) { :private }
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
......@@ -395,7 +395,7 @@ describe Projects::SnippetsController do
it 'responds with status 200' do
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
......@@ -407,7 +407,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do
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
......@@ -501,7 +501,7 @@ describe Projects::SnippetsController do
it 'responds with status 404' do
delete :destroy, params: params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -25,7 +25,7 @@ describe Projects::StagesController do
it 'returns not authorized' do
play_manual_stage!
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -110,7 +110,7 @@ describe Projects::TemplatesController do
it 'returns the template names' do
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[0]['name']).to eq(expected_template_name)
end
......@@ -121,7 +121,7 @@ describe Projects::TemplatesController do
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
......
......@@ -22,7 +22,7 @@ describe Projects::TodosController do
it "doesn't create todo" do
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
......
......@@ -85,7 +85,7 @@ describe Projects::TreeController do
context "valid SHA commit ID with path" do
let(:id) { '6d39438/.gitignore' }
it { expect(response).to have_gitlab_http_status(302) }
it { expect(response).to have_gitlab_http_status(:found) }
end
end
......
......@@ -49,7 +49,7 @@ describe Projects::UploadsController do
it "responds with status internal_server_error" do
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'))
end
end
......
......@@ -24,7 +24,7 @@ describe Projects::UsagePingController do
it 'returns 302' do
subject
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -32,7 +32,7 @@ describe Projects::UsagePingController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -57,7 +57,7 @@ describe Projects::UsagePingController do
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -25,7 +25,7 @@ describe Projects::WikisController do
it 'redirects to #show and appends a `random_title` param' do
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(
controller: 'projects/wikis',
action: 'show'
......@@ -70,7 +70,7 @@ describe Projects::WikisController do
end
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
......@@ -103,7 +103,7 @@ describe Projects::WikisController do
subject
expect(response).to have_http_status(:ok)
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:page).title).to eq(wiki_title)
end
......@@ -113,7 +113,7 @@ describe Projects::WikisController do
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.'))
end
end
......@@ -204,7 +204,7 @@ describe Projects::WikisController do
it 'shows the edit page' do
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'))
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