diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-06 18:08:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-06 18:08:54 +0000 |
commit | 0d6fa033121a9bef708b8f2de186c4034c61d4a3 (patch) | |
tree | 851d65a09efbffa114c9a273e590d55cfb1436ab /spec/controllers | |
parent | 0eb3d2f799ce4f4de87fb9fc6fd98e592323bc89 (diff) | |
download | gitlab-ce-0d6fa033121a9bef708b8f2de186c4034c61d4a3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
36 files changed, 169 insertions, 169 deletions
diff --git a/spec/controllers/admin/applications_controller_spec.rb b/spec/controllers/admin/applications_controller_spec.rb index 63b28b2d993..163a2033b58 100644 --- a/spec/controllers/admin/applications_controller_spec.rb +++ b/spec/controllers/admin/applications_controller_spec.rb @@ -16,7 +16,7 @@ describe Admin::ApplicationsController do it 'renders the application form' do get :index - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end diff --git a/spec/controllers/admin/clusters/applications_controller_spec.rb b/spec/controllers/admin/clusters/applications_controller_spec.rb index 9d6edcd80c0..44693505c4f 100644 --- a/spec/controllers/admin/clusters/applications_controller_spec.rb +++ b/spec/controllers/admin/clusters/applications_controller_spec.rb @@ -36,7 +36,7 @@ describe Admin::Clusters::ApplicationsController do expect(ClusterInstallAppWorker).to receive(:perform_async).with(application, anything).once expect { subject }.to change { current_application.count } - expect(response).to have_http_status(:no_content) + expect(response).to have_gitlab_http_status(:no_content) expect(cluster.application_helm).to be_scheduled end @@ -47,7 +47,7 @@ describe Admin::Clusters::ApplicationsController do it 'return 404' do expect { subject }.not_to change { current_application.count } - expect(response).to have_http_status(:not_found) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -55,7 +55,7 @@ describe Admin::Clusters::ApplicationsController do let(:application) { 'unkwnown-app' } it 'return 404' do - is_expected.to have_http_status(:not_found) + is_expected.to have_gitlab_http_status(:not_found) end end @@ -65,7 +65,7 @@ describe Admin::Clusters::ApplicationsController do end it 'returns 400' do - is_expected.to have_http_status(:bad_request) + is_expected.to have_gitlab_http_status(:bad_request) end end end @@ -99,7 +99,7 @@ describe Admin::Clusters::ApplicationsController do it "schedules an application update" do expect(ClusterPatchAppWorker).to receive(:perform_async).with(application.name, anything).once - is_expected.to have_http_status(:no_content) + is_expected.to have_gitlab_http_status(:no_content) expect(cluster.application_cert_manager).to be_scheduled end @@ -110,13 +110,13 @@ describe Admin::Clusters::ApplicationsController do cluster.destroy! end - it { is_expected.to have_http_status(:not_found) } + it { is_expected.to have_gitlab_http_status(:not_found) } end context 'when application is unknown' do let(:application_name) { 'unkwnown-app' } - it { is_expected.to have_http_status(:not_found) } + it { is_expected.to have_gitlab_http_status(:not_found) } end context 'when application is already scheduled' do @@ -124,7 +124,7 @@ describe Admin::Clusters::ApplicationsController do application.make_scheduled! end - it { is_expected.to have_http_status(:bad_request) } + it { is_expected.to have_gitlab_http_status(:bad_request) } end end diff --git a/spec/controllers/admin/clusters_controller_spec.rb b/spec/controllers/admin/clusters_controller_spec.rb index f27519496df..1f5c33d8022 100644 --- a/spec/controllers/admin/clusters_controller_spec.rb +++ b/spec/controllers/admin/clusters_controller_spec.rb @@ -567,7 +567,7 @@ describe Admin::ClustersController do put_update(format: :json) cluster.reload - expect(response).to have_http_status(:no_content) + expect(response).to have_gitlab_http_status(:no_content) expect(cluster.enabled).to be_falsey expect(cluster.name).to eq('my-new-cluster-name') expect(cluster).not_to be_managed @@ -587,7 +587,7 @@ describe Admin::ClustersController do it 'rejects changes' do put_update(format: :json) - expect(response).to have_http_status(:bad_request) + expect(response).to have_gitlab_http_status(:bad_request) end end end diff --git a/spec/controllers/admin/gitaly_servers_controller_spec.rb b/spec/controllers/admin/gitaly_servers_controller_spec.rb index c75418a9ad4..db94ea06f59 100644 --- a/spec/controllers/admin/gitaly_servers_controller_spec.rb +++ b/spec/controllers/admin/gitaly_servers_controller_spec.rb @@ -11,7 +11,7 @@ describe Admin::GitalyServersController do it 'shows the gitaly servers page' do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end end diff --git a/spec/controllers/admin/hooks_controller_spec.rb b/spec/controllers/admin/hooks_controller_spec.rb index 3c3a16ef9d5..9973ef93cd9 100644 --- a/spec/controllers/admin/hooks_controller_spec.rb +++ b/spec/controllers/admin/hooks_controller_spec.rb @@ -24,7 +24,7 @@ describe Admin::HooksController do post :create, params: { hook: hook_params } - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(SystemHook.all.size).to eq(1) expect(SystemHook.first).to have_attributes(hook_params) end diff --git a/spec/controllers/admin/impersonations_controller_spec.rb b/spec/controllers/admin/impersonations_controller_spec.rb index b44797b23e5..fa3923bca8c 100644 --- a/spec/controllers/admin/impersonations_controller_spec.rb +++ b/spec/controllers/admin/impersonations_controller_spec.rb @@ -24,7 +24,7 @@ describe Admin::ImpersonationsController do it "responds with status 404" do delete :destroy - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it "doesn't sign us in" do @@ -48,7 +48,7 @@ describe Admin::ImpersonationsController do it "responds with status 404" do delete :destroy - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it "doesn't sign us in as the impersonator" do @@ -67,7 +67,7 @@ describe Admin::ImpersonationsController do it "responds with status 404" do delete :destroy - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it "doesn't sign us in as the impersonator" do diff --git a/spec/controllers/admin/projects_controller_spec.rb b/spec/controllers/admin/projects_controller_spec.rb index 6b996798b74..2d783dab621 100644 --- a/spec/controllers/admin/projects_controller_spec.rb +++ b/spec/controllers/admin/projects_controller_spec.rb @@ -29,7 +29,7 @@ describe Admin::ProjectsController do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response.body).not_to match(pending_delete_project.name) expect(response.body).to match(project.name) end @@ -61,7 +61,7 @@ describe Admin::ProjectsController do it 'renders show page' do get :show, params: { namespace_id: project.namespace.path, id: project.path } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response.body).to match(project.name) end end diff --git a/spec/controllers/admin/requests_profiles_controller_spec.rb b/spec/controllers/admin/requests_profiles_controller_spec.rb index 853767199bc..13123c8e486 100644 --- a/spec/controllers/admin/requests_profiles_controller_spec.rb +++ b/spec/controllers/admin/requests_profiles_controller_spec.rb @@ -36,7 +36,7 @@ describe Admin::RequestsProfilesController do it 'renders the data' do subject - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response.body).to eq(sample_data) end end @@ -54,7 +54,7 @@ describe Admin::RequestsProfilesController do it 'renders the data' do subject - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response.body).to eq(sample_data) end end diff --git a/spec/controllers/admin/runners_controller_spec.rb b/spec/controllers/admin/runners_controller_spec.rb index a1d346d088d..7582006df36 100644 --- a/spec/controllers/admin/runners_controller_spec.rb +++ b/spec/controllers/admin/runners_controller_spec.rb @@ -15,7 +15,7 @@ describe Admin::RunnersController do it 'lists all runners' do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'avoids N+1 queries', :request_store do @@ -29,7 +29,7 @@ describe Admin::RunnersController do # We also need to add 1 because it takes 2 queries to preload tags expect { get :index }.not_to exceed_query_limit(control_count + 6) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response.body).to have_content('tag1') expect(response.body).to have_content('tag2') end @@ -49,13 +49,13 @@ describe Admin::RunnersController do it 'shows a particular runner' do get :show, params: { id: runner.id } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'shows 404 for unknown runner' do get :show, params: { id: 0 } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it 'avoids N+1 queries', :request_store do @@ -70,7 +70,7 @@ describe Admin::RunnersController do # needs_new_sso_session permission expect { get :show, params: { id: runner.id } }.not_to exceed_query_limit(control_count + 1) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -84,7 +84,7 @@ describe Admin::RunnersController do runner.reload - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(runner.description).to eq(new_desc) end end @@ -93,7 +93,7 @@ describe Admin::RunnersController do it 'destroys the runner' do delete :destroy, params: { id: runner.id } - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(Ci::Runner.find_by(id: runner.id)).to be_nil end end @@ -108,7 +108,7 @@ describe Admin::RunnersController do runner.reload - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(runner.active).to eq(true) end end @@ -123,7 +123,7 @@ describe Admin::RunnersController do runner.reload - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(runner.active).to eq(false) end end diff --git a/spec/controllers/admin/services_controller_spec.rb b/spec/controllers/admin/services_controller_spec.rb index 1c518dab11e..44233776865 100644 --- a/spec/controllers/admin/services_controller_spec.rb +++ b/spec/controllers/admin/services_controller_spec.rb @@ -22,7 +22,7 @@ describe Admin::ServicesController do it 'successfully displays the template' do get :edit, params: { id: service.id } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end end @@ -48,7 +48,7 @@ describe Admin::ServicesController do put :update, params: { id: service.id, service: { active: true } } - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end it 'does not call the propagation worker when service is not active' do @@ -56,7 +56,7 @@ describe Admin::ServicesController do put :update, params: { id: service.id, service: { properties: {} } } - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end end end diff --git a/spec/controllers/admin/sessions_controller_spec.rb b/spec/controllers/admin/sessions_controller_spec.rb index be996aee1d2..4bab6b51102 100644 --- a/spec/controllers/admin/sessions_controller_spec.rb +++ b/spec/controllers/admin/sessions_controller_spec.rb @@ -124,7 +124,7 @@ describe Admin::SessionsController, :do_not_mock_admin_mode do it 'shows error page' do post :destroy - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) expect(controller.current_user_mode.admin_mode?).to be(false) end end diff --git a/spec/controllers/admin/spam_logs_controller_spec.rb b/spec/controllers/admin/spam_logs_controller_spec.rb index 15fb57d5add..6716bb8b399 100644 --- a/spec/controllers/admin/spam_logs_controller_spec.rb +++ b/spec/controllers/admin/spam_logs_controller_spec.rb @@ -16,7 +16,7 @@ describe Admin::SpamLogsController do it 'lists all spam logs' do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -24,14 +24,14 @@ describe Admin::SpamLogsController do it 'removes only the spam log when removing log' do expect { delete :destroy, params: { id: first_spam.id } }.to change { SpamLog.count }.by(-1) expect(User.find(user.id)).to be_truthy - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'removes user and his spam logs when removing the user', :sidekiq_might_not_need_inline do delete :destroy, params: { id: first_spam.id, remove_user: true } expect(flash[:notice]).to eq "User #{user.username} was successfully removed." - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(SpamLog.count).to eq(0) expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound) end @@ -46,7 +46,7 @@ describe Admin::SpamLogsController do it 'submits the log as ham' do post :mark_as_ham, params: { id: first_spam.id } - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(SpamLog.find(first_spam.id).submitted_as_ham).to be_truthy end end diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index ebdfbe14dec..2661f8c1519 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -47,7 +47,7 @@ describe Admin::UsersController do it 'deletes user and ghosts their contributions' do delete :destroy, params: { id: user.username }, format: :json - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(User.exists?(user.id)).to be_falsy expect(issue.reload.author).to be_ghost end @@ -55,7 +55,7 @@ describe Admin::UsersController do it 'deletes the user and their contributions when hard delete is specified' do delete :destroy, params: { id: user.username, hard_delete: true }, format: :json - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(User.exists?(user.id)).to be_falsy expect(Issue.exists?(issue.id)).to be_falsy end @@ -399,7 +399,7 @@ describe Admin::UsersController do it "shows error page" do post :impersonate, params: { id: user.username } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end end diff --git a/spec/controllers/boards/issues_controller_spec.rb b/spec/controllers/boards/issues_controller_spec.rb index d54f7ad33cf..605fff60c31 100644 --- a/spec/controllers/boards/issues_controller_spec.rb +++ b/spec/controllers/boards/issues_controller_spec.rb @@ -28,7 +28,7 @@ describe Boards::IssuesController do it 'returns a not found 404 response' do list_issues user: user, board: 999, list: list2 - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -106,7 +106,7 @@ describe Boards::IssuesController do it 'returns a not found 404 response' do list_issues user: user, board: board, list: 999 - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end end @@ -132,7 +132,7 @@ describe Boards::IssuesController do it 'returns a forbidden 403 response' do list_issues user: unauth_user, board: board, list: list2 - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end @@ -148,7 +148,7 @@ describe Boards::IssuesController do list_issues(user: user, board: group_board) - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end it 'is successful for project boards' do @@ -156,7 +156,7 @@ describe Boards::IssuesController do list_issues(user: user, board: project_board) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -215,7 +215,7 @@ describe Boards::IssuesController do expect(response).to have_gitlab_http_status(expected_status) list_issues user: requesting_user, board: board, list: list2 - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response).to match_response_schema('entities/issue_boards') @@ -391,7 +391,7 @@ describe Boards::IssuesController do it 'returns a successful 200 response' do create_issue user: user, board: board, list: list1, title: 'New issue' - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'returns the created issue' do @@ -406,7 +406,7 @@ describe Boards::IssuesController do it 'returns an unprocessable entity 422 response' do create_issue user: user, board: board, list: list1, title: nil - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end end @@ -416,7 +416,7 @@ describe Boards::IssuesController do create_issue user: user, board: board, list: list, title: 'New issue' - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -424,7 +424,7 @@ describe Boards::IssuesController do it 'returns a not found 404 response' do create_issue user: user, board: 999, list: list1, title: 'New issue' - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -432,7 +432,7 @@ describe Boards::IssuesController do it 'returns a not found 404 response' do create_issue user: user, board: board, list: 999, title: 'New issue' - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end end @@ -443,7 +443,7 @@ describe Boards::IssuesController do open_list = board.lists.create(list_type: :backlog) create_issue user: guest, board: board, list: open_list, title: 'New issue' - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -451,7 +451,7 @@ describe Boards::IssuesController do it 'returns a forbidden 403 response' do create_issue user: guest, board: board, list: list1, title: 'New issue' - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end end @@ -475,7 +475,7 @@ describe Boards::IssuesController do it 'returns a successful 200 response' do move user: user, board: board, issue: issue, from_list_id: list1.id, to_list_id: list2.id - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'moves issue to the desired list' do @@ -489,19 +489,19 @@ describe Boards::IssuesController do it 'returns a unprocessable entity 422 response for invalid lists' do move user: user, board: board, issue: issue, from_list_id: nil, to_list_id: nil - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end it 'returns a not found 404 response for invalid board id' do move user: user, board: 999, issue: issue, from_list_id: list1.id, to_list_id: list2.id - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it 'returns a not found 404 response for invalid issue id' do move user: user, board: board, issue: double(id: 999), from_list_id: list1.id, to_list_id: list2.id - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -515,7 +515,7 @@ describe Boards::IssuesController do it 'returns a forbidden 403 response' do move user: guest, board: board, issue: issue, from_list_id: list1.id, to_list_id: list2.id - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end diff --git a/spec/controllers/boards/lists_controller_spec.rb b/spec/controllers/boards/lists_controller_spec.rb index bc46d02556b..3886388bcf4 100644 --- a/spec/controllers/boards/lists_controller_spec.rb +++ b/spec/controllers/boards/lists_controller_spec.rb @@ -21,7 +21,7 @@ describe Boards::ListsController do it 'returns a successful 200 response' do read_board_list user: user, board: board - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response.content_type).to eq 'application/json' end @@ -50,7 +50,7 @@ describe Boards::ListsController do it 'returns a forbidden 403 response' do read_board_list user: unauth_user, board: board - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end @@ -73,7 +73,7 @@ describe Boards::ListsController do it 'returns a successful 200 response' do create_board_list user: user, board: board, label_id: label.id - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'returns the created list' do @@ -88,7 +88,7 @@ describe Boards::ListsController do it 'returns a not found 404 response' do create_board_list user: user, board: board, label_id: nil - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -98,7 +98,7 @@ describe Boards::ListsController do create_board_list user: user, board: board, label_id: label.id - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end end @@ -109,7 +109,7 @@ describe Boards::ListsController do create_board_list user: guest, board: board, label_id: label.id - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end @@ -134,7 +134,7 @@ describe Boards::ListsController do it 'returns a successful 200 response' do move user: user, board: board, list: planning, position: 1 - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'moves the list to the desired position' do @@ -148,7 +148,7 @@ describe Boards::ListsController do it 'returns an unprocessable entity 422 response' do move user: user, board: board, list: planning, position: 6 - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end end @@ -156,7 +156,7 @@ describe Boards::ListsController do it 'returns a not found 404 response' do move user: user, board: board, list: 999, position: 1 - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -164,7 +164,7 @@ describe Boards::ListsController do it 'returns a 422 unprocessable entity response' do move user: guest, board: board, list: planning, position: 6 - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end end @@ -173,14 +173,14 @@ describe Boards::ListsController do save_setting user: user, board: board, list: planning, setting: { collapsed: true } expect(planning.preferences_for(user).collapsed).to eq(true) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'saves not collapsed preference for user' do save_setting user: user, board: board, list: planning, setting: { collapsed: false } expect(planning.preferences_for(user).collapsed).to eq(false) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -191,14 +191,14 @@ describe Boards::ListsController do save_setting user: user, board: board, list: closed, setting: { collapsed: true } expect(closed.preferences_for(user).collapsed).to eq(true) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'saves not collapsed preference for user' do save_setting user: user, board: board, list: closed, setting: { collapsed: false } expect(closed.preferences_for(user).collapsed).to eq(false) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -236,7 +236,7 @@ describe Boards::ListsController do it 'returns a successful 200 response' do remove_board_list user: user, board: board, list: planning - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'removes list from board' do @@ -248,7 +248,7 @@ describe Boards::ListsController do it 'returns a not found 404 response' do remove_board_list user: user, board: board, list: 999 - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -256,7 +256,7 @@ describe Boards::ListsController do it 'returns a forbidden 403 response' do remove_board_list user: guest, board: board, list: planning - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end @@ -278,7 +278,7 @@ describe Boards::ListsController do it 'returns a successful 200 response' do generate_default_lists user: user, board: board - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'returns the defaults lists' do @@ -294,7 +294,7 @@ describe Boards::ListsController do generate_default_lists user: user, board: board - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end end @@ -302,7 +302,7 @@ describe Boards::ListsController do it 'returns a forbidden 403 response' do generate_default_lists user: guest, board: board - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end diff --git a/spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb b/spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb index e47f1650b1f..85989ea3e92 100644 --- a/spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb +++ b/spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb @@ -51,7 +51,7 @@ describe ControllerWithCrossProjectAccessCheck do get :index - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) expect(response.body).to match(/#{message}/) end @@ -60,7 +60,7 @@ describe ControllerWithCrossProjectAccessCheck do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'is skipped when the `unless` condition returns true' do @@ -68,13 +68,13 @@ describe ControllerWithCrossProjectAccessCheck do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'correctly renders an action that does not require cross project access' do get :show, params: { id: 'nothing' } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -113,7 +113,7 @@ describe ControllerWithCrossProjectAccessCheck do it 'renders a success when the check is skipped' do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'is executed when the `if` condition returns false' do @@ -121,7 +121,7 @@ describe ControllerWithCrossProjectAccessCheck do get :index - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end it 'is executed when the `unless` condition returns true' do @@ -129,19 +129,19 @@ describe ControllerWithCrossProjectAccessCheck do get :index - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end it 'does not skip the check on an action that is not skipped' do get :show, params: { id: 'hello' } - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end it 'does not skip the check on an action that was not defined to skip' do get :edit, params: { id: 'hello' } - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end end diff --git a/spec/controllers/concerns/enforces_admin_authentication_spec.rb b/spec/controllers/concerns/enforces_admin_authentication_spec.rb index 019a21e8cf0..a8494543558 100644 --- a/spec/controllers/concerns/enforces_admin_authentication_spec.rb +++ b/spec/controllers/concerns/enforces_admin_authentication_spec.rb @@ -39,7 +39,7 @@ describe EnforcesAdminAuthentication, :do_not_mock_admin_mode do it 'renders ok' do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end end @@ -48,7 +48,7 @@ describe EnforcesAdminAuthentication, :do_not_mock_admin_mode do it 'renders a 404' do get :index - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it 'does not set admin mode' do @@ -75,7 +75,7 @@ describe EnforcesAdminAuthentication, :do_not_mock_admin_mode do let(:user) { create(:admin) } it 'allows direct access to page' do - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'does not set admin mode' do @@ -85,7 +85,7 @@ describe EnforcesAdminAuthentication, :do_not_mock_admin_mode do context 'as a user' do it 'renders a 404' do - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it 'does not set admin mode' do diff --git a/spec/controllers/concerns/project_unauthorized_spec.rb b/spec/controllers/concerns/project_unauthorized_spec.rb index 5834b1ef37f..9b40660811e 100644 --- a/spec/controllers/concerns/project_unauthorized_spec.rb +++ b/spec/controllers/concerns/project_unauthorized_spec.rb @@ -30,7 +30,7 @@ describe ProjectUnauthorized do get :show, params: { namespace_id: project.namespace.to_param, id: project.to_param } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'renders a 403 when the service denies access to the project' do @@ -38,7 +38,7 @@ describe ProjectUnauthorized do get :show, params: { namespace_id: project.namespace.to_param, id: project.to_param } - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) expect(response.body).to match("External authorization denied access to this project") end @@ -47,7 +47,7 @@ describe ProjectUnauthorized do get :show, params: { namespace_id: other_project.namespace.to_param, id: other_project.to_param } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end end diff --git a/spec/controllers/concerns/routable_actions_spec.rb b/spec/controllers/concerns/routable_actions_spec.rb index a11f4d2a154..80c67022219 100644 --- a/spec/controllers/concerns/routable_actions_spec.rb +++ b/spec/controllers/concerns/routable_actions_spec.rb @@ -47,14 +47,14 @@ describe RoutableActions do it 'allows access' do get_routable(routable) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end it 'prevents access when not authorized' do get_routable(routable) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -75,14 +75,14 @@ describe RoutableActions do it 'allows access' do get_routable(routable) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end it 'prevents access when not authorized' do get_routable(routable) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -92,7 +92,7 @@ describe RoutableActions do it 'allows access when authorized' do get_routable(routable) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'prevents access when unauthorized' do @@ -100,7 +100,7 @@ describe RoutableActions do get_routable(user) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end end @@ -111,7 +111,7 @@ describe RoutableActions do get_routable(routable) - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(response.location).to end_with('/users/sign_in') end end diff --git a/spec/controllers/concerns/static_object_external_storage_spec.rb b/spec/controllers/concerns/static_object_external_storage_spec.rb index ddd1a95427e..d3ece587ef7 100644 --- a/spec/controllers/concerns/static_object_external_storage_spec.rb +++ b/spec/controllers/concerns/static_object_external_storage_spec.rb @@ -27,7 +27,7 @@ describe StaticObjectExternalStorage do do_request - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -75,7 +75,7 @@ describe StaticObjectExternalStorage do request.headers['X-Gitlab-External-Storage-Token'] = 'letmein' do_request - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -84,7 +84,7 @@ describe StaticObjectExternalStorage do request.headers['X-Gitlab-External-Storage-Token'] = 'donotletmein' do_request - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end end diff --git a/spec/controllers/dashboard/groups_controller_spec.rb b/spec/controllers/dashboard/groups_controller_spec.rb index 20a0951423b..b615bcc1e6b 100644 --- a/spec/controllers/dashboard/groups_controller_spec.rb +++ b/spec/controllers/dashboard/groups_controller_spec.rb @@ -40,7 +40,7 @@ describe Dashboard::GroupsController do it 'renders only groups the user is a member of when searching hierarchy correctly' do get :index, params: { filter: 'chef' }, format: :json - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) all_groups = [top_level_result, top_level_a, sub_level_result_a] expect(assigns(:groups)).to contain_exactly(*all_groups) end @@ -51,7 +51,7 @@ describe Dashboard::GroupsController do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end end diff --git a/spec/controllers/dashboard/milestones_controller_spec.rb b/spec/controllers/dashboard/milestones_controller_spec.rb index 67939aa4e6a..f4b04ad6dee 100644 --- a/spec/controllers/dashboard/milestones_controller_spec.rb +++ b/spec/controllers/dashboard/milestones_controller_spec.rb @@ -40,7 +40,7 @@ describe Dashboard::MilestonesController do it 'shows milestone page' do view_milestone - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -55,7 +55,7 @@ describe Dashboard::MilestonesController do it 'returns group and project milestones to which the user belongs' do get :index, format: :json - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response.size).to eq(2) expect(json_response.map { |i| i["name"] }).to match_array([group_milestone.name, project_milestone.name]) expect(json_response.map { |i| i["group_name"] }.compact).to match_array(group.name) @@ -64,7 +64,7 @@ describe Dashboard::MilestonesController do it 'returns closed group and project milestones to which the user belongs' do get :index, params: { state: 'closed' }, format: :json - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response.size).to eq(2) expect(json_response.map { |i| i["name"] }).to match_array([closed_group_milestone.name, closed_project_milestone.name]) expect(json_response.map { |i| i["group_name"] }.compact).to match_array(group.name) diff --git a/spec/controllers/dashboard/projects_controller_spec.rb b/spec/controllers/dashboard/projects_controller_spec.rb index 8b95c9f2496..d013093c376 100644 --- a/spec/controllers/dashboard/projects_controller_spec.rb +++ b/spec/controllers/dashboard/projects_controller_spec.rb @@ -23,7 +23,7 @@ describe Dashboard::ProjectsController do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end diff --git a/spec/controllers/dashboard/todos_controller_spec.rb b/spec/controllers/dashboard/todos_controller_spec.rb index 4ce445fe41a..0823afe410d 100644 --- a/spec/controllers/dashboard/todos_controller_spec.rb +++ b/spec/controllers/dashboard/todos_controller_spec.rb @@ -20,19 +20,19 @@ describe Dashboard::TodosController do get :index, params: { project_id: unauthorized_project.id } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it 'renders 404 when given project does not exists' do get :index, params: { project_id: 999 } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it 'renders 200 when filtering for "any project" todos' do get :index, params: { project_id: '' } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'renders 200 when user has access on given project' do @@ -40,7 +40,7 @@ describe Dashboard::TodosController do get :index, params: { project_id: authorized_project.id } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -78,7 +78,7 @@ describe Dashboard::TodosController do get :index, params: { group_id: unauthorized_group.id } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -130,7 +130,7 @@ describe Dashboard::TodosController do patch :restore, params: { id: todo.id } expect(todo.reload).to be_pending - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response).to eq({ "count" => 1, "done_count" => 0 }) end end @@ -144,7 +144,7 @@ describe Dashboard::TodosController do todos.each do |todo| expect(todo.reload).to be_pending end - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response).to eq({ 'count' => 2, 'done_count' => 0 }) end end diff --git a/spec/controllers/google_api/authorizations_controller_spec.rb b/spec/controllers/google_api/authorizations_controller_spec.rb index 4d200140f16..58bda2bd4e8 100644 --- a/spec/controllers/google_api/authorizations_controller_spec.rb +++ b/spec/controllers/google_api/authorizations_controller_spec.rb @@ -23,7 +23,7 @@ describe GoogleApi::AuthorizationsController do subject expect(session[GoogleApi::CloudPlatform::Client.session_key_for_token]).to be_nil - expect(response).to have_http_status(:not_found) + expect(response).to have_gitlab_http_status(:not_found) end end diff --git a/spec/controllers/import/bitbucket_controller_spec.rb b/spec/controllers/import/bitbucket_controller_spec.rb index 74ffcc3aeef..ab4f6d5054c 100644 --- a/spec/controllers/import/bitbucket_controller_spec.rb +++ b/spec/controllers/import/bitbucket_controller_spec.rb @@ -123,7 +123,7 @@ describe Import::BitbucketController do post :create, format: :json - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'returns 422 response when the project could not be imported' do @@ -133,7 +133,7 @@ describe Import::BitbucketController do post :create, format: :json - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end it_behaves_like 'project import rate limiter' @@ -330,7 +330,7 @@ describe Import::BitbucketController do post :create, params: { target_namespace: other_namespace.name }, format: :json - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end end end diff --git a/spec/controllers/import/bitbucket_server_controller_spec.rb b/spec/controllers/import/bitbucket_server_controller_spec.rb index a84f8368198..3a347368884 100644 --- a/spec/controllers/import/bitbucket_server_controller_spec.rb +++ b/spec/controllers/import/bitbucket_server_controller_spec.rb @@ -48,7 +48,7 @@ describe Import::BitbucketServerController do post :create, params: { project: project_key, repository: repo_slug }, format: :json - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end context 'with project key with tildes' do @@ -61,20 +61,20 @@ describe Import::BitbucketServerController do post :create, params: { project: project_key, repository: repo_slug, format: :json } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end it 'returns an error when an invalid project key is used' do post :create, params: { project: 'some&project' } - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end it 'returns an error when an invalid repository slug is used' do post :create, params: { project: 'some-project', repository: 'try*this' } - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end it 'returns an error when the project cannot be found' do @@ -82,7 +82,7 @@ describe Import::BitbucketServerController do post :create, params: { project: project_key, repository: repo_slug }, format: :json - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end it 'returns an error when the project cannot be saved' do @@ -92,7 +92,7 @@ describe Import::BitbucketServerController do post :create, params: { project: project_key, repository: repo_slug }, format: :json - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end it "returns an error when the server can't be contacted" do @@ -100,7 +100,7 @@ describe Import::BitbucketServerController do post :create, params: { project: project_key, repository: repo_slug }, format: :json - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end it_behaves_like 'project import rate limiter' @@ -118,7 +118,7 @@ describe Import::BitbucketServerController do expect(session[:bitbucket_server_username]).to be_nil expect(session[:bitbucket_server_personal_access_token]).to be_nil - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(response).to redirect_to(status_import_bitbucket_server_path) end @@ -128,7 +128,7 @@ describe Import::BitbucketServerController do expect(session[:bitbucket_server_url]).to eq(url) expect(session[:bitbucket_server_username]).to eq(username) expect(session[:bitbucket_server_personal_access_token]).to eq(token) - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(response).to redirect_to(status_import_bitbucket_server_path) end end diff --git a/spec/controllers/import/github_controller_spec.rb b/spec/controllers/import/github_controller_spec.rb index 54fbe624cb7..40ea0bb3a44 100644 --- a/spec/controllers/import/github_controller_spec.rb +++ b/spec/controllers/import/github_controller_spec.rb @@ -22,7 +22,7 @@ describe Import::GithubController do get :new - expect(response).to have_http_status(302) + expect(response).to have_gitlab_http_status(:found) end it "prompts for an access token if GitHub not configured" do @@ -31,7 +31,7 @@ describe Import::GithubController do get :new - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end context 'when importing a CI/CD project' do diff --git a/spec/controllers/import/gitlab_controller_spec.rb b/spec/controllers/import/gitlab_controller_spec.rb index 495ea62456c..96a8eb99d5c 100644 --- a/spec/controllers/import/gitlab_controller_spec.rb +++ b/spec/controllers/import/gitlab_controller_spec.rb @@ -86,7 +86,7 @@ describe Import::GitlabController do post :create, format: :json - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'returns 422 response when the project could not be imported' do @@ -96,7 +96,7 @@ describe Import::GitlabController do post :create, format: :json - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end context "when the repository owner is the GitLab.com user" do @@ -279,7 +279,7 @@ describe Import::GitlabController do post :create, params: { target_namespace: other_namespace.name }, format: :json - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) end end diff --git a/spec/controllers/import/gitlab_projects_controller_spec.rb b/spec/controllers/import/gitlab_projects_controller_spec.rb index 285291c53fa..a9aaefda0f6 100644 --- a/spec/controllers/import/gitlab_projects_controller_spec.rb +++ b/spec/controllers/import/gitlab_projects_controller_spec.rb @@ -17,14 +17,14 @@ describe Import::GitlabProjectsController do post :create, params: { namespace_id: namespace.id, path: '/test', file: file } expect(flash[:alert]).to start_with('Project could not be imported') - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end it 'redirects with an error when a relative path is used' do post :create, params: { namespace_id: namespace.id, path: '../test', file: file } expect(flash[:alert]).to start_with('Project could not be imported') - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end end @@ -33,7 +33,7 @@ describe Import::GitlabProjectsController do post :create, params: { namespace_id: namespace.id, path: 'test', file: file } expect(flash[:notice]).to include('is being imported') - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end end diff --git a/spec/controllers/import/phabricator_controller_spec.rb b/spec/controllers/import/phabricator_controller_spec.rb index 62a719cfb5b..d29a06efbb5 100644 --- a/spec/controllers/import/phabricator_controller_spec.rb +++ b/spec/controllers/import/phabricator_controller_spec.rb @@ -18,7 +18,7 @@ describe Import::PhabricatorController do stub_application_setting(import_sources: []) end - it { is_expected.to have_gitlab_http_status(404) } + it { is_expected.to have_gitlab_http_status(:not_found) } end context 'when the feature is disabled' do @@ -27,7 +27,7 @@ describe Import::PhabricatorController do stub_application_setting(import_sources: ['phabricator']) end - it { is_expected.to have_gitlab_http_status(404) } + it { is_expected.to have_gitlab_http_status(:not_found) } end context 'when the import is available' do @@ -36,7 +36,7 @@ describe Import::PhabricatorController do stub_application_setting(import_sources: ['phabricator']) end - it { is_expected.to have_gitlab_http_status(200) } + it { is_expected.to have_gitlab_http_status(:ok) } end end diff --git a/spec/controllers/oauth/applications_controller_spec.rb b/spec/controllers/oauth/applications_controller_spec.rb index 270a2fcc1d6..5f1f6af3999 100644 --- a/spec/controllers/oauth/applications_controller_spec.rb +++ b/spec/controllers/oauth/applications_controller_spec.rb @@ -14,7 +14,7 @@ describe Oauth::ApplicationsController do it 'shows list of applications' do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it 'redirects back to profile page if OAuth applications are disabled' do @@ -22,7 +22,7 @@ describe Oauth::ApplicationsController do get :index - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end @@ -30,7 +30,7 @@ describe Oauth::ApplicationsController do it 'creates an application' do post :create, params: oauth_params - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last)) end @@ -39,7 +39,7 @@ describe Oauth::ApplicationsController do post :create, params: oauth_params - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(response).to redirect_to(profile_path) end diff --git a/spec/controllers/oauth/authorizations_controller_spec.rb b/spec/controllers/oauth/authorizations_controller_spec.rb index 41f7684051e..1b4bebd9707 100644 --- a/spec/controllers/oauth/authorizations_controller_spec.rb +++ b/spec/controllers/oauth/authorizations_controller_spec.rb @@ -23,7 +23,7 @@ describe Oauth::AuthorizationsController do it 'returns 200 code and renders error view' do get :new - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template('doorkeeper/authorizations/error') end end @@ -34,7 +34,7 @@ describe Oauth::AuthorizationsController do it 'returns 200 code and renders view' do get :new, params: params - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template('doorkeeper/authorizations/new') end @@ -45,7 +45,7 @@ describe Oauth::AuthorizationsController do get :new, params: params expect(request.session['user_return_to']).to be_nil - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end context 'when there is already an access token for the application' do @@ -62,7 +62,7 @@ describe Oauth::AuthorizationsController do get :new, params: params expect(request.session['user_return_to']).to be_nil - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end end end diff --git a/spec/controllers/profiles/accounts_controller_spec.rb b/spec/controllers/profiles/accounts_controller_spec.rb index f481b5078f2..518ea4e5c48 100644 --- a/spec/controllers/profiles/accounts_controller_spec.rb +++ b/spec/controllers/profiles/accounts_controller_spec.rb @@ -13,7 +13,7 @@ describe Profiles::AccountsController do it 'renders 404 if someone tries to unlink a non existent provider' do delete :unlink, params: { provider: 'github' } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end [:saml, :cas3].each do |provider| @@ -25,7 +25,7 @@ describe Profiles::AccountsController do delete :unlink, params: { provider: provider.to_s } - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(user.reload.identities).to include(identity) end end @@ -40,7 +40,7 @@ describe Profiles::AccountsController do delete :unlink, params: { provider: provider.to_s } - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) expect(user.reload.identities).not_to include(identity) end end diff --git a/spec/controllers/snippets/notes_controller_spec.rb b/spec/controllers/snippets/notes_controller_spec.rb index fd4b95ce226..b93df3555ab 100644 --- a/spec/controllers/snippets/notes_controller_spec.rb +++ b/spec/controllers/snippets/notes_controller_spec.rb @@ -22,7 +22,7 @@ describe Snippets::NotesController do end it "returns status 200" do - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it "returns not empty array of notes" do @@ -39,7 +39,7 @@ describe Snippets::NotesController do it "returns status 404" do get :index, params: { snippet_id: internal_snippet } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -51,7 +51,7 @@ describe Snippets::NotesController do it "returns status 200" do get :index, params: { snippet_id: internal_snippet } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end end @@ -65,7 +65,7 @@ describe Snippets::NotesController do it "returns status 404" do get :index, params: { snippet_id: private_snippet } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -77,7 +77,7 @@ describe Snippets::NotesController do it "returns status 404" do get :index, params: { snippet_id: private_snippet } - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end end @@ -91,7 +91,7 @@ describe Snippets::NotesController do it "returns status 200" do get :index, params: { snippet_id: private_snippet } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it "returns 1 note" do @@ -135,7 +135,7 @@ describe Snippets::NotesController do it 'returns status 302' do post :create, params: request_params - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end it 'creates the note' do @@ -158,7 +158,7 @@ describe Snippets::NotesController do it 'returns status 302' do post :create, params: request_params - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end it 'creates the note' do @@ -186,7 +186,7 @@ describe Snippets::NotesController do it 'returns status 404' do post :create, params: request_params - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it 'does not create the note' do @@ -204,7 +204,7 @@ describe Snippets::NotesController do it 'returns status 302' do post :create, params: request_params - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end it 'creates the note on the public snippet' do @@ -222,7 +222,7 @@ describe Snippets::NotesController do it 'returns status 302' do post :create, params: request_params - expect(response).to have_gitlab_http_status(302) + expect(response).to have_gitlab_http_status(:found) end it 'creates the note' do @@ -249,7 +249,7 @@ describe Snippets::NotesController do it "returns status 200" do delete :destroy, params: request_params - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it "deletes the note" do @@ -277,7 +277,7 @@ describe Snippets::NotesController do it "returns status 404" do delete :destroy, params: request_params - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end it "does not update the note" do @@ -299,7 +299,7 @@ describe Snippets::NotesController do it "toggles the award emoji" do expect { subject }.to change { note.award_emoji.count }.by(1) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end it "removes the already awarded emoji when it exists" do @@ -307,7 +307,7 @@ describe Snippets::NotesController do expect { subject }.to change { AwardEmoji.count }.by(-1) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) end end end diff --git a/spec/controllers/user_callouts_controller_spec.rb b/spec/controllers/user_callouts_controller_spec.rb index 07eaff2da09..babc93a83e5 100644 --- a/spec/controllers/user_callouts_controller_spec.rb +++ b/spec/controllers/user_callouts_controller_spec.rb @@ -13,7 +13,7 @@ describe UserCalloutsController do subject { post :create, params: { feature_name: feature_name }, format: :json } context 'with valid feature name' do - let(:feature_name) { UserCallout.feature_names.first.first } + let(:feature_name) { UserCallout.feature_names.keys.first } context 'when callout entry does not exist' do it 'creates a callout entry with dismissed state' do @@ -28,7 +28,7 @@ describe UserCalloutsController do end context 'when callout entry already exists' do - let!(:callout) { create(:user_callout, feature_name: UserCallout.feature_names.first.first, user: user) } + let!(:callout) { create(:user_callout, feature_name: UserCallout.feature_names.keys.first, user: user) } it 'returns success' do subject |