Commit e8d2c886 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

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

Add http status cop to all controller/support specs

See merge request gitlab-org/gitlab!24212
parents ba7c94de 2747e531
......@@ -334,17 +334,15 @@ RSpec/UnspecifiedException:
# Work in progress. See https://gitlab.com/gitlab-org/gitlab/issues/196163
RSpec/HaveGitlabHttpStatus:
Enabled: true
Exclude:
- 'spec/support/matchers/have_gitlab_http_status.rb'
Include:
- 'spec/support/shared_examples/**/*'
- 'ee/spec/support/shared_examples/**/*'
- 'spec/support/**/*'
- 'ee/spec/support/**/*'
- 'spec/features/**/*'
- 'ee/spec/features/**/*'
- 'spec/controllers/*.rb'
- 'ee/spec/controllers/*.rb'
- 'spec/controllers/projects/**/*.rb'
- 'ee/spec/controllers/projects/**/*.rb'
- 'spec/controllers/groups/**/*.rb'
- 'ee/spec/controllers/groups/**/*.rb'
- 'spec/controllers/**/*'
- 'ee/spec/controllers/**/*'
- 'spec/requests/*.rb'
- 'ee/spec/requests/*.rb'
......
......@@ -37,7 +37,7 @@ describe Admin::ClustersController do
it 'renders not found' do
get :prometheus_proxy, params: prometheus_proxy_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -51,7 +51,7 @@ describe Admin::ClustersController do
it 'renders not found' do
get :prometheus_proxy, params: prometheus_proxy_params
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -17,7 +17,7 @@ describe Admin::CredentialsController do
it 'responds with 200' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
describe 'filtering by type of credential' do
......@@ -69,7 +69,7 @@ describe Admin::CredentialsController do
it 'returns 404' do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -82,7 +82,7 @@ describe Admin::CredentialsController do
it 'returns 404' do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -11,7 +11,7 @@ describe Admin::DashboardController do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it "does not allow an auditor user to access the page" do
......@@ -19,7 +19,7 @@ describe Admin::DashboardController do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it "does not allow a regular user to access the page" do
......@@ -27,7 +27,7 @@ describe Admin::DashboardController do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'shows the license breakdown' do
......
......@@ -29,7 +29,7 @@ describe Admin::ElasticsearchController do
post :enqueue_index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -39,7 +39,7 @@ describe Admin::Geo::ProjectsController, :geo do
context 'without sync_status specified' do
it 'renders all template when no extra get params is specified' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(subject).to render_template(:index)
expect(subject).to render_template(partial: 'admin/geo/projects/_all')
end
......@@ -49,7 +49,7 @@ describe Admin::Geo::ProjectsController, :geo do
subject { get :index, params: { sync_status: 'pending' } }
it 'renders pending template' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(subject).to render_template(:index)
expect(subject).to render_template(partial: 'admin/geo/projects/_pending')
end
......@@ -59,7 +59,7 @@ describe Admin::Geo::ProjectsController, :geo do
subject { get :index, params: { sync_status: 'failed' } }
it 'renders failed template' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(subject).to render_template(:index)
expect(subject).to render_template(partial: 'admin/geo/projects/_failed')
end
......@@ -69,7 +69,7 @@ describe Admin::Geo::ProjectsController, :geo do
subject { get :index, params: { sync_status: 'never' } }
it 'renders failed template' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(subject).to render_template(:index)
expect(subject).to render_template(partial: 'admin/geo/projects/_never')
end
......@@ -79,7 +79,7 @@ describe Admin::Geo::ProjectsController, :geo do
subject { get :index, params: { sync_status: 'synced' } }
it 'renders synced template' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(subject).to render_template(:index)
expect(subject).to render_template(partial: 'admin/geo/projects/_synced')
end
......
......@@ -41,13 +41,13 @@ describe Admin::Geo::UploadsController, :geo do
end
it 'renders the index template' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(subject).to render_template(:index)
end
context 'without sync_status specified' do
it 'renders all registries' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(response.body).to have_css(css_id(synced_registry))
expect(response.body).to have_css(css_id(failed_registry))
expect(response.body).to have_css(css_id(never_registry))
......@@ -58,7 +58,7 @@ describe Admin::Geo::UploadsController, :geo do
subject { get :index, params: { sync_status: 'synced' } }
it 'renders only synced registries' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(response.body).to have_css(css_id(synced_registry))
expect(response.body).not_to have_css(css_id(failed_registry))
expect(response.body).not_to have_css(css_id(never_registry))
......@@ -69,7 +69,7 @@ describe Admin::Geo::UploadsController, :geo do
subject { get :index, params: { sync_status: 'failed' } }
it 'renders only failed registries' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(response.body).not_to have_css(css_id(synced_registry))
expect(response.body).to have_css(css_id(failed_registry))
expect(response.body).not_to have_css(css_id(never_registry))
......@@ -80,7 +80,7 @@ describe Admin::Geo::UploadsController, :geo do
subject { get :index, params: { sync_status: 'never' } }
it 'renders only never synced registries' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(response.body).not_to have_css(css_id(synced_registry))
expect(response.body).not_to have_css(css_id(failed_registry))
expect(response.body).to have_css(css_id(never_registry))
......
......@@ -18,7 +18,7 @@ describe Admin::ProjectsController, :geo do
render_views
it 'includes Geo Status widget partial' do
expect(subject).to have_gitlab_http_status(200)
expect(subject).to have_gitlab_http_status(:ok)
expect(subject.body).to match(project.name)
expect(subject).to render_template(partial: 'admin/projects/_geo_status_widget')
end
......
......@@ -34,7 +34,7 @@ describe Admin::PushRulesController do
it 'returns 404' do
patch :update, params: { push_rule: params }
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 Admin::PushRulesController do
it 'returns 200' do
get :show
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
context 'push rules unlicensed' do
......@@ -54,7 +54,7 @@ describe Admin::PushRulesController do
it 'returns 404' do
get :show
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -36,7 +36,7 @@ describe Analytics::AnalyticsController do
it 'renders 404 all the analytics feature flags are disabled' do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -33,7 +33,7 @@ describe Analytics::CycleAnalyticsController do
get :show
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 Analytics::ProductivityAnalyticsController do
subject
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'renders show template regardless of license' do
......@@ -61,7 +61,7 @@ describe Analytics::ProductivityAnalyticsController do
get :show
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -86,7 +86,7 @@ describe Analytics::ProductivityAnalyticsController do
subject
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
context 'when invalid params are given' do
......@@ -108,7 +108,7 @@ describe Analytics::ProductivityAnalyticsController do
it 'returns 403' do
subject
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -118,7 +118,7 @@ describe Analytics::ProductivityAnalyticsController 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
......@@ -128,7 +128,7 @@ describe Analytics::ProductivityAnalyticsController 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
......
......@@ -30,7 +30,7 @@ describe Boards::IssuesController do
it 'returns a not found 404 response' do
list_issues user: user, board: 999, list: list2
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -55,7 +55,7 @@ describe Boards::IssuesController do
it 'returns a not found 404 response' do
list_issues user: user, board: board, list: 999
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -83,7 +83,7 @@ describe Boards::IssuesController do
it 'returns a forbidden 403 response' do
list_issues user: user, board: board, list: list2
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -104,7 +104,7 @@ describe Boards::IssuesController do
it 'returns a successful 200 response' do
create_issue user: user, board: board, list: list1, title: 'New issue'
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the created issue' do
......@@ -119,7 +119,7 @@ describe Boards::IssuesController do
it 'returns an unprocessable entity 422 response' do
create_issue user: user, board: board, list: list1, title: nil
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......@@ -129,7 +129,7 @@ describe Boards::IssuesController do
create_issue user: user, board: board, list: list, title: 'New issue'
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -137,7 +137,7 @@ describe Boards::IssuesController do
it 'returns a not found 404 response' do
create_issue user: user, board: 999, list: list1, title: 'New issue'
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -145,7 +145,7 @@ describe Boards::IssuesController do
it 'returns a not found 404 response' do
create_issue user: user, board: board, list: 999, title: 'New issue'
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -154,7 +154,7 @@ describe Boards::IssuesController do
it 'returns a forbidden 403 response' do
create_issue user: guest, board: board, list: list1, title: 'New issue'
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -177,7 +177,7 @@ describe Boards::IssuesController do
it 'returns a successful 200 response' do
move user: user, board: board, issue: issue, from_list_id: list1.id, to_list_id: list2.id
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'moves issue to the desired list' do
......@@ -191,19 +191,19 @@ describe Boards::IssuesController do
it 'returns a unprocessable entity 422 response for invalid lists' do
move user: user, board: board, issue: issue, from_list_id: nil, to_list_id: nil
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 board id' do
move user: user, board: 999, issue: issue, from_list_id: list1.id, to_list_id: list2.id
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'returns a not found 404 response for invalid issue id' do
move user: user, board: board, issue: double(id: 999), from_list_id: list1.id, to_list_id: list2.id
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -217,7 +217,7 @@ describe Boards::IssuesController do
it 'returns a forbidden 403 response' do
move user: guest, board: board, issue: issue, from_list_id: list1.id, to_list_id: list2.id
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......
......@@ -17,7 +17,7 @@ describe Boards::ListsController do
it 'returns a successful 200 response' do
read_board_list user: user, board: board
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json'
end
......@@ -38,7 +38,7 @@ describe Boards::ListsController do
it 'returns a forbidden 403 response' do
read_board_list user: user, board: board
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -56,7 +56,7 @@ describe Boards::ListsController do
it 'returns a successful 200 response' do
create_board_list user: user, board: board, label_id: label.id
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the created list' do
......@@ -123,7 +123,7 @@ describe Boards::ListsController do
it 'returns a not found 404 response' do
create_board_list user: user, board: board, label_id: nil
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -133,7 +133,7 @@ describe Boards::ListsController do
create_board_list user: user, board: board, label_id: label.id
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -144,7 +144,7 @@ describe Boards::ListsController do
create_board_list user: guest, board: board, label_id: label.id
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -173,7 +173,7 @@ describe Boards::ListsController do
patch :update, params: params, as: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(development.reload.max_issue_count).to eq(42)
end
......@@ -184,7 +184,7 @@ describe Boards::ListsController do
patch :update, params: params, as: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(development.reload.max_issue_count).to eq(42)
expect(development.reload.max_issue_weight).to eq(22)
end
......@@ -196,7 +196,7 @@ describe Boards::ListsController do
patch :update, params: params, as: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(development.reload.max_issue_weight).to eq(42)
expect(development.reload.max_issue_count).to eq(22)
end
......@@ -208,7 +208,7 @@ describe Boards::ListsController do
patch :update, params: params, as: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
reloaded_list = development.reload
expect(reloaded_list.position).to eq(expected_position)
......@@ -305,7 +305,7 @@ describe Boards::ListsController do
patch :update, params: params, as: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(development.reload.max_issue_count).to eq(0)
end
......@@ -314,7 +314,7 @@ describe Boards::ListsController do
patch :update, params: params, as: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(development.reload.max_issue_weight).to eq(0)
end
......@@ -328,7 +328,7 @@ describe Boards::ListsController do
patch :update, params: params, as: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(development.reload.max_issue_count).to eq(0)
end
......@@ -337,7 +337,7 @@ describe Boards::ListsController do
patch :update, params: params, as: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(development.reload.max_issue_weight).to eq(0)
end
end
......@@ -364,7 +364,7 @@ describe Boards::ListsController do
it 'returns a successful 200 response' do
move user: user, board: board, list: planning, position: 1
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'moves the list to the desired position' do
......@@ -378,7 +378,7 @@ describe Boards::ListsController do
it 'returns an unprocessable entity 422 response' do
move user: user, board: board, list: planning, position: 6
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......@@ -386,7 +386,7 @@ describe Boards::ListsController do
it 'returns a not found 404 response' do
move user: user, board: board, list: 999, position: 1
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -394,7 +394,7 @@ describe Boards::ListsController do
it 'returns a 422 unprocessable entity response' do
move user: guest, board: board, list: planning, position: 6
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......@@ -418,7 +418,7 @@ describe Boards::ListsController do
it 'returns a successful 200 response' do
remove_board_list user: user, board: board, list: planning
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'removes list from board' do
......@@ -430,7 +430,7 @@ describe Boards::ListsController do
it 'returns a not found 404 response' do
remove_board_list user: user, board: board, list: 999
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -438,7 +438,7 @@ describe Boards::ListsController do
it 'returns a forbidden 403 response' do
remove_board_list user: guest, board: board, list: planning
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......
......@@ -20,7 +20,7 @@ describe Boards::MilestonesController do
it 'returns a list of all milestones of board parent' do
get :index, params: { board_id: board.to_param }, 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).to all(match_schema('entities/milestone', dir: 'ee'))
......@@ -54,7 +54,7 @@ describe Boards::MilestonesController do
it 'returns a forbidden 403 response' do
get :index, params: { board_id: board.to_param }, format: :json
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......
......@@ -24,7 +24,7 @@ describe Boards::UsersController do
},
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).to all(match_schema('entities/user'))
expect(json_response.length).to eq 2
......@@ -40,7 +40,7 @@ describe Boards::UsersController do
it 'returns a forbidden 403 response' do
get :index, params: { board_id: board.to_param }, format: :json
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......
......@@ -41,14 +41,14 @@ describe RoutableActions do
it 'redirects to group sign in page' do
get :show, params: request_params(routable)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response.location).to match(/groups\/.*\/-\/saml\/sso\?redirect=.+&token=/)
end
it 'does not redirect on POST requests' do
post :create, params: request_params(routable)
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -21,7 +21,7 @@ describe Dashboard::ProjectsController do
it 'renders the index template' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
end
......@@ -49,7 +49,7 @@ describe Dashboard::ProjectsController do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
end
......
......@@ -35,7 +35,7 @@ describe GroupsController do
it 'includes events from group and subgroups' do
get :activity, params: { id: group.to_param }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['count']).to eq(4)
end
end
......@@ -48,7 +48,7 @@ describe GroupsController do
it 'does not include events from group and subgroups' do
get :activity, params: { id: group.to_param }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['count']).to eq(1)
end
end
......@@ -62,7 +62,7 @@ describe GroupsController do
it 'includes only events visible to user' do
get :activity, params: { id: group.to_param }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['count']).to eq(2)
end
end
......@@ -130,7 +130,7 @@ describe GroupsController 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
......@@ -143,7 +143,7 @@ describe GroupsController 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
......@@ -230,7 +230,7 @@ describe GroupsController 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
......
......@@ -17,7 +17,7 @@ describe Projects::AutocompleteSourcesController do
it 'returns 404 status' do
get :epics, 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
......@@ -30,7 +30,7 @@ describe Projects::AutocompleteSourcesController do
it 'returns the correct response' do
get :epics, 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(json_response).to be_an(Array)
expect(json_response.count).to eq(1)
expect(json_response.first).to include(
......
......@@ -39,7 +39,7 @@ describe Projects::JobsController 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
......@@ -47,7 +47,7 @@ describe Projects::JobsController 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
......@@ -55,7 +55,7 @@ describe Projects::JobsController 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
......@@ -63,7 +63,7 @@ describe Projects::JobsController 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
......@@ -71,7 +71,7 @@ describe Projects::JobsController 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
......@@ -79,7 +79,7 @@ describe Projects::JobsController 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
......@@ -87,7 +87,7 @@ describe Projects::JobsController 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
......@@ -103,7 +103,7 @@ describe Projects::JobsController 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
......@@ -118,7 +118,7 @@ describe Projects::JobsController do
it 'returns the proxy data for the service running in the job' do
make_request
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(expected_data)
end
......@@ -130,7 +130,7 @@ describe Projects::JobsController do
it 'returns 404' do
make_request
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -153,7 +153,7 @@ describe Projects::JobsController do
make_request
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -26,7 +26,7 @@ describe SessionsController, :geo do
redirect_uri = URI.parse(response.location)
redirect_params = CGI.parse(redirect_uri.query)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to %r(\A#{Gitlab.config.gitlab.url}/oauth/geo/auth)
expect(redirect_params['state'].first).to end_with(':')
end
......
......@@ -20,7 +20,7 @@ describe Explore::OnboardingController do
it 'renders index with 200 status code and sets the session variable if the user is authenticated' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
expect(session[:onboarding_project]).to eq({ project_full_path: project.web_url, project_name: project.name })
end
......@@ -34,7 +34,7 @@ describe Explore::OnboardingController do
it 'returns 404' do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(session[:onboarding_project]).to be_nil
end
end
......
......@@ -12,7 +12,7 @@ describe JiraConnect::AppDescriptorController do
it 'returns 404' do
get :show
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -24,7 +24,7 @@ describe JiraConnect::AppDescriptorController do
it 'returns JSON app descriptor' do
get :show
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to include(
'baseUrl' => 'https://test.host/-/jira_connect',
'lifecycle' => {
......
......@@ -12,7 +12,7 @@ describe JiraConnect::EventsController do
it 'returns 404' do
post :installed
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -20,7 +20,7 @@ describe JiraConnect::EventsController do
it 'returns 404' do
post :uninstalled
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -58,7 +58,7 @@ describe JiraConnect::EventsController do
subject
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
end
......@@ -79,7 +79,7 @@ describe JiraConnect::EventsController do
it 'returns 403' do
subject
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'does not delete the installation' do
......
......@@ -12,7 +12,7 @@ describe JiraConnect::SubscriptionsController do
it 'returns 404' do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -20,7 +20,7 @@ describe JiraConnect::SubscriptionsController do
it '#create returns 404' do
post :create
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -30,7 +30,7 @@ describe JiraConnect::SubscriptionsController do
it '#destroy returns 404' do
delete :destroy, params: { id: subscription.id }
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 JiraConnect::SubscriptionsController do
let(:jwt) { nil }
it 'returns 403' do
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -60,7 +60,7 @@ describe JiraConnect::SubscriptionsController do
let(:jwt) { Atlassian::Jwt.encode({ iss: installation.client_key, qsh: qsh }, installation.shared_secret) }
it 'returns 200' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'removes X-Frame-Options to allow rendering in iframe' do
......@@ -88,7 +88,7 @@ describe JiraConnect::SubscriptionsController do
subject
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -112,7 +112,7 @@ describe JiraConnect::SubscriptionsController do
it 'returns 200' do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -124,7 +124,7 @@ describe JiraConnect::SubscriptionsController do
it 'returns 422' do
subject
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
end
......@@ -133,7 +133,7 @@ describe JiraConnect::SubscriptionsController do
it 'returns 401' do
subject
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
......@@ -150,7 +150,7 @@ describe JiraConnect::SubscriptionsController do
let(:jwt) { nil }
it 'returns 403' do
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -159,7 +159,7 @@ describe JiraConnect::SubscriptionsController do
it 'deletes the subscription' do
expect { subscription.reload }.to raise_error ActiveRecord::RecordNotFound
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -17,7 +17,7 @@ describe Profiles::BillingsController do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
......
......@@ -26,7 +26,7 @@ describe Security::ProjectsController do
get :index
aggregate_failures 'expect successful response containing the project with a remove path' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['projects'].count).to be(1)
dashboard_project = json_response['projects'].first
......@@ -38,7 +38,7 @@ describe Security::ProjectsController do
it 'sets a polling interval header' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.headers['Poll-Interval']).to eq('120000')
end
end
......@@ -67,7 +67,7 @@ describe Security::ProjectsController do
subject
aggregate_failures 'expect successful response and project added to dashboard' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(user.reload.security_dashboard_projects).to contain_exactly(project)
expect(json_response).to eq({
'added' => [project.id],
......@@ -84,7 +84,7 @@ describe Security::ProjectsController do
subject
aggregate_failures 'expect successful response and no duplicate project added to dashboard' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(user.reload.security_dashboard_projects.count).to be(1)
expect(json_response).to eq({
'added' => [],
......@@ -102,7 +102,7 @@ describe Security::ProjectsController do
subject
aggregate_failures 'expect successful response and no project added to dashboard' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(user.reload.security_dashboard_projects).to be_empty
expect(json_response).to eq({
'added' => [],
......@@ -124,7 +124,7 @@ describe Security::ProjectsController do
post :create, params: { project_ids: [project.id] }
aggregate_failures 'expect successful response and project added to dashboard' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(auditor.reload.security_dashboard_projects).to contain_exactly(project)
end
end
......@@ -167,7 +167,7 @@ describe Security::ProjectsController do
subject
aggregate_failures 'expect successful response and project removed from dashboard' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(user.reload.security_dashboard_projects).to be_empty
end
end
......@@ -176,7 +176,7 @@ describe Security::ProjectsController do
it 'does nothing and returns 204' do
delete :destroy, params: { id: -1 }
expect(response).to have_gitlab_http_status(204)
expect(response).to have_gitlab_http_status(:no_content)
end
end
end
......
......@@ -16,7 +16,7 @@ describe Admin::ApplicationsController do
it 'renders the application form' do
get :index
expect(response).to have_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......
......@@ -36,7 +36,7 @@ describe Admin::Clusters::ApplicationsController do
expect(ClusterInstallAppWorker).to receive(:perform_async).with(application, anything).once
expect { subject }.to change { current_application.count }
expect(response).to have_http_status(:no_content)
expect(response).to have_gitlab_http_status(:no_content)
expect(cluster.application_helm).to be_scheduled
end
......@@ -47,7 +47,7 @@ describe Admin::Clusters::ApplicationsController do
it 'return 404' do
expect { subject }.not_to change { current_application.count }
expect(response).to have_http_status(:not_found)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -55,7 +55,7 @@ describe Admin::Clusters::ApplicationsController do
let(:application) { 'unkwnown-app' }
it 'return 404' do
is_expected.to have_http_status(:not_found)
is_expected.to have_gitlab_http_status(:not_found)
end
end
......@@ -65,7 +65,7 @@ describe Admin::Clusters::ApplicationsController do
end
it 'returns 400' do
is_expected.to have_http_status(:bad_request)
is_expected.to have_gitlab_http_status(:bad_request)
end
end
end
......@@ -99,7 +99,7 @@ describe Admin::Clusters::ApplicationsController do
it "schedules an application update" do
expect(ClusterPatchAppWorker).to receive(:perform_async).with(application.name, anything).once
is_expected.to have_http_status(:no_content)
is_expected.to have_gitlab_http_status(:no_content)
expect(cluster.application_cert_manager).to be_scheduled
end
......@@ -110,13 +110,13 @@ describe Admin::Clusters::ApplicationsController do
cluster.destroy!
end
it { is_expected.to have_http_status(:not_found) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'when application is unknown' do
let(:application_name) { 'unkwnown-app' }
it { is_expected.to have_http_status(:not_found) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'when application is already scheduled' do
......@@ -124,7 +124,7 @@ describe Admin::Clusters::ApplicationsController do
application.make_scheduled!
end
it { is_expected.to have_http_status(:bad_request) }
it { is_expected.to have_gitlab_http_status(:bad_request) }
end
end
......
......@@ -567,7 +567,7 @@ describe Admin::ClustersController do
put_update(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
......@@ -587,7 +587,7 @@ describe Admin::ClustersController do
it 'rejects changes' do
put_update(format: :json)
expect(response).to have_http_status(:bad_request)
expect(response).to have_gitlab_http_status(:bad_request)
end
end
end
......
......@@ -11,7 +11,7 @@ describe Admin::GitalyServersController do
it 'shows the gitaly servers page' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -24,7 +24,7 @@ describe Admin::HooksController do
post :create, params: { hook: hook_params }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(SystemHook.all.size).to eq(1)
expect(SystemHook.first).to have_attributes(hook_params)
end
......
......@@ -24,7 +24,7 @@ describe Admin::ImpersonationsController do
it "responds with status 404" do
delete :destroy
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it "doesn't sign us in" do
......@@ -48,7 +48,7 @@ describe Admin::ImpersonationsController do
it "responds with status 404" do
delete :destroy
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it "doesn't sign us in as the impersonator" do
......@@ -67,7 +67,7 @@ describe Admin::ImpersonationsController do
it "responds with status 404" do
delete :destroy
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it "doesn't sign us in as the impersonator" do
......
......@@ -29,7 +29,7 @@ describe Admin::ProjectsController do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).not_to match(pending_delete_project.name)
expect(response.body).to match(project.name)
end
......@@ -61,7 +61,7 @@ describe Admin::ProjectsController do
it 'renders show page' do
get :show, params: { namespace_id: project.namespace.path, id: project.path }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to match(project.name)
end
end
......
......@@ -36,7 +36,7 @@ describe Admin::RequestsProfilesController do
it 'renders the data' do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to eq(sample_data)
end
end
......@@ -54,7 +54,7 @@ describe Admin::RequestsProfilesController do
it 'renders the data' do
subject
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to eq(sample_data)
end
end
......
......@@ -15,7 +15,7 @@ describe Admin::RunnersController do
it 'lists all runners' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'avoids N+1 queries', :request_store do
......@@ -29,7 +29,7 @@ describe Admin::RunnersController do
# We also need to add 1 because it takes 2 queries to preload tags
expect { get :index }.not_to exceed_query_limit(control_count + 6)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to have_content('tag1')
expect(response.body).to have_content('tag2')
end
......@@ -49,13 +49,13 @@ describe Admin::RunnersController do
it 'shows a particular runner' do
get :show, params: { id: runner.id }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'shows 404 for unknown runner' do
get :show, params: { id: 0 }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'avoids N+1 queries', :request_store do
......@@ -70,7 +70,7 @@ describe Admin::RunnersController do
# needs_new_sso_session permission
expect { get :show, params: { id: runner.id } }.not_to exceed_query_limit(control_count + 1)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -84,7 +84,7 @@ describe Admin::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
......@@ -93,7 +93,7 @@ describe Admin::RunnersController do
it 'destroys the runner' do
delete :destroy, params: { id: runner.id }
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
......@@ -108,7 +108,7 @@ describe Admin::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
......@@ -123,7 +123,7 @@ describe Admin::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
......
......@@ -22,7 +22,7 @@ describe Admin::ServicesController do
it 'successfully displays the template' do
get :edit, params: { id: service.id }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -48,7 +48,7 @@ describe Admin::ServicesController do
put :update, params: { id: service.id, service: { active: true } }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'does not call the propagation worker when service is not active' do
......@@ -56,7 +56,7 @@ describe Admin::ServicesController do
put :update, params: { id: service.id, service: { properties: {} } }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......@@ -124,7 +124,7 @@ describe Admin::SessionsController, :do_not_mock_admin_mode do
it 'shows error page' do
post :destroy
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(controller.current_user_mode.admin_mode?).to be(false)
end
end
......
......@@ -16,7 +16,7 @@ describe Admin::SpamLogsController do
it 'lists all spam logs' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -24,14 +24,14 @@ describe Admin::SpamLogsController do
it 'removes only the spam log when removing log' do
expect { delete :destroy, params: { id: first_spam.id } }.to change { SpamLog.count }.by(-1)
expect(User.find(user.id)).to be_truthy
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'removes user and his spam logs when removing the user', :sidekiq_might_not_need_inline do
delete :destroy, params: { id: first_spam.id, remove_user: true }
expect(flash[:notice]).to eq "User #{user.username} was successfully removed."
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(SpamLog.count).to eq(0)
expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound)
end
......@@ -46,7 +46,7 @@ describe Admin::SpamLogsController do
it 'submits the log as ham' do
post :mark_as_ham, params: { id: first_spam.id }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(SpamLog.find(first_spam.id).submitted_as_ham).to be_truthy
end
end
......
......@@ -47,7 +47,7 @@ describe Admin::UsersController do
it 'deletes user and ghosts their contributions' do
delete :destroy, params: { id: user.username }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(User.exists?(user.id)).to be_falsy
expect(issue.reload.author).to be_ghost
end
......@@ -55,7 +55,7 @@ describe Admin::UsersController do
it 'deletes the user and their contributions when hard delete is specified' do
delete :destroy, params: { id: user.username, hard_delete: true }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(User.exists?(user.id)).to be_falsy
expect(Issue.exists?(issue.id)).to be_falsy
end
......@@ -399,7 +399,7 @@ describe Admin::UsersController do
it "shows error page" do
post :impersonate, params: { id: user.username }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -28,7 +28,7 @@ describe Boards::IssuesController do
it 'returns a not found 404 response' do
list_issues user: user, board: 999, list: list2
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -106,7 +106,7 @@ describe Boards::IssuesController do
it 'returns a not found 404 response' do
list_issues user: user, board: board, list: 999
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -132,7 +132,7 @@ describe Boards::IssuesController do
it 'returns a forbidden 403 response' do
list_issues user: unauth_user, board: board, list: list2
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -148,7 +148,7 @@ describe Boards::IssuesController do
list_issues(user: user, board: group_board)
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'is successful for project boards' do
......@@ -156,7 +156,7 @@ describe Boards::IssuesController do
list_issues(user: user, board: project_board)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -215,7 +215,7 @@ describe Boards::IssuesController do
expect(response).to have_gitlab_http_status(expected_status)
list_issues user: requesting_user, board: board, list: list2
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('entities/issue_boards')
......@@ -391,7 +391,7 @@ describe Boards::IssuesController do
it 'returns a successful 200 response' do
create_issue user: user, board: board, list: list1, title: 'New issue'
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the created issue' do
......@@ -406,7 +406,7 @@ describe Boards::IssuesController do
it 'returns an unprocessable entity 422 response' do
create_issue user: user, board: board, list: list1, title: nil
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......@@ -416,7 +416,7 @@ describe Boards::IssuesController do
create_issue user: user, board: board, list: list, title: 'New issue'
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -424,7 +424,7 @@ describe Boards::IssuesController do
it 'returns a not found 404 response' do
create_issue user: user, board: 999, list: list1, title: 'New issue'
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -432,7 +432,7 @@ describe Boards::IssuesController do
it 'returns a not found 404 response' do
create_issue user: user, board: board, list: 999, title: 'New issue'
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -443,7 +443,7 @@ describe Boards::IssuesController do
open_list = board.lists.create(list_type: :backlog)
create_issue user: guest, board: board, list: open_list, title: 'New issue'
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -451,7 +451,7 @@ describe Boards::IssuesController do
it 'returns a forbidden 403 response' do
create_issue user: guest, board: board, list: list1, title: 'New issue'
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
......@@ -475,7 +475,7 @@ describe Boards::IssuesController do
it 'returns a successful 200 response' do
move user: user, board: board, issue: issue, from_list_id: list1.id, to_list_id: list2.id
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'moves issue to the desired list' do
......@@ -489,19 +489,19 @@ describe Boards::IssuesController do
it 'returns a unprocessable entity 422 response for invalid lists' do
move user: user, board: board, issue: issue, from_list_id: nil, to_list_id: nil
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 board id' do
move user: user, board: 999, issue: issue, from_list_id: list1.id, to_list_id: list2.id
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'returns a not found 404 response for invalid issue id' do
move user: user, board: board, issue: double(id: 999), from_list_id: list1.id, to_list_id: list2.id
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -515,7 +515,7 @@ describe Boards::IssuesController do
it 'returns a forbidden 403 response' do
move user: guest, board: board, issue: issue, from_list_id: list1.id, to_list_id: list2.id
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......
......@@ -21,7 +21,7 @@ describe Boards::ListsController do
it 'returns a successful 200 response' do
read_board_list user: user, board: board
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json'
end
......@@ -50,7 +50,7 @@ describe Boards::ListsController do
it 'returns a forbidden 403 response' do
read_board_list user: unauth_user, board: board
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -73,7 +73,7 @@ describe Boards::ListsController do
it 'returns a successful 200 response' do
create_board_list user: user, board: board, label_id: label.id
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the created list' do
......@@ -88,7 +88,7 @@ describe Boards::ListsController do
it 'returns a not found 404 response' do
create_board_list user: user, board: board, label_id: nil
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -98,7 +98,7 @@ describe Boards::ListsController do
create_board_list user: user, board: board, label_id: label.id
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -109,7 +109,7 @@ describe Boards::ListsController do
create_board_list user: guest, board: board, label_id: label.id
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -134,7 +134,7 @@ describe Boards::ListsController do
it 'returns a successful 200 response' do
move user: user, board: board, list: planning, position: 1
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'moves the list to the desired position' do
......@@ -148,7 +148,7 @@ describe Boards::ListsController do
it 'returns an unprocessable entity 422 response' do
move user: user, board: board, list: planning, position: 6
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......@@ -156,7 +156,7 @@ describe Boards::ListsController do
it 'returns a not found 404 response' do
move user: user, board: board, list: 999, position: 1
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -164,7 +164,7 @@ describe Boards::ListsController do
it 'returns a 422 unprocessable entity response' do
move user: guest, board: board, list: planning, position: 6
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......@@ -173,14 +173,14 @@ describe Boards::ListsController do
save_setting user: user, board: board, list: planning, setting: { collapsed: true }
expect(planning.preferences_for(user).collapsed).to eq(true)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'saves not collapsed preference for user' do
save_setting user: user, board: board, list: planning, setting: { collapsed: false }
expect(planning.preferences_for(user).collapsed).to eq(false)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -191,14 +191,14 @@ describe Boards::ListsController do
save_setting user: user, board: board, list: closed, setting: { collapsed: true }
expect(closed.preferences_for(user).collapsed).to eq(true)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'saves not collapsed preference for user' do
save_setting user: user, board: board, list: closed, setting: { collapsed: false }
expect(closed.preferences_for(user).collapsed).to eq(false)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -236,7 +236,7 @@ describe Boards::ListsController do
it 'returns a successful 200 response' do
remove_board_list user: user, board: board, list: planning
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'removes list from board' do
......@@ -248,7 +248,7 @@ describe Boards::ListsController do
it 'returns a not found 404 response' do
remove_board_list user: user, board: board, list: 999
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -256,7 +256,7 @@ describe Boards::ListsController do
it 'returns a forbidden 403 response' do
remove_board_list user: guest, board: board, list: planning
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -278,7 +278,7 @@ describe Boards::ListsController do
it 'returns a successful 200 response' do
generate_default_lists user: user, board: board
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns the defaults lists' do
......@@ -294,7 +294,7 @@ describe Boards::ListsController do
generate_default_lists user: user, board: board
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......@@ -302,7 +302,7 @@ describe Boards::ListsController do
it 'returns a forbidden 403 response' do
generate_default_lists user: guest, board: board
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......
......@@ -51,7 +51,7 @@ describe ControllerWithCrossProjectAccessCheck do
get :index
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to match(/#{message}/)
end
......@@ -60,7 +60,7 @@ describe ControllerWithCrossProjectAccessCheck do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'is skipped when the `unless` condition returns true' do
......@@ -68,13 +68,13 @@ describe ControllerWithCrossProjectAccessCheck do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'correctly renders an action that does not require cross project access' do
get :show, params: { id: 'nothing' }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -113,7 +113,7 @@ describe ControllerWithCrossProjectAccessCheck do
it 'renders a success when the check is skipped' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'is executed when the `if` condition returns false' do
......@@ -121,7 +121,7 @@ describe ControllerWithCrossProjectAccessCheck do
get :index
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'is executed when the `unless` condition returns true' do
......@@ -129,19 +129,19 @@ describe ControllerWithCrossProjectAccessCheck do
get :index
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'does not skip the check on an action that is not skipped' do
get :show, params: { id: 'hello' }
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'does not skip the check on an action that was not defined to skip' do
get :edit, params: { id: 'hello' }
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
......
......@@ -39,7 +39,7 @@ describe EnforcesAdminAuthentication, :do_not_mock_admin_mode do
it 'renders ok' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -48,7 +48,7 @@ describe EnforcesAdminAuthentication, :do_not_mock_admin_mode do
it 'renders a 404' do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not set admin mode' do
......@@ -75,7 +75,7 @@ describe EnforcesAdminAuthentication, :do_not_mock_admin_mode do
let(:user) { create(:admin) }
it 'allows direct access to page' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'does not set admin mode' do
......@@ -85,7 +85,7 @@ describe EnforcesAdminAuthentication, :do_not_mock_admin_mode do
context 'as a user' do
it 'renders a 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'does not set admin mode' do
......
......@@ -30,7 +30,7 @@ describe ProjectUnauthorized do
get :show, params: { namespace_id: project.namespace.to_param, id: project.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'renders a 403 when the service denies access to the project' do
......@@ -38,7 +38,7 @@ describe ProjectUnauthorized do
get :show, params: { namespace_id: project.namespace.to_param, id: project.to_param }
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to match("External authorization denied access to this project")
end
......@@ -47,7 +47,7 @@ describe ProjectUnauthorized do
get :show, params: { namespace_id: other_project.namespace.to_param, id: other_project.to_param }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -47,14 +47,14 @@ describe RoutableActions do
it 'allows access' do
get_routable(routable)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
it 'prevents access when not authorized' do
get_routable(routable)
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -75,14 +75,14 @@ describe RoutableActions do
it 'allows access' do
get_routable(routable)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
it 'prevents access when not authorized' do
get_routable(routable)
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -92,7 +92,7 @@ describe RoutableActions do
it 'allows access when authorized' do
get_routable(routable)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'prevents access when unauthorized' do
......@@ -100,7 +100,7 @@ describe RoutableActions do
get_routable(user)
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -111,7 +111,7 @@ describe RoutableActions do
get_routable(routable)
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
......
......@@ -27,7 +27,7 @@ describe StaticObjectExternalStorage do
do_request
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -75,7 +75,7 @@ describe StaticObjectExternalStorage do
request.headers['X-Gitlab-External-Storage-Token'] = 'letmein'
do_request
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -84,7 +84,7 @@ describe StaticObjectExternalStorage do
request.headers['X-Gitlab-External-Storage-Token'] = 'donotletmein'
do_request
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
......
......@@ -40,7 +40,7 @@ describe Dashboard::GroupsController do
it 'renders only groups the user is a member of when searching hierarchy correctly' do
get :index, params: { filter: 'chef' }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
all_groups = [top_level_result, top_level_a, sub_level_result_a]
expect(assigns(:groups)).to contain_exactly(*all_groups)
end
......@@ -51,7 +51,7 @@ describe Dashboard::GroupsController do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -40,7 +40,7 @@ describe Dashboard::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)
end
end
......@@ -55,7 +55,7 @@ describe Dashboard::MilestonesController do
it 'returns group and project milestones to which the user belongs' do
get :index, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response.size).to eq(2)
expect(json_response.map { |i| i["name"] }).to match_array([group_milestone.name, project_milestone.name])
expect(json_response.map { |i| i["group_name"] }.compact).to match_array(group.name)
......@@ -64,7 +64,7 @@ describe Dashboard::MilestonesController do
it 'returns closed group and project milestones to which the user belongs' do
get :index, params: { state: 'closed' }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response.size).to eq(2)
expect(json_response.map { |i| i["name"] }).to match_array([closed_group_milestone.name, closed_project_milestone.name])
expect(json_response.map { |i| i["group_name"] }.compact).to match_array(group.name)
......
......@@ -23,7 +23,7 @@ describe Dashboard::ProjectsController do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......
......@@ -20,19 +20,19 @@ describe Dashboard::TodosController do
get :index, params: { project_id: unauthorized_project.id }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'renders 404 when given project does not exists' do
get :index, params: { project_id: 999 }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'renders 200 when filtering for "any project" todos' do
get :index, params: { project_id: '' }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'renders 200 when user has access on given project' do
......@@ -40,7 +40,7 @@ describe Dashboard::TodosController do
get :index, params: { project_id: authorized_project.id }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -78,7 +78,7 @@ describe Dashboard::TodosController do
get :index, params: { group_id: unauthorized_group.id }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -130,7 +130,7 @@ describe Dashboard::TodosController do
patch :restore, params: { id: todo.id }
expect(todo.reload).to be_pending
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq({ "count" => 1, "done_count" => 0 })
end
end
......@@ -144,7 +144,7 @@ describe Dashboard::TodosController do
todos.each do |todo|
expect(todo.reload).to be_pending
end
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq({ 'count' => 2, 'done_count' => 0 })
end
end
......
......@@ -23,7 +23,7 @@ describe GoogleApi::AuthorizationsController do
subject
expect(session[GoogleApi::CloudPlatform::Client.session_key_for_token]).to be_nil
expect(response).to have_http_status(:not_found)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......
......@@ -123,7 +123,7 @@ describe Import::BitbucketController do
post :create, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns 422 response when the project could not be imported' do
......@@ -133,7 +133,7 @@ describe Import::BitbucketController do
post :create, format: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
it_behaves_like 'project import rate limiter'
......@@ -330,7 +330,7 @@ describe Import::BitbucketController do
post :create, params: { target_namespace: other_namespace.name }, format: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
end
......
......@@ -48,7 +48,7 @@ describe Import::BitbucketServerController do
post :create, params: { project: project_key, repository: repo_slug }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
context 'with project key with tildes' do
......@@ -61,20 +61,20 @@ describe Import::BitbucketServerController do
post :create, params: { project: project_key, repository: repo_slug, format: :json }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
it 'returns an error when an invalid project key is used' do
post :create, params: { project: 'some&project' }
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
it 'returns an error when an invalid repository slug is used' do
post :create, params: { project: 'some-project', repository: 'try*this' }
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
it 'returns an error when the project cannot be found' do
......@@ -82,7 +82,7 @@ describe Import::BitbucketServerController do
post :create, params: { project: project_key, repository: repo_slug }, format: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
it 'returns an error when the project cannot be saved' do
......@@ -92,7 +92,7 @@ describe Import::BitbucketServerController do
post :create, params: { project: project_key, repository: repo_slug }, format: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
it "returns an error when the server can't be contacted" do
......@@ -100,7 +100,7 @@ describe Import::BitbucketServerController do
post :create, params: { project: project_key, repository: repo_slug }, format: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
it_behaves_like 'project import rate limiter'
......@@ -118,7 +118,7 @@ describe Import::BitbucketServerController do
expect(session[:bitbucket_server_username]).to be_nil
expect(session[:bitbucket_server_personal_access_token]).to be_nil
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(status_import_bitbucket_server_path)
end
......@@ -128,7 +128,7 @@ describe Import::BitbucketServerController do
expect(session[:bitbucket_server_url]).to eq(url)
expect(session[:bitbucket_server_username]).to eq(username)
expect(session[:bitbucket_server_personal_access_token]).to eq(token)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(status_import_bitbucket_server_path)
end
end
......
......@@ -22,7 +22,7 @@ describe Import::GithubController do
get :new
expect(response).to have_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it "prompts for an access token if GitHub not configured" do
......@@ -31,7 +31,7 @@ describe Import::GithubController do
get :new
expect(response).to have_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
context 'when importing a CI/CD project' do
......
......@@ -86,7 +86,7 @@ describe Import::GitlabController do
post :create, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns 422 response when the project could not be imported' do
......@@ -96,7 +96,7 @@ describe Import::GitlabController do
post :create, format: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
context "when the repository owner is the GitLab.com user" do
......@@ -279,7 +279,7 @@ describe Import::GitlabController do
post :create, params: { target_namespace: other_namespace.name }, format: :json
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
......
......@@ -17,14 +17,14 @@ describe Import::GitlabProjectsController do
post :create, params: { namespace_id: namespace.id, path: '/test', file: file }
expect(flash[:alert]).to start_with('Project could not be imported')
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'redirects with an error when a relative path is used' do
post :create, params: { namespace_id: namespace.id, path: '../test', file: file }
expect(flash[:alert]).to start_with('Project could not be imported')
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -33,7 +33,7 @@ describe Import::GitlabProjectsController do
post :create, params: { namespace_id: namespace.id, path: 'test', file: file }
expect(flash[:notice]).to include('is being imported')
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......
......@@ -18,7 +18,7 @@ describe Import::PhabricatorController do
stub_application_setting(import_sources: [])
end
it { is_expected.to have_gitlab_http_status(404) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'when the feature is disabled' do
......@@ -27,7 +27,7 @@ describe Import::PhabricatorController do
stub_application_setting(import_sources: ['phabricator'])
end
it { is_expected.to have_gitlab_http_status(404) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'when the import is available' do
......@@ -36,7 +36,7 @@ describe Import::PhabricatorController do
stub_application_setting(import_sources: ['phabricator'])
end
it { is_expected.to have_gitlab_http_status(200) }
it { is_expected.to have_gitlab_http_status(:ok) }
end
end
......
......@@ -14,7 +14,7 @@ describe Oauth::ApplicationsController do
it 'shows list of applications' do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'redirects back to profile page if OAuth applications are disabled' do
......@@ -22,7 +22,7 @@ describe Oauth::ApplicationsController do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -30,7 +30,7 @@ describe Oauth::ApplicationsController do
it 'creates an application' do
post :create, params: oauth_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last))
end
......@@ -39,7 +39,7 @@ describe Oauth::ApplicationsController do
post :create, params: oauth_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(profile_path)
end
......
......@@ -23,7 +23,7 @@ describe Oauth::AuthorizationsController do
it 'returns 200 code and renders error view' do
get :new
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('doorkeeper/authorizations/error')
end
end
......@@ -34,7 +34,7 @@ describe Oauth::AuthorizationsController do
it 'returns 200 code and renders view' do
get :new, params: params
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('doorkeeper/authorizations/new')
end
......@@ -45,7 +45,7 @@ describe Oauth::AuthorizationsController do
get :new, params: params
expect(request.session['user_return_to']).to be_nil
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
context 'when there is already an access token for the application' do
......@@ -62,7 +62,7 @@ describe Oauth::AuthorizationsController do
get :new, params: params
expect(request.session['user_return_to']).to be_nil
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......
......@@ -13,7 +13,7 @@ describe Profiles::AccountsController do
it 'renders 404 if someone tries to unlink a non existent provider' do
delete :unlink, params: { provider: 'github' }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
[:saml, :cas3].each do |provider|
......@@ -25,7 +25,7 @@ describe Profiles::AccountsController do
delete :unlink, params: { provider: provider.to_s }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(user.reload.identities).to include(identity)
end
end
......@@ -40,7 +40,7 @@ describe Profiles::AccountsController do
delete :unlink, params: { provider: provider.to_s }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(user.reload.identities).not_to include(identity)
end
end
......
......@@ -22,7 +22,7 @@ describe Snippets::NotesController do
end
it "returns status 200" do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it "returns not empty array of notes" do
......@@ -39,7 +39,7 @@ describe Snippets::NotesController do
it "returns status 404" do
get :index, params: { snippet_id: internal_snippet }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -51,7 +51,7 @@ describe Snippets::NotesController do
it "returns status 200" do
get :index, params: { snippet_id: internal_snippet }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -65,7 +65,7 @@ describe Snippets::NotesController do
it "returns status 404" do
get :index, params: { snippet_id: private_snippet }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -77,7 +77,7 @@ describe Snippets::NotesController do
it "returns status 404" do
get :index, params: { snippet_id: private_snippet }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -91,7 +91,7 @@ describe Snippets::NotesController do
it "returns status 200" do
get :index, params: { snippet_id: private_snippet }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it "returns 1 note" do
......@@ -135,7 +135,7 @@ describe Snippets::NotesController do
it 'returns status 302' do
post :create, params: request_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'creates the note' do
......@@ -158,7 +158,7 @@ describe Snippets::NotesController do
it 'returns status 302' do
post :create, params: request_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'creates the note' do
......@@ -186,7 +186,7 @@ describe Snippets::NotesController do
it 'returns status 404' 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 the note' do
......@@ -204,7 +204,7 @@ describe Snippets::NotesController do
it 'returns status 302' do
post :create, params: request_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'creates the note on the public snippet' do
......@@ -222,7 +222,7 @@ describe Snippets::NotesController do
it 'returns status 302' do
post :create, params: request_params
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'creates the note' do
......@@ -249,7 +249,7 @@ describe Snippets::NotesController do
it "returns status 200" 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
......@@ -277,7 +277,7 @@ describe Snippets::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
it "does not update the note" do
......@@ -299,7 +299,7 @@ describe Snippets::NotesController do
it "toggles the award emoji" do
expect { subject }.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 when it exists" do
......@@ -307,7 +307,7 @@ describe Snippets::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
end
end
......@@ -16,7 +16,7 @@ shared_examples 'project import rate limiter' do
post :create, params: {}
expect(flash[:alert]).to eq('This endpoint has been requested too many times. Try again later.')
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......@@ -41,7 +41,7 @@ module ApiHelpers
end
def expect_paginated_array_response(items)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.map { |item| item['id'] }).to eq(Array(items))
......
......@@ -28,6 +28,6 @@ module RackAttackSpecHelpers
def expect_rejection(&block)
yield
expect(response).to have_http_status(429)
expect(response).to have_gitlab_http_status(:too_many_requests)
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