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