OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Conform to RSpecRails/HaveHttpStatus cop
Christophe Bliarda885fef2bdd9
diff --git a/modules/avatars/spec/controllers/avatars/avatar_controller_spec.rb b/modules/avatars/spec/controllers/avatars/avatar_controller_spec.rbindex e4dbd8bdd8a..0567ee30f8b 100644--- a/modules/avatars/spec/controllers/avatars/avatar_controller_spec.rb+++ b/modules/avatars/spec/controllers/avatars/avatar_controller_spec.rb@@ -33,7 +33,7 @@ RSpec.describe Avatars::AvatarController dolet(:target_user) { user_with_avatar }it "renders the send file" do- expect(response.status).to eq 200+ expect(response).to have_http_status :okendend@@ -41,7 +41,7 @@ RSpec.describe Avatars::AvatarController dolet(:target_user) { user_without_avatar }it "renders 404" do- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendendend@@ -51,7 +51,7 @@ RSpec.describe Avatars::AvatarController dolet(:target_user) { user_with_avatar }it "renders a 404" do- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendendenddiff --git a/modules/avatars/spec/controllers/avatars/my_controller_spec.rb b/modules/avatars/spec/controllers/avatars/my_controller_spec.rbindex 63632780426..8359b7a3049 100644--- a/modules/avatars/spec/controllers/avatars/my_controller_spec.rb+++ b/modules/avatars/spec/controllers/avatars/my_controller_spec.rb@@ -37,14 +37,14 @@ RSpec.describe Avatars::MyAvatarController doit "renders 404" dopost :update- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendendit "returns invalid method for post request" dopost :updateexpect(response).not_to be_successful- expect(response.status).to eq 405+ expect(response).to have_http_status :method_not_allowedendit "calls the service for put" do@@ -54,7 +54,7 @@ RSpec.describe Avatars::MyAvatarController doput :updateexpect(response).to be_successful- expect(response.status).to eq 200+ expect(response).to have_http_status :okendit "calls the service for put" do@@ -64,7 +64,7 @@ RSpec.describe Avatars::MyAvatarController doput :updateexpect(response).not_to be_successful- expect(response.status).to eq 400+ expect(response).to have_http_status :bad_requestendend@@ -72,7 +72,7 @@ RSpec.describe Avatars::MyAvatarController doit "returns invalid method for post request" dopost :destroyexpect(response).not_to be_successful- expect(response.status).to eq 405+ expect(response).to have_http_status :method_not_allowedendit "calls the service for delete" dodiff --git a/modules/avatars/spec/controllers/avatars/users_controller_spec.rb b/modules/avatars/spec/controllers/avatars/users_controller_spec.rbindex 387803007d9..065d1f24126 100644--- a/modules/avatars/spec/controllers/avatars/users_controller_spec.rb+++ b/modules/avatars/spec/controllers/avatars/users_controller_spec.rb@@ -33,7 +33,7 @@ RSpec.describe Avatars::UsersController doendit "renders 403" do- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendendend@@ -55,14 +55,14 @@ RSpec.describe Avatars::UsersController doit "renders 404" doput :update, params: { id: target_user.id }- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendendit "returns invalid method for post request" dopost :update, params: { id: target_user.id }expect(response).not_to be_successful- expect(response.status).to eq 405+ expect(response).to have_http_status :method_not_allowedendit "calls the service for put" do@@ -72,7 +72,7 @@ RSpec.describe Avatars::UsersController doput :update, params: { id: target_user.id }expect(response).to be_successful- expect(response.status).to eq 200+ expect(response).to have_http_status :okendit "calls the service for put" do@@ -82,7 +82,7 @@ RSpec.describe Avatars::UsersController doput :update, params: { id: target_user.id }expect(response).not_to be_successful- expect(response.status).to eq 400+ expect(response).to have_http_status :bad_requestendend@@ -101,7 +101,7 @@ RSpec.describe Avatars::UsersController doit "returns invalid method for post request" dopost :destroy, params: { id: target_user.id }expect(response).not_to be_successful- expect(response.status).to eq 405+ expect(response).to have_http_status :method_not_allowedendit "calls the service for delete" dodiff --git a/modules/avatars/spec/requests/user_avatar_api_spec.rb b/modules/avatars/spec/requests/user_avatar_api_spec.rbindex 182d1e32e17..02f1a165fa5 100644--- a/modules/avatars/spec/requests/user_avatar_api_spec.rb+++ b/modules/avatars/spec/requests/user_avatar_api_spec.rb@@ -59,7 +59,7 @@ RSpec.describe "API v3 User avatar resource", content_type: :json dolet(:local_avatars) { false }it "renders a 404" do- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendend@@ -80,7 +80,7 @@ RSpec.describe "API v3 User avatar resource", content_type: :json dolet(:local_avatars) { false }it "redirects to gravatar" do- expect(response.status).to eq 302+ expect(response).to have_http_status :foundexpect(response.location).to match /gravatar\.com/end@@ -98,7 +98,7 @@ RSpec.describe "API v3 User avatar resource", content_type: :json doendit "serves the attachment file" do- expect(response.status).to eq 200+ expect(response).to have_http_status :okendit_behaves_like "cache headers set to 24 hours"@@ -117,7 +117,7 @@ RSpec.describe "API v3 User avatar resource", content_type: :json do# so here we just make sue it's called accordingly when the external# storage is configuredit "redirects to temporary external URL" do- expect(response.status).to eq 302+ expect(response).to have_http_status :foundexpect(response.location).to eq "external URL"endenddiff --git a/modules/backlogs/spec/api/work_package_resource_spec.rb b/modules/backlogs/spec/api/work_package_resource_spec.rbindex d2cc6590f82..3c8f3b72777 100644--- a/modules/backlogs/spec/api/work_package_resource_spec.rb+++ b/modules/backlogs/spec/api/work_package_resource_spec.rb@@ -71,7 +71,7 @@ RSpec.describe "API v3 Work package resource" doinclude_context "query work package"- it { expect(last_response.status).to be 200 }+ it { expect(last_response).to have_http_status :ok }it { is_expected.not_to have_json_path("storyPoints") }enddiff --git a/modules/backlogs/spec/api/work_packages/form_resource_spec.rb b/modules/backlogs/spec/api/work_packages/form_resource_spec.rbindex d779a3628f0..3d00016ea38 100644--- a/modules/backlogs/spec/api/work_packages/form_resource_spec.rb+++ b/modules/backlogs/spec/api/work_packages/form_resource_spec.rb@@ -46,7 +46,7 @@ RSpec.describe "API v3 Work package form resource" doshared_examples_for "valid payload" dosubject { response.body }- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it { is_expected.to have_json_path("_embedded/payload") }diff --git a/modules/backlogs/spec/controllers/backlogs_settings_controller_spec.rb b/modules/backlogs/spec/controllers/backlogs_settings_controller_spec.rbindex cd0116e2550..b253fc6e5ad 100644--- a/modules/backlogs/spec/controllers/backlogs_settings_controller_spec.rb+++ b/modules/backlogs/spec/controllers/backlogs_settings_controller_spec.rb@@ -43,7 +43,7 @@ RSpec.describe BacklogsSettingsController doit "fails" doget :show- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendendend@@ -102,7 +102,7 @@ RSpec.describe BacklogsSettingsController dosubjectexpect(response).not_to be_successful- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendendenddiff --git a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rbindex 918736f945c..244145c444e 100644--- a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb+++ b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb@@ -689,7 +689,7 @@ RSpec.describe "BCF 2.1 topics resource", content_type: :json doendit "responds with a not authorized error" do- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenexpect(response.body).to include "You are not authorized to access this resource."endend@@ -707,7 +707,7 @@ RSpec.describe "BCF 2.1 topics resource", content_type: :json doendit "responds with a not authorized error" do- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundexpect(response.body).to include "The requested resource could not be found."endenddiff --git a/modules/bim/spec/requests/ifc_models/set_direct_upload_filename_spec.rb b/modules/bim/spec/requests/ifc_models/set_direct_upload_filename_spec.rbindex 99f468207fa..e86c1cd3650 100644--- a/modules/bim/spec/requests/ifc_models/set_direct_upload_filename_spec.rb+++ b/modules/bim/spec/requests/ifc_models/set_direct_upload_filename_spec.rb@@ -36,7 +36,7 @@ RSpec.describe "POST /projects/:project_id/ifc_models/set_direct_upload_file_namcontext "when user is not logged in" doit "requires login" dopost set_direct_upload_file_name_bcf_project_ifc_models_path(project_id: project.id)- expect(last_response.status).to eq(406) # rubocop:disable RSpecRails/HaveHttpStatus+ expect(last_response).to have_http_status(:not_acceptable)endend@@ -47,7 +47,7 @@ RSpec.describe "POST /projects/:project_id/ifc_models/set_direct_upload_file_namit "returns a 422" dopost set_direct_upload_file_name_bcf_project_ifc_models_path(project_id: project.id),{ title: "Test.ifc", isDefault: "0", filesize: "113328073" }- expect(last_response.status).to eq(422) # rubocop:disable RSpecRails/HaveHttpStatus+ expect(last_response).to have_http_status(:unprocessable_entity)expect(parse_json(last_response.body)).to eq({ "error" => "is too large (maximum size is 1024 Bytes)." })endenddiff --git a/modules/costs/spec/requests/api/time_entries/create_form_resource_spec.rb b/modules/costs/spec/requests/api/time_entries/create_form_resource_spec.rbindex fc326820b9f..6f29298d3b4 100644--- a/modules/costs/spec/requests/api/time_entries/create_form_resource_spec.rb+++ b/modules/costs/spec/requests/api/time_entries/create_form_resource_spec.rb@@ -63,7 +63,7 @@ RSpec.describe API::V3::TimeEntries::CreateFormAPI, content_type: :json dodescribe "#POST /api/v3/time_entries/form" doit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "returns a form" do@@ -190,7 +190,7 @@ RSpec.describe API::V3::TimeEntries::CreateFormAPI, content_type: :json dolet(:permissions) { [] }it "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endenddiff --git a/modules/costs/spec/requests/api/time_entries/update_form_resource_spec.rb b/modules/costs/spec/requests/api/time_entries/update_form_resource_spec.rbindex 2b5166332a3..123958ce1b0 100644--- a/modules/costs/spec/requests/api/time_entries/update_form_resource_spec.rb+++ b/modules/costs/spec/requests/api/time_entries/update_form_resource_spec.rb@@ -64,7 +64,7 @@ RSpec.describe API::V3::TimeEntries::UpdateFormAPI, content_type: :json dodescribe "#POST /api/v3/time_entries/:id/form" doit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "returns a form" do@@ -205,13 +205,13 @@ RSpec.describe API::V3::TimeEntries::UpdateFormAPI, content_type: :json doendit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endendcontext "with the time_entry being of a different user" doit "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endendend@@ -220,7 +220,7 @@ RSpec.describe API::V3::TimeEntries::UpdateFormAPI, content_type: :json dolet(:permissions) { %i[view_time_entries] }it "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endendenddiff --git a/modules/github_integration/spec/requests/extended_root_resource_spec.rb b/modules/github_integration/spec/requests/extended_root_resource_spec.rbindex 03422d4e26e..80fb2cb5513 100644--- a/modules/github_integration/spec/requests/extended_root_resource_spec.rb+++ b/modules/github_integration/spec/requests/extended_root_resource_spec.rb@@ -59,7 +59,7 @@ RSpec.describe "API v3 Root resource with the github integration extension", witendit "responds with 200" do- expect(response.status).to eq(200) # rubocop:disable RSpecRails/HaveHttpStatus+ expect(response).to have_http_status(:ok)endit "does not include the core SHA in the res" do@@ -79,7 +79,7 @@ RSpec.describe "API v3 Root resource with the github integration extension", witendit "responds with 200" do- expect(response.status).to eq(200) # rubocop:disable RSpecRails/HaveHttpStatus+ expect(response).to have_http_status(:ok)endit "does includes the core SHA in the response" dodiff --git a/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb b/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rbindex e6699c875cb..a600b3218ae 100644--- a/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb+++ b/modules/ldap_groups/spec/controllers/synchronized_groups_controller_spec.rb@@ -17,7 +17,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupslet(:logged_in_user) { user }it "does not give access" do- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -38,7 +38,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupsit "does not give access" doget :show, params: { ldap_group_id: id }- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -50,7 +50,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupsit "renders 404" doget :show, params: { ldap_group_id: id }- expect(response.status).to eq(404)+ expect(response).to have_http_status(:not_found)endend@@ -78,7 +78,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupsit "does not give access" doget :new- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -106,7 +106,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupslet(:params) { {} }it "does not give access" do- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -117,7 +117,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupslet(:params) { {} }it "renders 400" do- expect(response.status).to eq(400)+ expect(response).to have_http_status(:bad_request)endend@@ -135,7 +135,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupscontext "and saving fails" doit "renders new page" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(response).to render_template :newendend@@ -150,7 +150,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupsit "does not give access" doget :destroy_info, params: { ldap_group_id: id }- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -162,7 +162,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupsit "renders 404" doget :destroy_info, params: { ldap_group_id: id }- expect(response.status).to eq(404)+ expect(response).to have_http_status(:not_found)endend@@ -191,7 +191,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupsit "does not give access" dodelete :destroy, params: { ldap_group_id: id }- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -203,7 +203,7 @@ RSpec.describe LdapGroups::SynchronizedGroupsController, with_ee: %i[ldap_groupsit "renders 404" dodelete :destroy, params: { ldap_group_id: id }- expect(response.status).to eq(404)+ expect(response).to have_http_status(:not_found)endenddiff --git a/modules/meeting/spec/requests/api/v3/meetings/meetings_resource_spec.rb b/modules/meeting/spec/requests/api/v3/meetings/meetings_resource_spec.rbindex ce5637d5989..5d95cc0309f 100644--- a/modules/meeting/spec/requests/api/v3/meetings/meetings_resource_spec.rb+++ b/modules/meeting/spec/requests/api/v3/meetings/meetings_resource_spec.rb@@ -54,7 +54,7 @@ RSpec.describe "API v3 Meeting resource" docontext "when valid id" doit "returns HTTP 200" do- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendend@@ -62,7 +62,7 @@ RSpec.describe "API v3 Meeting resource" dolet(:permissions) { [:view_work_packages] }it "returns HTTP 404" do- expect(last_response.status).to eq 404+ expect(last_response).to have_http_status :not_foundendenddiff --git a/modules/recaptcha/spec/controllers/admin_controller_spec.rb b/modules/recaptcha/spec/controllers/admin_controller_spec.rbindex b621683c2e7..881057e8945 100644--- a/modules/recaptcha/spec/controllers/admin_controller_spec.rb+++ b/modules/recaptcha/spec/controllers/admin_controller_spec.rb@@ -12,10 +12,10 @@ RSpec.describe Recaptcha::AdminController doit "does not allow access" doget :show- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenpost :update- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendenddiff --git a/modules/storages/spec/requests/api/v3/file_links/file_links_api_spec.rb b/modules/storages/spec/requests/api/v3/file_links/file_links_api_spec.rbindex 1fa11b3698b..7b1ad6e7cd6 100644--- a/modules/storages/spec/requests/api/v3/file_links/file_links_api_spec.rb+++ b/modules/storages/spec/requests/api/v3/file_links/file_links_api_spec.rb@@ -247,7 +247,7 @@ RSpec.describe "API v3 file links resource" dolet(:path) { "#{api_v3_paths.file_links(work_package.id)}?filters=#{CGI.escape(filters.to_json)}" }it "return a 400 HTTP error" do- expect(last_response.status).to be 400+ expect(last_response).to have_http_status :bad_requestendendend@@ -636,7 +636,7 @@ RSpec.describe "API v3 file links resource" dolet(:error) { :not_found }it "fails with outbound request failure" do- expect(last_response.status).to be(500)+ expect(last_response).to have_http_status(:internal_server_error)body = JSON.parse(last_response.body)expect(body["message"]).to eq(I18n.t("api_v3.errors.code_500_outbound_request_failure", status_code: 404))diff --git a/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb b/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rbindex ec601f9c570..f317c0f0766 100644--- a/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb+++ b/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb@@ -31,7 +31,6 @@require "spec_helper"require_module_spec_helper-# rubocop:disable RSpecRails/HaveHttpStatusRSpec.describe "API v3 storage files", :webmock, content_type: :json doinclude API::V3::Utilities::PathHelperinclude StorageServerHelpers@@ -137,20 +136,20 @@ RSpec.describe "API v3 storage files", :webmock, content_type: :json docontext "with authorization failure" dolet(:error) { :unauthorized }- it { expect(last_response.status).to be(500) }+ it { expect(last_response).to have_http_status(:internal_server_error) }endcontext "with internal error" dolet(:error) { :error }- it { expect(last_response.status).to be(500) }+ it { expect(last_response).to have_http_status(:internal_server_error) }endcontext "with not found" dolet(:error) { :not_found }it "fails with outbound request failure" do- expect(last_response.status).to be(500)+ expect(last_response).to have_http_status(:internal_server_error)body = JSON.parse(last_response.body)expect(body["message"]).to eq(I18n.t("api_v3.errors.code_500_outbound_request_failure", status_code: 404))@@ -218,7 +217,7 @@ RSpec.describe "API v3 storage files", :webmock, content_type: :json dolet(:error) { :forbidden }it "fails with outbound request failure" do- expect(last_response.status).to be(500)+ expect(last_response).to have_http_status(:internal_server_error)body = JSON.parse(last_response.body)expect(body["message"]).to eq(I18n.t("api_v3.errors.code_500_outbound_request_failure", status_code: 403))@@ -229,14 +228,14 @@ RSpec.describe "API v3 storage files", :webmock, content_type: :json docontext "with internal error" dolet(:error) { :error }- it { expect(last_response.status).to be(500) }+ it { expect(last_response).to have_http_status(:internal_server_error) }endcontext "with not found" dolet(:error) { :not_found }it "fails with outbound request failure" do- expect(last_response.status).to be(500)+ expect(last_response).to have_http_status(:internal_server_error)body = JSON.parse(last_response.body)expect(body["message"]).to eq(I18n.t("api_v3.errors.code_500_outbound_request_failure", status_code: 404))@@ -288,20 +287,20 @@ RSpec.describe "API v3 storage files", :webmock, content_type: :json dodescribe "due to authorization failure" dolet(:error) { :unauthorized }- it { expect(last_response.status).to be(500) }+ it { expect(last_response).to have_http_status(:internal_server_error) }enddescribe "due to internal error" dolet(:error) { :error }- it { expect(last_response.status).to be(500) }+ it { expect(last_response).to have_http_status(:internal_server_error) }enddescribe "due to not found" dolet(:error) { :not_found }it "fails with outbound request failure" do- expect(last_response.status).to be(500)+ expect(last_response).to have_http_status(:internal_server_error)body = JSON.parse(last_response.body)expect(body["message"]).to eq(I18n.t("api_v3.errors.code_500_outbound_request_failure", status_code: 404))@@ -313,15 +312,13 @@ RSpec.describe "API v3 storage files", :webmock, content_type: :json docontext "with invalid request body" dolet(:body) { { fileNam_: "ape.png", parent: "/Pictures", projectId: project.id }.to_json }- it { expect(last_response.status).to be(400) }+ it { expect(last_response).to have_http_status(:bad_request) }endcontext "without ee token", with_ee: false dolet(:storage) { create(:one_drive_storage, creator: current_user) }- it { expect(last_response.status).to be(500) }+ it { expect(last_response).to have_http_status(:internal_server_error) }endendend--# rubocop:enable RSpecRails/HaveHttpStatusdiff --git a/modules/storages/spec/requests/project_storages_open_spec.rb b/modules/storages/spec/requests/project_storages_open_spec.rbindex 9db041b8c55..d5f61a9cc25 100644--- a/modules/storages/spec/requests/project_storages_open_spec.rb+++ b/modules/storages/spec/requests/project_storages_open_spec.rb@@ -65,7 +65,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" doit "redirects to api_v3_projects_storage_open_url" doget route, {}, { "HTTP_ACCEPT" => "text/html" }- expect(last_response.status).to eq (302)+ expect(last_response).to have_http_status(:found)expect(last_response.headers["Location"]).to eq(expected_redirect_url)endend@@ -74,7 +74,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" doit "renders an appropirate turbo_stream" doget route, {}, { "HTTP_ACCEPT" => "text/vnd.turbo-stream.html" }- expect(last_response.status).to eq (200)+ expect(last_response).to have_http_status(:ok)expect(last_response.body).to eq ("<turbo-stream action=\"update\" target=\"open-project-storage-modal-body-component\">\n <template>\n <div data-view-component=\"true\" class=\"flex-items-center p-4 d-flex flex-column\">\n <div data-view-component=\"true\"> <svg aria-hidden=\"true\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" width=\"24\" data-view-component=\"true\" class=\"octicon octicon-check-circle color-fg-success\">\n <path d=\"M17.28 9.28a.75.75 0 0 0-1.06-1.06l-5.97 5.97-2.47-2.47a.75.75 0 0 0-1.06 1.06l3 3a.75.75 0 0 0 1.06 0l6.5-6.5Z\"></path><path d=\"M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Z\"></path>\n</svg>\n</div>\n <div data-view-component=\"true\"> <h2 data-view-component=\"true\" class=\"text-center\">Integration setup completed</h2>\n</div>\n <div data-view-component=\"true\"> <span data-view-component=\"true\" class=\"text-center color-fg-muted\">You are being redirected</span>\n</div>\n</div>\n\n\n </template>\n</turbo-stream>\n\n")endend@@ -99,7 +99,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" doit "redirects to ensure_connection url with current request url as a destination_url" doget route, {}, { "HTTP_ACCEPT" => "text/html" }- expect(last_response.status).to eq (302)+ expect(last_response).to have_http_status(:found)expect(last_response.headers["Location"]).to eq ("http://example.org/oauth_clients/#{storage.oauth_client.client_id}/ensure_connection?destination_url=http%3A%2F%2Fexample.org%2Fprojects%2F#{project.identifier}%2Fproject_storages%2F#{project_storage.id}%2Fopen&storage_id=#{storage.id}")@@ -110,7 +110,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" doit "redirects to project overview page with modal flash set up" doget route, {}, { "HTTP_ACCEPT" => "text/html" }- expect(last_response.status).to eq (302)+ expect(last_response).to have_http_status(:found)expect(last_response.headers["Location"]).to eq ("http://example.org/projects/#{project.identifier}")expect(last_request.session["flash"]["flashes"]).to eq({@@ -129,7 +129,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" doit "responds with 204 no content" doget route, {}, { "HTTP_ACCEPT" => "text/vnd.turbo-stream.html" }- expect(last_response.status).to eq (204)+ expect(last_response).to have_http_status(:no_content)expect(last_response.body).to eq ("")endend@@ -141,7 +141,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" doit "redirects to project overview page with modal flash set up" doget route, {}, { "HTTP_ACCEPT" => "text/html" }- expect(last_response.status).to eq (302)+ expect(last_response).to have_http_status(:found)expect(last_response.headers["Location"]).to eq ("http://example.org/projects/#{project.identifier}")expect(last_request.session["flash"]["flashes"]).to eq({@@ -159,7 +159,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" doit "responds with 204 no content" doget route, {}, { "HTTP_ACCEPT" => "text/vnd.turbo-stream.html" }- expect(last_response.status).to eq (204)+ expect(last_response).to have_http_status(:no_content)expect(last_response.body).to eq ("")endend@@ -170,7 +170,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" doit "redirects to storage_open_url" doget route, {}, { "HTTP_ACCEPT" => "text/html" }- expect(last_response.status).to eq (302)+ expect(last_response).to have_http_status(:found)expect(last_response.headers["Location"]).to eq (expected_redirect_url)endend@@ -181,7 +181,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" doit "responds with 403" doget route, {}, { "HTTP_ACCEPT" => "text/html" }- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endendend@@ -189,7 +189,7 @@ RSpec.describe "projects/:project_id/project_storages/:id/open" docontext "when user is not logged in" doit "responds with 401" doget route- expect(last_response.status).to eq(401)+ expect(last_response).to have_http_status(:unauthorized)endendenddiff --git a/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rb b/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rbindex f925e9a49a1..eb2def019f9 100644--- a/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rb+++ b/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rb@@ -55,7 +55,7 @@ RSpec.describe "GET /projects/:project_id/settings/project_storages/:id/oauth_acproject_id: project_storage.project.id,id: project_storage)- expect(last_response.status).to eq(401)+ expect(last_response).to have_http_status(:unauthorized)endend@@ -78,7 +78,7 @@ RSpec.describe "GET /projects/:project_id/settings/project_storages/:id/oauth_acproject_id: project_storage.project.id,id: project_storage)- expect(last_response.status).to eq(302)+ expect(last_response).to have_http_status(:found)expect(last_response.location).to eq("#{storage.host}/index.php/apps/oauth2/authorize?client_id=#{storage.oauth_client.client_id}&" \"redirect_uri=#{redirect_uri}&response_type=code&state=#{nonce}"@@ -104,7 +104,7 @@ RSpec.describe "GET /projects/:project_id/settings/project_storages/:id/oauth_ac)storage.oauth_client- expect(last_response.status).to eq(302)+ expect(last_response).to have_http_status(:found)expect(last_response.location).to eq("http://example.org/projects/#{project.id}/settings/project_storages/external_file_storages")expect(last_response.cookies.keys).to eq(["_open_project_session"])enddiff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rbindex 82208614009..6edf06bba56 100644--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb@@ -33,7 +33,7 @@ RSpec.describe TwoFactorAuthentication::AuthenticationController, with_settings:endit "returns a 500" do- expect(response.status).to eq 500+ expect(response).to have_http_status :internal_server_errorendenddiff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rbindex 2f07ea2454c..7822efd1f35 100644--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb@@ -48,7 +48,7 @@ RSpec.describe TwoFactorAuthentication::ForcedRegistration::TwoFactorDevicesContcontext "when logged in, but not enabled" doit "does not give access" do- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendend@@ -123,7 +123,7 @@ RSpec.describe TwoFactorAuthentication::ForcedRegistration::TwoFactorDevicesContdescribe "#get" doit "croaks on missing id" doget :confirm, params: { device_id: 1234 }- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundenddescribe "and registered totp device" do@@ -162,7 +162,7 @@ RSpec.describe TwoFactorAuthentication::ForcedRegistration::TwoFactorDevicesContdescribe "#post" doit "croaks on missing id" doget :confirm, params: { device_id: 1234 }- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundenddescribe "and registered totp device" dodiff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rbindex 3715283ff62..08560809f19 100644--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb@@ -42,7 +42,7 @@ RSpec.describe TwoFactorAuthentication::My::TwoFactorDevicesController docontext "when logged in, but not enabled" doit "does not give access" do- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendend@@ -117,7 +117,7 @@ RSpec.describe TwoFactorAuthentication::My::TwoFactorDevicesController dodescribe "#get" doit "croaks on missing id" doget :confirm, params: { device_id: 1234 }- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundenddescribe "and registered totp device" do@@ -156,7 +156,7 @@ RSpec.describe TwoFactorAuthentication::My::TwoFactorDevicesController dodescribe "#post" doit "croaks on missing id" doget :confirm, params: { device_id: 1234 }- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundenddescribe "and registered totp device" do@@ -226,7 +226,7 @@ RSpec.describe TwoFactorAuthentication::My::TwoFactorDevicesController dodescribe "#destroy" doit "croaks on missing id" dodelete :destroy, params: { device_id: "1234" }- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendcontext "assuming password check is valid" dodiff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rbindex a3765104c70..a843d38dc37 100644--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb@@ -35,7 +35,7 @@ RSpec.describe TwoFactorAuthentication::Users::TwoFactorDevicesController dolet(:logged_in_user) { other_user }it "does not give access" do- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -43,7 +43,7 @@ RSpec.describe TwoFactorAuthentication::Users::TwoFactorDevicesController dolet(:logged_in_user) { user }it "does not give access" do- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -59,7 +59,7 @@ RSpec.describe TwoFactorAuthentication::Users::TwoFactorDevicesController dolet(:active_strategies) { [] }it "renders a 404 because no strategies enabled" do- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendendend@@ -182,7 +182,7 @@ RSpec.describe TwoFactorAuthentication::Users::TwoFactorDevicesController dodescribe "#destroy" doit "croaks on missing id" dodelete :destroy, params: { id: user.id, device_id: "1234" }- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendcontext "with existing non-default device" dodiff --git a/modules/webhooks/spec/controllers/outgoing/admin_controller_spec.rb b/modules/webhooks/spec/controllers/outgoing/admin_controller_spec.rbindex 449c04b3c76..0c57a2576a6 100644--- a/modules/webhooks/spec/controllers/outgoing/admin_controller_spec.rb+++ b/modules/webhooks/spec/controllers/outgoing/admin_controller_spec.rb@@ -40,7 +40,7 @@ RSpec.describe Webhooks::Outgoing::AdminController doit "renders 403" doget :index- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -139,7 +139,7 @@ RSpec.describe Webhooks::Outgoing::AdminController doit "renders 404" doget :edit, params: { webhook_id: "1234" }expect(response).not_to be_successful- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendendend@@ -157,7 +157,7 @@ RSpec.describe Webhooks::Outgoing::AdminController doit "renders an error" doput :update, params: { webhook_id: "bar" }expect(response).not_to be_successful- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendenddiff --git a/spec/controllers/enterprises_controller_spec.rb b/spec/controllers/enterprises_controller_spec.rbindex d836668e2c8..305f4ed5e47 100644--- a/spec/controllers/enterprises_controller_spec.rb+++ b/spec/controllers/enterprises_controller_spec.rb@@ -181,7 +181,7 @@ RSpec.describe EnterprisesController doendit "renders 404" do- expect(response.status).to eq(404)+ expect(response).to have_http_status(:not_found)endendend@@ -195,7 +195,7 @@ RSpec.describe EnterprisesController doendit "is forbidden" do- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendendenddiff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rbindex b2df0e6b684..a9304c329e8 100644--- a/spec/controllers/forums_controller_spec.rb+++ b/spec/controllers/forums_controller_spec.rb@@ -74,7 +74,7 @@ RSpec.describe ForumsController docontext "when not login_required", with_settings: { login_required: false } doit "renders 404 for not found" doget :index, params: { project_id: "not found" }- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendendenddiff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rbindex 12857c57628..bd903af6ae8 100644--- a/spec/controllers/groups_controller_spec.rb+++ b/spec/controllers/groups_controller_spec.rb@@ -179,7 +179,7 @@ RSpec.describe GroupsController doit "forbids index" doget :indexexpect(response).not_to be_successful- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendit "shows" do@@ -191,7 +191,7 @@ RSpec.describe GroupsController doit "forbids new" doget :newexpect(response).not_to be_successful- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendit "forbids create" do@@ -200,14 +200,14 @@ RSpec.describe GroupsController doend.not_to(change(Group, :count))expect(response).not_to be_successful- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendit "forbids edit" doget :edit, params: { id: group.id }expect(response).not_to be_successful- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendendenddiff --git a/spec/controllers/homescreen_controller_spec.rb b/spec/controllers/homescreen_controller_spec.rbindex 2d1b8eabfad..92c19e4d53b 100644--- a/spec/controllers/homescreen_controller_spec.rb+++ b/spec/controllers/homescreen_controller_spec.rb@@ -46,7 +46,7 @@ RSpec.describe HomescreenController doshared_examples "renders blocks" doit "renders a response" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)enddescribe "with rendered views" dodiff --git a/spec/controllers/my_controller_spec.rb b/spec/controllers/my_controller_spec.rbindex 627a500e55a..3b2fc53d539 100644--- a/spec/controllers/my_controller_spec.rb+++ b/spec/controllers/my_controller_spec.rb@@ -212,7 +212,7 @@ RSpec.describe MyController dolet!(:user_session) { Sessions::UserSession.find_by(session_id: "internal_foobar") }let(:params) do- { user: { mail: "[email protected]"} }+ { user: { mail: "[email protected]" } }endit "clears other sessions and removes tokens" dodiff --git a/spec/controllers/placeholder_users/memberships_controller_spec.rb b/spec/controllers/placeholder_users/memberships_controller_spec.rbindex b4bf36edf6e..f8e5e28c4c5 100644--- a/spec/controllers/placeholder_users/memberships_controller_spec.rb+++ b/spec/controllers/placeholder_users/memberships_controller_spec.rb@@ -70,7 +70,7 @@ RSpec.describe PlaceholderUsers::MembershipsController do}}- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -81,7 +81,7 @@ RSpec.describe PlaceholderUsers::MembershipsController doid: 1234}- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendend@@ -92,7 +92,7 @@ RSpec.describe PlaceholderUsers::MembershipsController doid: 1234}- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendendend@@ -126,7 +126,7 @@ RSpec.describe PlaceholderUsers::MembershipsController do}}- expect(response.status).to eq 302+ expect(response).to have_http_status :foundexpect(placeholder_user.reload.memberships).to be_emptyendend@@ -142,7 +142,7 @@ RSpec.describe PlaceholderUsers::MembershipsController doid: membership.id}- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendend@@ -153,7 +153,7 @@ RSpec.describe PlaceholderUsers::MembershipsController doid: membership.id}- expect(response.status).to eq 404+ expect(response).to have_http_status :not_foundendendenddiff --git a/spec/controllers/placeholder_users_controller_spec.rb b/spec/controllers/placeholder_users_controller_spec.rbindex 401464a45a1..f1c371a40a4 100644--- a/spec/controllers/placeholder_users_controller_spec.rb+++ b/spec/controllers/placeholder_users_controller_spec.rb@@ -35,7 +35,7 @@ RSpec.describe PlaceholderUsersController doshared_examples "do not allow non-admins" doit "responds with unauthorized status" doexpect(response).not_to be_successful- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -348,7 +348,7 @@ RSpec.describe PlaceholderUsersController doit "responds with unauthorized status" doexpect(response).not_to be_successful- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -359,7 +359,7 @@ RSpec.describe PlaceholderUsersController doit "responds with unauthorized status" doexpect(response).not_to be_successful- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendendenddiff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rbindex ec6ae981a62..db43e15d6b6 100644--- a/spec/controllers/projects_controller_spec.rb+++ b/spec/controllers/projects_controller_spec.rb@@ -156,7 +156,7 @@ RSpec.describe ProjectsController doit "shows an error" doget "copy", params: { id: project.id }- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendendenddiff --git a/spec/controllers/types_controller_spec.rb b/spec/controllers/types_controller_spec.rbindex 88e8a5f7e73..8c8b464ec2c 100644--- a/spec/controllers/types_controller_spec.rb+++ b/spec/controllers/types_controller_spec.rb@@ -53,7 +53,7 @@ RSpec.describe TypesController dodescribe "the access should be restricted" dobefore { get "index" }- it { expect(response.status).to eq(403) }+ it { expect(response).to have_http_status(:forbidden) }endend@@ -61,7 +61,7 @@ RSpec.describe TypesController dodescribe "the access should be restricted" dobefore { get "new" }- it { expect(response.status).to eq(403) }+ it { expect(response).to have_http_status(:forbidden) }endend@@ -69,7 +69,7 @@ RSpec.describe TypesController dodescribe "the access should be restricted" dobefore { get "edit", params: { id: "123" } }- it { expect(response.status).to eq(403) }+ it { expect(response).to have_http_status(:forbidden) }endend@@ -77,7 +77,7 @@ RSpec.describe TypesController dodescribe "the access should be restricted" dobefore { post "create" }- it { expect(response.status).to eq(403) }+ it { expect(response).to have_http_status(:forbidden) }endend@@ -85,7 +85,7 @@ RSpec.describe TypesController dodescribe "the access should be restricted" dobefore { delete "destroy", params: { id: "123" } }- it { expect(response.status).to eq(403) }+ it { expect(response).to have_http_status(:forbidden) }endend@@ -93,7 +93,7 @@ RSpec.describe TypesController dodescribe "the access should be restricted" dobefore { post "update", params: { id: "123" } }- it { expect(response.status).to eq(403) }+ it { expect(response).to have_http_status(:forbidden) }endend@@ -101,7 +101,7 @@ RSpec.describe TypesController dodescribe "the access should be restricted" dobefore { post "move", params: { id: "123" } }- it { expect(response.status).to eq(403) }+ it { expect(response).to have_http_status(:forbidden) }endendend@@ -161,7 +161,7 @@ RSpec.describe TypesController dopost :create, params:end- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "shows an error message" doexpect(response.body).to have_content("Name can't be blank")diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rbindex 9c590f3b7aa..30719976b88 100644--- a/spec/controllers/users_controller_spec.rb+++ b/spec/controllers/users_controller_spec.rb@@ -194,7 +194,7 @@ RSpec.describe UsersController doendit "returns 403 forbidden" do- expect(response.status).to eq 403+ expect(response).to have_http_status :forbiddenendend@@ -401,7 +401,7 @@ RSpec.describe UsersController dolet(:change_action) { :wtf }it "renders 400" do- expect(response.status).to eq(400)+ expect(response).to have_http_status(:bad_request)expect(response).not_to render_template "users/change_status_info"endenddiff --git a/spec/controllers/versions_controller_spec.rb b/spec/controllers/versions_controller_spec.rbindex 38ae203668d..9883e8ed6fd 100644--- a/spec/controllers/versions_controller_spec.rb+++ b/spec/controllers/versions_controller_spec.rb@@ -243,7 +243,7 @@ RSpec.describe VersionsController doit "renders correctly" dologin_as(user)get :new, params: { project_id: project.id }- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endenddiff --git a/spec/controllers/wiki_controller_spec.rb b/spec/controllers/wiki_controller_spec.rbindex 9adb4949762..0b0d4822b70 100644--- a/spec/controllers/wiki_controller_spec.rb+++ b/spec/controllers/wiki_controller_spec.rb@@ -110,7 +110,7 @@ RSpec.describe WikiController doit "renders 404 if used with an unknown page title" doget "new_child", params: { project_id: project, id: "foobar" }- expect(response.status).to eq(404) # not found+ expect(response).to have_http_status(:not_found)endenddiff --git a/spec/controllers/wiki_menu_authentication_spec.rb b/spec/controllers/wiki_menu_authentication_spec.rbindex f67dc5b33bc..7ec8ec5c3b4 100644--- a/spec/controllers/wiki_menu_authentication_spec.rb+++ b/spec/controllers/wiki_menu_authentication_spec.rb@@ -62,7 +62,7 @@ RSpec.describe WikiMenuItemsController doget "edit", params: @params- expect(response.status).to eq(403) # forbidden+ expect(response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/activities_by_work_package_resource_spec.rb b/spec/requests/api/v3/activities_by_work_package_resource_spec.rbindex eb8198d6c67..18ae1c9fd0e 100644--- a/spec/requests/api/v3/activities_by_work_package_resource_spec.rb+++ b/spec/requests/api/v3/activities_by_work_package_resource_spec.rb@@ -52,14 +52,14 @@ RSpec.describe API::V3::Activities::ActivitiesByWorkPackageAPI doendit "succeeds" do- expect(last_response.status).to be 200+ expect(last_response).to have_http_status :okendcontext "not allowed to see work package" dolet(:current_user) { create(:user) }it "fails with HTTP Not Found" do- expect(last_response.status).to be 404+ expect(last_response).to have_http_status :not_foundendendend@@ -96,7 +96,7 @@ RSpec.describe API::V3::Activities::ActivitiesByWorkPackageAPI doinclude_context "create activity"it "responds with error" do- expect(last_response.status).to be 422+ expect(last_response).to have_http_status :unprocessable_entityendit "notes the error" dodiff --git a/spec/requests/api/v3/attachments_spec.rb b/spec/requests/api/v3/attachments_spec.rbindex 3385e8b8dc9..6fbd11c32b5 100644--- a/spec/requests/api/v3/attachments_spec.rb+++ b/spec/requests/api/v3/attachments_spec.rb@@ -55,7 +55,7 @@ RSpec.describe API::V3::Attachments::AttachmentsAPI dolet(:permissions) { [] }it "forbids to prepare attachments" do- expect(last_response.status).to eq 403+ expect(last_response).to have_http_status :forbiddenendend@@ -63,7 +63,7 @@ RSpec.describe API::V3::Attachments::AttachmentsAPI dolet(:permissions) { [:edit_work_packages] }it "can prepare attachments" do- expect(last_response.status).to eq 201+ expect(last_response).to have_http_status :createdendend@@ -71,7 +71,7 @@ RSpec.describe API::V3::Attachments::AttachmentsAPI dolet(:permissions) { [:add_work_package_attachments] }it "can prepare attachments" do- expect(last_response.status).to eq 201+ expect(last_response).to have_http_status :createdendendend@@ -94,7 +94,7 @@ RSpec.describe API::V3::Attachments::AttachmentsAPI dolet(:status) { :uploaded }it "returns 404" do- expect(last_response.status).to eq 404+ expect(last_response).to have_http_status :not_foundendend@@ -104,7 +104,7 @@ RSpec.describe API::V3::Attachments::AttachmentsAPI doendit "responds with HTTP OK" do- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendit "returns the attachment representation" dodiff --git a/spec/requests/api/v3/authentication_spec.rb b/spec/requests/api/v3/authentication_spec.rbindex 10ee53ab576..ca642ee1d4c 100644--- a/spec/requests/api/v3/authentication_spec.rb+++ b/spec/requests/api/v3/authentication_spec.rb@@ -48,7 +48,7 @@ RSpec.describe API::V3 dolet(:oauth_access_token) { token.plaintext_token }it "authenticates successfully" do- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendend@@ -56,7 +56,7 @@ RSpec.describe API::V3 dolet(:oauth_access_token) { "1337" }it "returns unauthorized" do- expect(last_response.status).to eq 401+ expect(last_response).to have_http_status :unauthorizedendend@@ -65,7 +65,7 @@ RSpec.describe API::V3 dolet(:oauth_access_token) { token.plaintext_token }it "returns unauthorized" do- expect(last_response.status).to eq 401+ expect(last_response).to have_http_status :unauthorizedendendend@@ -97,7 +97,7 @@ RSpec.describe API::V3 doendit "returns 401 unauthorized" do- expect(last_response.status).to eq 401+ expect(last_response).to have_http_status :unauthorizedendendend@@ -109,7 +109,7 @@ RSpec.describe API::V3 doendit "returns 401 unauthorized" do- expect(last_response.status).to eq 401+ expect(last_response).to have_http_status :unauthorizedendit "returns the correct JSON response" do@@ -131,7 +131,7 @@ RSpec.describe API::V3 doendit "returns 401 unauthorized" do- expect(last_response.status).to eq 401+ expect(last_response).to have_http_status :unauthorizedendit "returns the correct JSON response" do@@ -156,7 +156,7 @@ RSpec.describe API::V3 doendit "returns 401 unauthorized" do- expect(last_response.status).to eq 401+ expect(last_response).to have_http_status :unauthorizedendit "returns the correct JSON response" do@@ -183,7 +183,7 @@ RSpec.describe API::V3 doendit "returns 401 unauthorized" do- expect(last_response.status).to eq 401+ expect(last_response).to have_http_status :unauthorizedendit "returns the correct JSON response" do@@ -207,7 +207,7 @@ RSpec.describe API::V3 doendit "returns 200 OK" do- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendendend@@ -276,7 +276,7 @@ RSpec.describe API::V3 doendit "returns 200 OK" do- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendit '"login"s the anonymous user' do@@ -291,7 +291,7 @@ RSpec.describe API::V3 doendit "returns 401 unauthorized" do- expect(last_response.status).to eq 401+ expect(last_response).to have_http_status :unauthorizedendend@@ -302,7 +302,7 @@ RSpec.describe API::V3 doendit "returns 200 OK" do- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendend@@ -313,7 +313,7 @@ RSpec.describe API::V3 doendit "returns 200 OK" do- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendendenddiff --git a/spec/requests/api/v3/backups/backups_api_spec.rb b/spec/requests/api/v3/backups/backups_api_spec.rbindex dc964fc06b5..190e0dd1df4 100644--- a/spec/requests/api/v3/backups/backups_api_spec.rb+++ b/spec/requests/api/v3/backups/backups_api_spec.rb@@ -59,7 +59,7 @@ RSpec.describe API::V3::Backups::BackupsAPI, with_config: { backup_enabled: trueinclude_context "request"it "results in a bad request error" do- expect(last_response.status).to eq 400+ expect(last_response).to have_http_status :bad_requestendend@@ -74,7 +74,7 @@ RSpec.describe API::V3::Backups::BackupsAPI, with_config: { backup_enabled: trueendit "enqueues the backup including attachments" do- expect(last_response.status).to eq 202+ expect(last_response).to have_http_status :acceptedendend@@ -91,7 +91,7 @@ RSpec.describe API::V3::Backups::BackupsAPI, with_config: { backup_enabled: trueendit "enqueues a backup not including attachments" do- expect(last_response.status).to eq 202+ expect(last_response).to have_http_status :acceptedendendend@@ -103,7 +103,7 @@ RSpec.describe API::V3::Backups::BackupsAPI, with_config: { backup_enabled: trueinclude_context "request"it "results in a conflict" do- expect(last_response.status).to eq 409+ expect(last_response).to have_http_status :conflictendend@@ -113,7 +113,7 @@ RSpec.describe API::V3::Backups::BackupsAPI, with_config: { backup_enabled: trueinclude_context "request"it "is forbidden" do- expect(last_response.status).to eq 403+ expect(last_response).to have_http_status :forbiddenendend@@ -124,7 +124,7 @@ RSpec.describe API::V3::Backups::BackupsAPI, with_config: { backup_enabled: trueinclude_context "request"it "is forbidden" do- expect(last_response.status).to eq 403+ expect(last_response).to have_http_status :forbiddenendend@@ -132,7 +132,7 @@ RSpec.describe API::V3::Backups::BackupsAPI, with_config: { backup_enabled: trueinclude_context "request"it "is rate limited" do- expect(last_response.status).to eq 429+ expect(last_response).to have_http_status :too_many_requestsendend@@ -142,7 +142,7 @@ RSpec.describe API::V3::Backups::BackupsAPI, with_config: { backup_enabled: trueinclude_context "request"it "is forbidden" do- expect(last_response.status).to eq 403+ expect(last_response).to have_http_status :forbiddenendit "shows the remaining hours until the token is valid" dodiff --git a/spec/requests/api/v3/content_type_header_spec.rb b/spec/requests/api/v3/content_type_header_spec.rbindex 5bd99118355..28c40942752 100644--- a/spec/requests/api/v3/content_type_header_spec.rb+++ b/spec/requests/api/v3/content_type_header_spec.rb@@ -50,7 +50,7 @@ RSpec.describe "API v3 Content-Type header" docontext "on a GET request" doit "is successful" doget api_v3_paths.work_package(work_package.id)- expect(last_response.status).not_to eq(406)+ expect(last_response.status).not_to have_http_status(:not_acceptable)expect(last_response).to be_okendend@@ -58,7 +58,7 @@ RSpec.describe "API v3 Content-Type header" docontext "on a DELETE request" doit "is successful" dodelete api_v3_paths.work_package(work_package.id)- expect(last_response.status).not_to eq(406)+ expect(last_response.status).not_to have_http_status(:not_acceptable)expect(last_response).to be_no_contentendend@@ -66,7 +66,7 @@ RSpec.describe "API v3 Content-Type header" docontext "on any other HTTP method" doit "responds with a 406 status and a missing Content-Type header message" dopatch api_v3_paths.work_package(work_package.id), {}- expect(last_response.status).to eq(406)+ expect(last_response).to have_http_status(:not_acceptable)expect(last_response.body).to include("Missing content-type header")endenddiff --git a/spec/requests/api/v3/groups/group_resource_spec.rb b/spec/requests/api/v3/groups/group_resource_spec.rbindex 4d6619fe9b0..218aa13f056 100644--- a/spec/requests/api/v3/groups/group_resource_spec.rb+++ b/spec/requests/api/v3/groups/group_resource_spec.rb@@ -122,7 +122,7 @@ RSpec.describe "API v3 Group resource", content_type: :json docurrent_user { create(:admin) }it "responds with 201" do- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)endit "creates the group and sets the members" do@@ -155,7 +155,7 @@ RSpec.describe "API v3 Group resource", content_type: :json doendit "responds with 422 and explains the error" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("Name can't be blank.".to_json)@@ -221,7 +221,7 @@ RSpec.describe "API v3 Group resource", content_type: :json docurrent_user { admin }it "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "updates the group" dodiff --git a/spec/requests/api/v3/help_texts/help_texts_resource_spec.rb b/spec/requests/api/v3/help_texts/help_texts_resource_spec.rbindex 55acc25f70d..5a56e499fd9 100644--- a/spec/requests/api/v3/help_texts/help_texts_resource_spec.rb+++ b/spec/requests/api/v3/help_texts/help_texts_resource_spec.rb@@ -86,7 +86,7 @@ RSpec.describe "API v3 Help texts resource" doendcontext "valid type id" do- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }endcontext "invalid type id" dodiff --git a/spec/requests/api/v3/membership_resources_spec.rb b/spec/requests/api/v3/membership_resources_spec.rbindex 1a64fbfb490..d2597ca63e4 100644--- a/spec/requests/api/v3/membership_resources_spec.rb+++ b/spec/requests/api/v3/membership_resources_spec.rb@@ -438,7 +438,7 @@ RSpec.describe "API v3 memberships resource", content_type: :json dolet(:role) { defined?(expected_role) ? expected_role : other_role }it "responds with 201" do- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)endit "creates the member" do@@ -675,7 +675,7 @@ RSpec.describe "API v3 memberships resource", content_type: :json docontext "as a non admin" doit "responds with 422 and explains the error" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("Project can't be blank.".to_json)@@ -705,7 +705,7 @@ RSpec.describe "API v3 memberships resource", content_type: :json doendit "responds with 422 and explains the error" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("User has already been taken.".to_json)@@ -734,7 +734,7 @@ RSpec.describe "API v3 memberships resource", content_type: :json doendit "responds with 422 and explains the error" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)error_message = "For property 'user' a link like '/api/v3/groups/:id' or " +"'/api/v3/users/:id' or '/api/v3/placeholder_users/:id' is expected, " +@@ -762,7 +762,7 @@ RSpec.describe "API v3 memberships resource", content_type: :json doendit "responds with 422 and explains the error" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("Roles need to be assigned.".to_json)@@ -862,7 +862,7 @@ RSpec.describe "API v3 memberships resource", content_type: :json docontext "for a user" doit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "updates the member" do@@ -955,7 +955,7 @@ RSpec.describe "API v3 memberships resource", content_type: :json dolet(:last_user_member_updated_at) { Member.find_by(principal: users.last).updated_at }it "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "updates the member and all inherited members but does not update memberships users have already had" do@@ -1038,7 +1038,7 @@ RSpec.describe "API v3 memberships resource", content_type: :json dolet(:another_role) { create(:global_role) }it "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "updates the member and all inherited members but does not update memberships users have already had" dodiff --git a/spec/requests/api/v3/memberships/create_form_resource_spec.rb b/spec/requests/api/v3/memberships/create_form_resource_spec.rbindex 20e10935ceb..51e8128ebac 100644--- a/spec/requests/api/v3/memberships/create_form_resource_spec.rb+++ b/spec/requests/api/v3/memberships/create_form_resource_spec.rb@@ -53,7 +53,7 @@ RSpec.describe API::V3::Memberships::CreateFormAPI, content_type: :json dodescribe "#POST /api/v3/memberships/form" doit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "returns a form" do@@ -157,7 +157,7 @@ RSpec.describe API::V3::Memberships::CreateFormAPI, content_type: :json dolet(:permissions) { [] }it "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/memberships/update_form_resource_spec.rb b/spec/requests/api/v3/memberships/update_form_resource_spec.rbindex fbb950b1ced..ffcbcf508e3 100644--- a/spec/requests/api/v3/memberships/update_form_resource_spec.rb+++ b/spec/requests/api/v3/memberships/update_form_resource_spec.rb@@ -73,7 +73,7 @@ RSpec.describe API::V3::Memberships::UpdateFormAPI, content_type: :json dodescribe "#POST /api/v3/memberships/:id/form" doit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "returns a form" do@@ -217,7 +217,7 @@ RSpec.describe API::V3::Memberships::UpdateFormAPI, content_type: :json dolet(:permissions) { [:view_members] }it "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endend@@ -225,7 +225,7 @@ RSpec.describe API::V3::Memberships::UpdateFormAPI, content_type: :json dolet(:permissions) { [] }it "returns 404 Not Found" do- expect(response.status).to eq(404)+ expect(response).to have_http_status(:not_found)endendenddiff --git a/spec/requests/api/v3/notifications/details_resource_spec.rb b/spec/requests/api/v3/notifications/details_resource_spec.rbindex 81a0901514b..e374c098cab 100644--- a/spec/requests/api/v3/notifications/details_resource_spec.rb+++ b/spec/requests/api/v3/notifications/details_resource_spec.rb@@ -77,7 +77,7 @@ RSpec.describe API::V3::Notifications::NotificationsAPI,it "returns a 404 response" dosend_request- expect(last_response.status).to eq(404)+ expect(last_response).to have_http_status(:not_found)endend@@ -151,7 +151,7 @@ RSpec.describe API::V3::Notifications::NotificationsAPI,endit "returns a 404 response" do- expect(last_response.status).to eq(404)+ expect(last_response).to have_http_status(:not_found)endend@@ -163,7 +163,7 @@ RSpec.describe API::V3::Notifications::NotificationsAPI,endit "returns a 404 response" do- expect(last_response.status).to eq(404)+ expect(last_response).to have_http_status(:not_found)endendenddiff --git a/spec/requests/api/v3/notifications/read_ian_resource_spec.rb b/spec/requests/api/v3/notifications/read_ian_resource_spec.rbindex 696cd8eba49..cd63f2feba7 100644--- a/spec/requests/api/v3/notifications/read_ian_resource_spec.rb+++ b/spec/requests/api/v3/notifications/read_ian_resource_spec.rb@@ -64,11 +64,11 @@ RSpec.describe API::V3::Notifications::NotificationsAPI,it "can read and unread" dosend_read- expect(last_response.status).to eq(204)+ expect(last_response).to have_http_status(:no_content)expect(notification.reload.read_ian).to be_truthysend_unread- expect(last_response.status).to eq(204)+ expect(last_response).to have_http_status(:no_content)expect(notification.reload.read_ian).to be_falseyendend@@ -78,10 +78,10 @@ RSpec.describe API::V3::Notifications::NotificationsAPI,it "returns a 404 response" dosend_read- expect(last_response.status).to eq(404)+ expect(last_response).to have_http_status(:not_found)send_unread- expect(last_response.status).to eq(404)+ expect(last_response).to have_http_status(:not_found)endendenddiff --git a/spec/requests/api/v3/notifications/show_resource_spec.rb b/spec/requests/api/v3/notifications/show_resource_spec.rbindex c12bce676fa..82a8310bfa1 100644--- a/spec/requests/api/v3/notifications/show_resource_spec.rb+++ b/spec/requests/api/v3/notifications/show_resource_spec.rb@@ -99,7 +99,7 @@ RSpec.describe API::V3::Notifications::NotificationsAPI,endit "returns a 404 response" do- expect(last_response.status).to eq(404)+ expect(last_response).to have_http_status(:not_found)endend@@ -111,7 +111,7 @@ RSpec.describe API::V3::Notifications::NotificationsAPI,endit "returns a 404 response" do- expect(last_response.status).to eq(404)+ expect(last_response).to have_http_status(:not_found)endendenddiff --git a/spec/requests/api/v3/placeholder_users/create_resource_spec.rb b/spec/requests/api/v3/placeholder_users/create_resource_spec.rbindex faefd36171b..0360cbe4000 100644--- a/spec/requests/api/v3/placeholder_users/create_resource_spec.rb+++ b/spec/requests/api/v3/placeholder_users/create_resource_spec.rb@@ -51,7 +51,7 @@ RSpec.describe API::V3::PlaceholderUsers::PlaceholderUsersAPI,it "returns an erroneous response" dosend_request- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/placeholder_users/create_shared_examples.rb b/spec/requests/api/v3/placeholder_users/create_shared_examples.rbindex d0827cd509b..32ed68004b2 100644--- a/spec/requests/api/v3/placeholder_users/create_shared_examples.rb+++ b/spec/requests/api/v3/placeholder_users/create_shared_examples.rb@@ -50,7 +50,7 @@ RSpec.shared_examples "create placeholder user request flow" doit "returns an erroneous response" dosend_request- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("urn:openproject-org:api:v3:errors:PropertyConstraintViolation".to_json).at_path("errorIdentifier")@@ -63,7 +63,7 @@ RSpec.shared_examples "create placeholder user request flow" doit "creates the placeholder when valid" dosend_request- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)placeholder = PlaceholderUser.find_by(name: parameters[:name])expect(placeholder).to be_presentend@@ -74,7 +74,7 @@ RSpec.shared_examples "create placeholder user request flow" doit "returns an error" dosend_request- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("urn:openproject-org:api:v3:errors:PropertyConstraintViolation".to_json).at_path("errorIdentifier")@@ -92,7 +92,7 @@ RSpec.shared_examples "create placeholder user request flow" doit "adds an error that its only available in EE" dosend_request- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(parsed_response["message"]).to eq("Placeholder Users is only available in the OpenProject Enterprise edition")diff --git a/spec/requests/api/v3/placeholder_users/delete_resource_examples.rb b/spec/requests/api/v3/placeholder_users/delete_resource_examples.rbindex 185e6efc7f4..1df31faf3de 100644--- a/spec/requests/api/v3/placeholder_users/delete_resource_examples.rb+++ b/spec/requests/api/v3/placeholder_users/delete_resource_examples.rb@@ -27,7 +27,7 @@RSpec.shared_examples "deletion allowed" doit "responds with 202" do- expect(last_response.status).to eq 202+ expect(last_response).to have_http_status :acceptedendit "locks the account and mark for deletion" do@@ -47,7 +47,7 @@ endRSpec.shared_examples "deletion is not allowed" doit "responds with 403" do- expect(last_response.status).to eq 403+ expect(last_response).to have_http_status :forbiddenendit "does not delete the user" dodiff --git a/spec/requests/api/v3/placeholder_users/show_resource_examples.rb b/spec/requests/api/v3/placeholder_users/show_resource_examples.rbindex 1a7f451172e..1d4da78c9c7 100644--- a/spec/requests/api/v3/placeholder_users/show_resource_examples.rb+++ b/spec/requests/api/v3/placeholder_users/show_resource_examples.rb@@ -27,7 +27,7 @@RSpec.shared_examples "represents the placeholder" doit do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)expect(last_response.body).to(be_json_eql("PlaceholderUser".to_json).at_path("_type"))diff --git a/spec/requests/api/v3/placeholder_users/show_resource_spec.rb b/spec/requests/api/v3/placeholder_users/show_resource_spec.rbindex 3a4cd43697c..2f598b749a0 100644--- a/spec/requests/api/v3/placeholder_users/show_resource_spec.rb+++ b/spec/requests/api/v3/placeholder_users/show_resource_spec.rb@@ -71,7 +71,7 @@ RSpec.describe API::V3::PlaceholderUsers::PlaceholderUsersAPI,let(:user) { build(:user) }it "returns a 403 response" do- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/placeholder_users/update_resource_examples.rb b/spec/requests/api/v3/placeholder_users/update_resource_examples.rbindex b6feb8996cc..83fcfffb967 100644--- a/spec/requests/api/v3/placeholder_users/update_resource_examples.rb+++ b/spec/requests/api/v3/placeholder_users/update_resource_examples.rb@@ -32,7 +32,7 @@ RSpec.shared_examples "updates the placeholder" doendit "returns an error" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("urn:openproject-org:api:v3:errors:PropertyConstraintViolation".to_json).at_path("errorIdentifier")@@ -51,7 +51,7 @@ RSpec.shared_examples "updates the placeholder" doendit "updates the placeholder" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)placeholder.reloaddiff --git a/spec/requests/api/v3/placeholder_users/update_resource_spec.rb b/spec/requests/api/v3/placeholder_users/update_resource_spec.rbindex ecd50789329..356764e5422 100644--- a/spec/requests/api/v3/placeholder_users/update_resource_spec.rb+++ b/spec/requests/api/v3/placeholder_users/update_resource_spec.rb@@ -67,7 +67,7 @@ RSpec.describe API::V3::PlaceholderUsers::PlaceholderUsersAPI,let(:user) { build(:user) }it "returns a 403 response" do- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/projects/copy/copy_form_resource_spec.rb b/spec/requests/api/v3/projects/copy/copy_form_resource_spec.rbindex 1f4ccd4df23..d1579e024e6 100644--- a/spec/requests/api/v3/projects/copy/copy_form_resource_spec.rb+++ b/spec/requests/api/v3/projects/copy/copy_form_resource_spec.rb@@ -66,7 +66,7 @@ RSpec.describe API::V3::Projects::Copy::CreateFormAPI, content_type: :json dosubject(:response) { last_response }it "returns 200 FORM response", :aggregate_failures do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(response.body).to be_json_eql("Form".to_json)@@ -240,7 +240,7 @@ RSpec.describe API::V3::Projects::Copy::CreateFormAPI, content_type: :json doendit "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb b/spec/requests/api/v3/projects/copy/copy_resource_spec.rbindex c5b528a3bb1..9ab84803416 100644--- a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb+++ b/spec/requests/api/v3/projects/copy/copy_resource_spec.rb@@ -71,12 +71,11 @@ RSpec.describe "API::V3::Projects::Copy::CopyAPI", content_type: :json, with_goosubject(:response) { last_response }- # rubocop:disable RSpecRails/HaveHttpStatus# those are mock responses that don't deal well with the rails helpersdescribe "#POST /api/v3/projects/:id/copy" dodescribe "with empty params" doit "returns 422", :aggregate_failures do- expect(response.status).to eq(422)+ expect(response).to have_http_status(:unprocessable_entity)expect(response.body).to be_json_eql("Error".to_json)@@ -99,7 +98,7 @@ RSpec.describe "API::V3::Projects::Copy::CopyAPI", content_type: :json, with_gooit "returns with a redirect to job" doaggregate_failures do- expect(response.status).to eq(302)+ expect(response).to have_http_status(:found)expect(response).to be_redirect@@ -108,7 +107,7 @@ RSpec.describe "API::V3::Projects::Copy::CopyAPI", content_type: :json, with_googet response.location- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)expect(last_response.body).to be_json_eql("in_queue".to_json)@@ -118,7 +117,7 @@ RSpec.describe "API::V3::Projects::Copy::CopyAPI", content_type: :json, with_googet response.location- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)expect(last_response.body).to be_json_eql("success".to_json)@@ -199,9 +198,8 @@ RSpec.describe "API::V3::Projects::Copy::CopyAPI", content_type: :json, with_gooendit "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endendend- # rubocop:enable RSpecRails/HaveHttpStatusenddiff --git a/spec/requests/api/v3/projects/create_form_resource_spec.rb b/spec/requests/api/v3/projects/create_form_resource_spec.rbindex c92041ef0dc..0654d6e40c3 100644--- a/spec/requests/api/v3/projects/create_form_resource_spec.rb+++ b/spec/requests/api/v3/projects/create_form_resource_spec.rb@@ -63,7 +63,7 @@ RSpec.describe API::V3::Projects::CreateFormAPI, content_type: :json dodescribe "#POST /api/v3/projects/form" doit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "returns a form" do@@ -195,7 +195,7 @@ RSpec.describe API::V3::Projects::CreateFormAPI, content_type: :json doendit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "returns the schema with a required parent field" do@@ -209,7 +209,7 @@ RSpec.describe API::V3::Projects::CreateFormAPI, content_type: :json dolet(:permissions) { [] }it "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/projects/create_resource_spec.rb b/spec/requests/api/v3/projects/create_resource_spec.rbindex 02106e9baa6..82836ddb59f 100644--- a/spec/requests/api/v3/projects/create_resource_spec.rb+++ b/spec/requests/api/v3/projects/create_resource_spec.rb@@ -63,7 +63,7 @@ RSpec.describe "API v3 Project resource create", content_type: :json doendit "responds with 201 CREATED" do- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)endit "creates a project" do@@ -182,7 +182,7 @@ RSpec.describe "API v3 Project resource create", content_type: :json dolet(:permissions) { [] }it "responds with 403" do- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endit "creates no project" do@@ -199,7 +199,7 @@ RSpec.describe "API v3 Project resource create", content_type: :json doendit "responds with 422" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)endit "creates no project" do@@ -233,7 +233,7 @@ RSpec.describe "API v3 Project resource create", content_type: :json doendit "responds with 422" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)endit "creates no project" dodiff --git a/spec/requests/api/v3/projects/index_resource_spec.rb b/spec/requests/api/v3/projects/index_resource_spec.rbindex 7f074ffc825..1161f999ce0 100644--- a/spec/requests/api/v3/projects/index_resource_spec.rb+++ b/spec/requests/api/v3/projects/index_resource_spec.rb@@ -320,7 +320,7 @@ RSpec.describe "API v3 Project resource index", content_type: :json docurrent_user { admin }it "responds with 200 OK" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit_behaves_like "API V3 collection response", 1, 1, "Project" do@@ -332,7 +332,7 @@ RSpec.describe "API v3 Project resource index", content_type: :json doit_behaves_like "API V3 collection response", 0, 0, "Project"it "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endendenddiff --git a/spec/requests/api/v3/projects/update_form_resource_spec.rb b/spec/requests/api/v3/projects/update_form_resource_spec.rbindex 490af1651ed..e2834bc408c 100644--- a/spec/requests/api/v3/projects/update_form_resource_spec.rb+++ b/spec/requests/api/v3/projects/update_form_resource_spec.rb@@ -74,7 +74,7 @@ RSpec.describe API::V3::Projects::UpdateFormAPI, content_type: :json dodescribe "#POST /api/v3/projects/:id/form" doit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "returns a form" do@@ -262,7 +262,7 @@ RSpec.describe API::V3::Projects::UpdateFormAPI, content_type: :json dolet(:permissions) { [] }it "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endend@@ -270,7 +270,7 @@ RSpec.describe API::V3::Projects::UpdateFormAPI, content_type: :json dolet(:path) { api_v3_paths.project_form(1) }it "returns 404 Not found" do- expect(response.status).to eq(404)+ expect(response).to have_http_status(:not_found)endendenddiff --git a/spec/requests/api/v3/projects/update_resource_spec.rb b/spec/requests/api/v3/projects/update_resource_spec.rbindex b9aa431487a..26d72f607cd 100644--- a/spec/requests/api/v3/projects/update_resource_spec.rb+++ b/spec/requests/api/v3/projects/update_resource_spec.rb@@ -65,7 +65,7 @@ RSpec.describe "API v3 Project resource update", content_type: :json doendit "responds with 200 OK" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "alters the project" do@@ -97,7 +97,7 @@ RSpec.describe "API v3 Project resource update", content_type: :json doendit "responds with 200 OK" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "sets the cf value" do@@ -124,7 +124,7 @@ RSpec.describe "API v3 Project resource update", content_type: :json dolet(:current_user) { create(:admin) }it "responds with 200 OK" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "sets the cf value" do@@ -141,7 +141,7 @@ RSpec.describe "API v3 Project resource update", content_type: :json docontext "with non-admin permissions" doit "responds with 200 OK" do# TBD: trying to set a not accessible custom field is silently ignored- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "does not set the cf value" do@@ -171,7 +171,7 @@ RSpec.describe "API v3 Project resource update", content_type: :json dolet(:permissions) { [] }it "responds with 403" do- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endit "does not change the project" do@@ -266,7 +266,7 @@ RSpec.describe "API v3 Project resource update", content_type: :json doendit "responds with 422" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)endit "does not change the project" do@@ -299,7 +299,7 @@ RSpec.describe "API v3 Project resource update", content_type: :json doendit "responds with 422" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)endit "does not change the project status" dodiff --git a/spec/requests/api/v3/queries/create_form_api_spec.rb b/spec/requests/api/v3/queries/create_form_api_spec.rbindex 3c08545f59c..6036ca34397 100644--- a/spec/requests/api/v3/queries/create_form_api_spec.rb+++ b/spec/requests/api/v3/queries/create_form_api_spec.rb@@ -100,7 +100,7 @@ RSpec.describe "POST /api/v3/queries/form",endit "returns 200(OK)" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "is of type form" dodiff --git a/spec/requests/api/v3/queries/create_query_spec.rb b/spec/requests/api/v3/queries/create_query_spec.rbindex ebd7719b3ce..8337d60091d 100644--- a/spec/requests/api/v3/queries/create_query_spec.rb+++ b/spec/requests/api/v3/queries/create_query_spec.rb@@ -110,7 +110,7 @@ RSpec.describe "POST /api/v3/queries",endit "returns 201 (created)" do- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)endit "renders the created query" do@@ -139,7 +139,7 @@ RSpec.describe "POST /api/v3/queries",context "without EE", with_ee: false doit "yields a 422 error given a timestamp older than 1 day" do- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityexpect(json["message"]).to eq "Timestamps contain forbidden values: #{timestamps.first}"end@@ -147,7 +147,7 @@ RSpec.describe "POST /api/v3/queries",let(:timestamps) { ["oneDayAgo@12:00+00:00"] }it "returns 201 (created)" do- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)endit "updates the query timestamps" do@@ -168,7 +168,7 @@ RSpec.describe "POST /api/v3/queries",post!- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityexpect(json["message"]).to eq "Project not found"end@@ -177,7 +177,7 @@ RSpec.describe "POST /api/v3/queries",post!- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityexpect(json["message"]).to eq "Status Operator is not set to one of the allowed values."end@@ -186,7 +186,7 @@ RSpec.describe "POST /api/v3/queries",post!- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityexpect(json["message"]).to eq "Statuz filter does not exist."endenddiff --git a/spec/requests/api/v3/queries/order/query_order_api_spec.rb b/spec/requests/api/v3/queries/order/query_order_api_spec.rbindex 680d69beffb..19967d7921a 100644--- a/spec/requests/api/v3/queries/order/query_order_api_spec.rb+++ b/spec/requests/api/v3/queries/order/query_order_api_spec.rb@@ -52,7 +52,7 @@ RSpec.describe "/api/v3/queries/:id/order" doit "returns the order" doget path- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okexpect(body).to be_a Hashexpect(body).to eq({ wp1.id => 0, wp2.id => 8192 }.stringify_keys)end@@ -70,7 +70,7 @@ RSpec.describe "/api/v3/queries/:id/order" doit "allows inserting a delta" dopatch path, { delta: { wp2.id.to_s => 1234 } }.to_json- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okquery.reloadexpect(body).to eq("t" => timestamp)@@ -79,7 +79,7 @@ RSpec.describe "/api/v3/queries/:id/order" doit "allows removing an item" dopatch path, { delta: { wp1.id.to_s => -1 } }.to_json- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okquery.reloadexpect(body).to eq("t" => timestamp)diff --git a/spec/requests/api/v3/queries/query_resource_spec.rb b/spec/requests/api/v3/queries/query_resource_spec.rbindex 1124cdb24ce..26f7d345928 100644--- a/spec/requests/api/v3/queries/query_resource_spec.rb+++ b/spec/requests/api/v3/queries/query_resource_spec.rb@@ -65,7 +65,7 @@ RSpec.describe "API v3 Query resource",context "user has view_work_packages in a project" doit "succeeds" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endend@@ -73,7 +73,7 @@ RSpec.describe "API v3 Query resource",let(:permissions) { [:manage_public_queries] }it "succeeds" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endend@@ -89,7 +89,7 @@ RSpec.describe "API v3 Query resource",include_context "with non-member permissions from non_member_permissions"it "succeeds" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endcontext "that is not allowed to see queries anywhere" do@@ -247,7 +247,7 @@ RSpec.describe "API v3 Query resource",endit "responds with HTTP No Content" do- expect(last_response.status).to eq 204+ expect(last_response).to have_http_status :no_contentendit "deletes the Query" do@@ -279,7 +279,7 @@ RSpec.describe "API v3 Query resource",endit "succeeds" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "returns a Collection of projects for which the user has view work packages permission" do@@ -317,7 +317,7 @@ RSpec.describe "API v3 Query resource",context "when starring an unstarred query" doit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit 'returns the query with "starred" property set to true' do@@ -327,7 +327,7 @@ RSpec.describe "API v3 Query resource",context "when starring already starred query" doit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit 'returns the query with "starred" property set to true' do@@ -356,7 +356,7 @@ RSpec.describe "API v3 Query resource",context "starring his own query" doit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit 'returns the query with "starred" property set to true' do@@ -398,7 +398,7 @@ RSpec.describe "API v3 Query resource",endit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit 'returns the query with "starred" property set to false' do@@ -412,7 +412,7 @@ RSpec.describe "API v3 Query resource",endit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit 'returns the query with "starred" property set to false' do@@ -453,7 +453,7 @@ RSpec.describe "API v3 Query resource",context "unstarring his own query" doit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit 'returns the query with "starred" property set to true' do@@ -490,7 +490,7 @@ RSpec.describe "API v3 Query resource",endit "succeeds" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "returns the form" dodiff --git a/spec/requests/api/v3/queries/update_form_api_spec.rb b/spec/requests/api/v3/queries/update_form_api_spec.rbindex 6d8fb54c816..f4d3b151690 100644--- a/spec/requests/api/v3/queries/update_form_api_spec.rb+++ b/spec/requests/api/v3/queries/update_form_api_spec.rb@@ -65,7 +65,7 @@ RSpec.describe "POST /api/v3/queries/form",endit "returns 200(OK)" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "is of type form" dodiff --git a/spec/requests/api/v3/queries/update_query_spec.rb b/spec/requests/api/v3/queries/update_query_spec.rbindex 50a9046d26c..556549845d3 100644--- a/spec/requests/api/v3/queries/update_query_spec.rb+++ b/spec/requests/api/v3/queries/update_query_spec.rb@@ -121,7 +121,7 @@ RSpec.describe "PATCH /api/v3/queries/:id",endit "returns 200 (ok)" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "renders the updated query" do@@ -159,7 +159,7 @@ RSpec.describe "PATCH /api/v3/queries/:id",context "without EE", with_ee: false doit "yields a 422 error given a timestamp older than 1 day" do- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityexpect(json["message"]).to eq "Timestamps contain forbidden values: #{timestamps.first}"end@@ -167,7 +167,7 @@ RSpec.describe "PATCH /api/v3/queries/:id",let(:timestamps) { ["oneDayAgo@12:00+00:00"] }it "returns 200 (ok)" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "updates the query timestamps" do@@ -188,7 +188,7 @@ RSpec.describe "PATCH /api/v3/queries/:id",post!- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityexpect(json["message"]).to eq "Project not found"end@@ -197,7 +197,7 @@ RSpec.describe "PATCH /api/v3/queries/:id",post!- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityexpect(json["message"]).to eq "Status Operator is not set to one of the allowed values."end@@ -206,7 +206,7 @@ RSpec.describe "PATCH /api/v3/queries/:id",post!- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityexpect(json["message"]).to eq "Statuz filter does not exist."endenddiff --git a/spec/requests/api/v3/relations/relations_api_spec.rb b/spec/requests/api/v3/relations/relations_api_spec.rbindex a64fbbb3a4d..3fa1effcc1d 100644--- a/spec/requests/api/v3/relations/relations_api_spec.rb+++ b/spec/requests/api/v3/relations/relations_api_spec.rb@@ -93,7 +93,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doendit "returns 201 (created)" do- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)endit "has created a new relation" do@@ -121,7 +121,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doendit "responds with error" do- expect(last_response.status).to be 422+ expect(last_response).to have_http_status :unprocessable_entityendit "states the reason for the error" do@@ -242,7 +242,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doendit "returns 200 (ok)" do- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendit "updates the relation's description" do@@ -267,7 +267,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doendit "returns 422" do- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityendit "indicates an error with the type attribute" do@@ -291,7 +291,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doendit "returns 422" do- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityendit "indicates an error with the `from` attribute" do@@ -329,7 +329,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json docontext "with the required permissions" doit "works" do- expect(last_response.status).to eq 201+ expect(last_response).to have_http_status :createdendend@@ -337,7 +337,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json dolet(:permissions) { [:view_work_packages] }it "is forbidden" do- expect(last_response.status).to eq 403+ expect(last_response).to have_http_status :forbiddenendend@@ -349,7 +349,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json dolet!(:to) { create(:work_package) }it "returns 422" do- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityendit "indicates an error with the `to` attribute" do@@ -392,7 +392,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doendit "returns 204 and destroy the relation" do- expect(last_response.status).to eq 204+ expect(last_response).to have_http_status :no_contentexpect(Relation.exists?(relation.id)).to be_falseyend@@ -400,7 +400,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json dolet(:permissions) { %i[view_work_packages] }it "returns 403" do- expect(last_response.status).to eq 403+ expect(last_response).to have_http_status :forbiddenendit "leaves the relation" do@@ -458,7 +458,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doendit "returns 200" do- expect(last_response.status).to be 200+ expect(last_response).to have_http_status :okendit "returns the visible relation (and only the visible one) satisfying the filter" do@@ -502,7 +502,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json docontext "for a relation with visible work packages" doit "returns 200" do- expect(last_response.status).to be 200+ expect(last_response).to have_http_status :okendit "returns the relation" do@@ -534,7 +534,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doendit "returns 404 NOT FOUND" do- expect(last_response.status).to be 404+ expect(last_response).to have_http_status :not_foundendendenddiff --git a/spec/requests/api/v3/repositories/revisions_resource_spec.rb b/spec/requests/api/v3/repositories/revisions_resource_spec.rbindex e060d753a6c..31623d87ccf 100644--- a/spec/requests/api/v3/repositories/revisions_resource_spec.rb+++ b/spec/requests/api/v3/repositories/revisions_resource_spec.rb@@ -66,7 +66,7 @@ RSpec.describe "API v3 Revisions resource" doendit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)enddescribe "response body" dodiff --git a/spec/requests/api/v3/root_resource_spec.rb b/spec/requests/api/v3/root_resource_spec.rbindex d7f6e3ed9aa..46501b452b6 100644--- a/spec/requests/api/v3/root_resource_spec.rb+++ b/spec/requests/api/v3/root_resource_spec.rb@@ -59,7 +59,7 @@ RSpec.describe "API v3 Root resource" docontext "when not login_required", with_settings: { login_required: false } doit "responds with 200", :aggregate_failures do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(subject).to have_json_path("instanceName")endend@@ -73,7 +73,7 @@ RSpec.describe "API v3 Root resource" doendit "responds with 200" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "responds with a root representer" do@@ -82,7 +82,7 @@ RSpec.describe "API v3 Root resource" docontext "without the X-requested-with header", :skip_xhr_header doit "returns OK because GET requests are allowed" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(subject).to have_json_path("instanceName")endenddiff --git a/spec/requests/api/v3/status_resource_spec.rb b/spec/requests/api/v3/status_resource_spec.rbindex b45371050d1..58bbd0bb25f 100644--- a/spec/requests/api/v3/status_resource_spec.rb+++ b/spec/requests/api/v3/status_resource_spec.rb@@ -82,7 +82,7 @@ RSpec.describe "API v3 Status resource" doendcontext "valid status id" do- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }endcontext "invalid status id" dodiff --git a/spec/requests/api/v3/support/api_helper.rb b/spec/requests/api/v3/support/api_helper.rbindex a942810ec8b..46fe6f6f33f 100644--- a/spec/requests/api/v3/support/api_helper.rb+++ b/spec/requests/api/v3/support/api_helper.rb@@ -27,7 +27,7 @@#++RSpec.shared_examples_for "safeguarded API" do- it { expect(last_response.status).to eq(404) }+ it { expect(last_response).to have_http_status(:not_found) }endRSpec.shared_examples_for "valid activity request" do@@ -38,7 +38,7 @@ RSpec.shared_examples_for "valid activity request" doallow(User).to receive(:current).and_return(admin)end- it { expect(last_response.status).to eq(status_code) }+ it { expect(last_response).to have_http_status(status_code) }describe "response body" dosubject { last_response.body }@@ -56,5 +56,5 @@ RSpec.shared_examples_for "invalid activity request" doallow(User).to receive(:current).and_return(admin)end- it { expect(last_response.status).to eq(422) }+ it { expect(last_response).to have_http_status(:unprocessable_entity) }enddiff --git a/spec/requests/api/v3/support/api_v3_collection_response.rb b/spec/requests/api/v3/support/api_v3_collection_response.rbindex a3bde3e9c36..132f949048b 100644--- a/spec/requests/api/v3/support/api_v3_collection_response.rb+++ b/spec/requests/api/v3/support/api_v3_collection_response.rb@@ -59,7 +59,7 @@ RSpec.shared_examples_for "API V3 collection response" do |total, count, elementit "returns a collection successfully" doaggregate_failures do- expect(last_response.status).to eq(expected_status_code)+ expect(last_response).to have_http_status(expected_status_code)errors = JSON.parse(subject).dig("_embedded", "errors")&.map { _1["message"] }expect(errors).to eq([]) if errors # make errors visible in console if anyenddiff --git a/spec/requests/api/v3/support/response_examples.rb b/spec/requests/api/v3/support/response_examples.rbindex 2974b634ec7..3302c01a6ca 100644--- a/spec/requests/api/v3/support/response_examples.rb+++ b/spec/requests/api/v3/support/response_examples.rb@@ -30,7 +30,7 @@ require "spec_helper"RSpec.shared_examples_for "successful response" do |code = 200|it "has the status code #{code}" do- expect(last_response.status).to eq(code)+ expect(last_response).to have_http_status(code)endit "has a HAL+JSON Content-Type" do@@ -42,7 +42,7 @@ endRSpec.shared_examples_for "successful no content response" do |code = 204|it "has the status code #{code}" do- expect(last_response.status).to eq(code)+ expect(last_response).to have_http_status(code)endend@@ -50,7 +50,7 @@ RSpec.shared_examples_for "redirect response" do |code = 303|let(:location) { "" }it "has the status code #{code}" do- expect(last_response.status).to eq(code)+ expect(last_response).to have_http_status(code)endit "redirects to expected location" do@@ -64,7 +64,7 @@ RSpec.shared_examples_for "error response" do |code, id, provided_message = nil|endit "has the status code #{code}" do- expect(last_response.status).to eq(code)+ expect(last_response).to have_http_status(code)endit "has a HAL+JSON Content-Type" do@@ -182,7 +182,7 @@ RSpec.shared_examples_for "param validation error" dosubject { JSON.parse(last_response.body) }it "results in a validation error" do- expect(last_response.status).to eq(400)+ expect(last_response).to have_http_status(:bad_request)expect(subject["errorIdentifier"]).to eq("urn:openproject-org:api:v3:errors:BadRequest")expect(subject["message"]).to match /Bad request: .+? is invalid/enddiff --git a/spec/requests/api/v3/types/type_resource_spec.rb b/spec/requests/api/v3/types/type_resource_spec.rbindex 0a0da5dff3f..dd21d89a94e 100644--- a/spec/requests/api/v3/types/type_resource_spec.rb+++ b/spec/requests/api/v3/types/type_resource_spec.rb@@ -82,7 +82,7 @@ RSpec.describe "API v3 Type resource" doendcontext "valid type id" do- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }endcontext "invalid type id" dodiff --git a/spec/requests/api/v3/user/create_form_resource_spec.rb b/spec/requests/api/v3/user/create_form_resource_spec.rbindex a9cd8353217..6bad65fa898 100644--- a/spec/requests/api/v3/user/create_form_resource_spec.rb+++ b/spec/requests/api/v3/user/create_form_resource_spec.rb@@ -55,7 +55,7 @@ RSpec.describe API::V3::Users::CreateFormAPI, content_type: :json doit "returns a payload with validation errors",:aggregate_failures,with_settings: { default_language: :es } do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(response.body).to be_json_eql("Form".to_json).at_path("_type")expect(body)@@ -101,7 +101,7 @@ RSpec.describe API::V3::Users::CreateFormAPI, content_type: :json doendit "returns a valid payload", :aggregate_failures do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(response.body).to be_json_eql("Form".to_json).at_path("_type")expect(body)@@ -149,7 +149,7 @@ RSpec.describe API::V3::Users::CreateFormAPI, content_type: :json doendit "returns a valid form response" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(response.body).to be_json_eql("Form".to_json).at_path("_type")expect(body)diff --git a/spec/requests/api/v3/user/create_user_common_examples.rb b/spec/requests/api/v3/user/create_user_common_examples.rbindex b55219a3786..1026f3429f7 100644--- a/spec/requests/api/v3/user/create_user_common_examples.rb+++ b/spec/requests/api/v3/user/create_user_common_examples.rb@@ -29,7 +29,7 @@ RSpec.shared_examples "represents the created user" do |expected_attributes|it "returns the represented user" dosend_request- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)expect(last_response.body).to have_json_type(Object).at_path("_links")expect(last_response.body).to be_json_eql("User".to_json)@@ -50,7 +50,7 @@ RSpec.shared_examples "property is not writable" do |attribute_name|attr = JSON.parse(last_response.body).dig "_embedded", "details", "attribute"- expect(last_response.status).to eq 422+ expect(last_response).to have_http_status :unprocessable_entityexpect(attr).to eq attribute_nameendend@@ -64,7 +64,7 @@ RSpec.shared_examples "create user request flow" doit "returns an erroneous response" dosend_request- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(errors.count).to eq(5)expect(errors.collect { |el| el["_embedded"]["details"]["attribute"] })@@ -140,7 +140,7 @@ RSpec.shared_examples "create user request flow" doit "returns an erroneous response" dosend_request- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(errors).not_to be_emptyexpect(last_response.body)diff --git a/spec/requests/api/v3/user/create_user_resource_spec.rb b/spec/requests/api/v3/user/create_user_resource_spec.rbindex 61ca8db9218..b873d767933 100644--- a/spec/requests/api/v3/user/create_user_resource_spec.rb+++ b/spec/requests/api/v3/user/create_user_resource_spec.rb@@ -114,7 +114,7 @@ RSpec.describe API::V3::Users::UsersAPI doit "returns an error on that attribute" dosend_request- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("authSource".to_json)@@ -247,7 +247,7 @@ RSpec.describe API::V3::Users::UsersAPI doit "returns an erroneous response" dosend_request- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/user/update_form_resource_spec.rb b/spec/requests/api/v3/user/update_form_resource_spec.rbindex 94f5a5a5dff..53505aaffe7 100644--- a/spec/requests/api/v3/user/update_form_resource_spec.rb+++ b/spec/requests/api/v3/user/update_form_resource_spec.rb@@ -67,7 +67,7 @@ RSpec.describe API::V3::Users::UpdateFormAPI, content_type: :json dodescribe "empty payload" doit "returns a valid form", :aggregate_failures do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(response.body).to be_json_eql("Form".to_json).at_path("_type")expect(body)@@ -96,7 +96,7 @@ RSpec.describe API::V3::Users::UpdateFormAPI, content_type: :json doendit "returns a valid response", :aggregate_failures do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(response.body).to be_json_eql("Form".to_json).at_path("_type")expect(subject.body)@@ -121,7 +121,7 @@ RSpec.describe API::V3::Users::UpdateFormAPI, content_type: :json doendit "returns an invalid form", :aggregate_failures do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)expect(response.body).to be_json_eql("Form".to_json).at_path("_type")expect(body)@@ -156,7 +156,7 @@ RSpec.describe API::V3::Users::UpdateFormAPI, content_type: :json dolet(:path) { api_v3_paths.user_form(12345) }it "returns 404 Not found" do- expect(response.status).to eq(404)+ expect(response).to have_http_status(:not_found)endendenddiff --git a/spec/requests/api/v3/user/update_user_resource_spec.rb b/spec/requests/api/v3/user/update_user_resource_spec.rbindex 272c1185ddd..9279dc539f9 100644--- a/spec/requests/api/v3/user/update_user_resource_spec.rb+++ b/spec/requests/api/v3/user/update_user_resource_spec.rb@@ -48,7 +48,7 @@ RSpec.describe API::V3::Users::UsersAPI doit "responds with the represented updated user" dosend_request- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)expect(last_response.body).to have_json_type(Object).at_path("_links")expect(last_response.body).to be_json_eql("User".to_json)@@ -83,7 +83,7 @@ RSpec.describe API::V3::Users::UsersAPI doit "returns an erroneous response" dosend_request- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("email".to_json)@@ -107,7 +107,7 @@ RSpec.describe API::V3::Users::UsersAPI doit "updates the users password correctly" dosend_request- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)updated_user = User.find(user.id)matches = updated_user.check_password?(password)@@ -121,7 +121,7 @@ RSpec.describe API::V3::Users::UsersAPI doit "responds with 404" dosend_request- expect(last_response.status).to be(404)+ expect(last_response).to have_http_status(:not_found)endendend@@ -138,7 +138,7 @@ RSpec.describe API::V3::Users::UsersAPI doit "rejects the users password update" dosend_request- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("password".to_json)@@ -157,7 +157,7 @@ RSpec.describe API::V3::Users::UsersAPI doit "returns an erroneous response" dosend_request- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/version_resource_spec.rb b/spec/requests/api/v3/version_resource_spec.rbindex 58bd7dd67f9..fd6881033b1 100644--- a/spec/requests/api/v3/version_resource_spec.rb+++ b/spec/requests/api/v3/version_resource_spec.rb@@ -55,7 +55,7 @@ RSpec.describe "API v3 Version resource", content_type: :json doshared_examples_for "successful response" doit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "returns the version" do@@ -157,7 +157,7 @@ RSpec.describe "API v3 Version resource", content_type: :json doendit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "updates the version" do@@ -297,7 +297,7 @@ RSpec.describe "API v3 Version resource", content_type: :json doendit "responds with 201" do- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)endit "creates the version" dodiff --git a/spec/requests/api/v3/versions/create_form_resource_spec.rb b/spec/requests/api/v3/versions/create_form_resource_spec.rbindex 47fca5b7076..b91997919d9 100644--- a/spec/requests/api/v3/versions/create_form_resource_spec.rb+++ b/spec/requests/api/v3/versions/create_form_resource_spec.rb@@ -50,7 +50,7 @@ RSpec.describe API::V3::Versions::CreateFormAPI, content_type: :json dodescribe "#POST /api/v3/versions/form" doit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "returns a form" do@@ -186,7 +186,7 @@ RSpec.describe API::V3::Versions::CreateFormAPI, content_type: :json dolet(:permissions) { [] }it "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endendenddiff --git a/spec/requests/api/v3/versions/update_form_resource_spec.rb b/spec/requests/api/v3/versions/update_form_resource_spec.rbindex fbc564db282..12ab7a95e4d 100644--- a/spec/requests/api/v3/versions/update_form_resource_spec.rb+++ b/spec/requests/api/v3/versions/update_form_resource_spec.rb@@ -55,7 +55,7 @@ RSpec.describe API::V3::Versions::UpdateFormAPI, content_type: :json dodescribe "#POST /api/v3/versions/:id/form" doit "returns 200 OK" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "returns a form" do@@ -215,7 +215,7 @@ RSpec.describe API::V3::Versions::UpdateFormAPI, content_type: :json dolet(:permissions) { [:view_work_packages] }it "returns 403 Not Authorized" do- expect(response.status).to eq(403)+ expect(response).to have_http_status(:forbidden)endend@@ -223,7 +223,7 @@ RSpec.describe API::V3::Versions::UpdateFormAPI, content_type: :json dolet(:permissions) { [] }it "returns 404 Not Found" do- expect(response.status).to eq(404)+ expect(response).to have_http_status(:not_found)endendenddiff --git a/spec/requests/api/v3/views/create_resource_spec.rb b/spec/requests/api/v3/views/create_resource_spec.rbindex 8cdae129f46..5a9ebf04531 100644--- a/spec/requests/api/v3/views/create_resource_spec.rb+++ b/spec/requests/api/v3/views/create_resource_spec.rb@@ -97,7 +97,7 @@ RSpec.describe API::V3::Views::ViewsAPI,endit "responds with 422 and explains the error" do- expect(last_response.status).to eq(422)+ expect(last_response).to have_http_status(:unprocessable_entity)expect(last_response.body).to be_json_eql("Query does not exist.".to_json)diff --git a/spec/requests/api/v3/views/show_resource_spec.rb b/spec/requests/api/v3/views/show_resource_spec.rbindex 606db351cf7..838982eab4c 100644--- a/spec/requests/api/v3/views/show_resource_spec.rb+++ b/spec/requests/api/v3/views/show_resource_spec.rb@@ -85,7 +85,7 @@ RSpec.describe API::V3::Views::ViewsAPI,endit "returns a 404 response" do- expect(last_response.status).to eq(404)+ expect(last_response).to have_http_status(:not_found)endendenddiff --git a/spec/requests/api/v3/work_packages/by_project_create_resource_spec.rb b/spec/requests/api/v3/work_packages/by_project_create_resource_spec.rbindex 7d4706a719b..0caa698c112 100644--- a/spec/requests/api/v3/work_packages/by_project_create_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/by_project_create_resource_spec.rb@@ -99,7 +99,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackagesByProjectAPI, content_type: :jendit "returns Created(201)" do- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)endit "creates a work package" do@@ -114,7 +114,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackagesByProjectAPI, content_type: :jlet(:current_user) { create(:user) }it "hides the endpoint" do- expect(last_response.status).to eq(404)+ expect(last_response).to have_http_status(:not_found)endend@@ -124,7 +124,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackagesByProjectAPI, content_type: :jlet(:permissions) { [:view_project] }it "points out the missing permission" do- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endenddiff --git a/spec/requests/api/v3/work_packages/create_form_resource_spec.rb b/spec/requests/api/v3/work_packages/create_form_resource_spec.rbindex 030ae7fc5a3..3130bab2aa4 100644--- a/spec/requests/api/v3/work_packages/create_form_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/create_form_resource_spec.rb@@ -48,7 +48,7 @@ RSpec.describe API::V3::WorkPackages::CreateProjectFormAPI dosubject(:response) { last_response }it "returns 200(OK)" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "is of type form" dodiff --git a/spec/requests/api/v3/work_packages/create_project_form_resource_spec.rb b/spec/requests/api/v3/work_packages/create_project_form_resource_spec.rbindex 3510112baef..92a2fa5f841 100644--- a/spec/requests/api/v3/work_packages/create_project_form_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/create_project_form_resource_spec.rb@@ -44,7 +44,7 @@ RSpec.describe API::V3::WorkPackages::CreateProjectFormAPI, content_type: :jsonsubject(:response) { last_response }it "returns 200(OK)" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit "is of type form" dodiff --git a/spec/requests/api/v3/work_packages/create_resource_spec.rb b/spec/requests/api/v3/work_packages/create_resource_spec.rbindex 82026528d9c..51c183f47ba 100644--- a/spec/requests/api/v3/work_packages/create_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/create_resource_spec.rb@@ -109,7 +109,7 @@ RSpec.describe "API v3 Work package resource",endit "returns Created(201)" do- expect(last_response.status).to eq(201)+ expect(last_response).to have_http_status(:created)endit "creates a work package" do@@ -132,7 +132,7 @@ RSpec.describe "API v3 Work package resource",let(:current_user) { create(:user) }it "hides the endpoint" do- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endend@@ -142,7 +142,7 @@ RSpec.describe "API v3 Work package resource",let(:permissions) { [:view_project] }it "points out the missing permission" do- expect(last_response.status).to eq(403)+ expect(last_response).to have_http_status(:forbidden)endenddiff --git a/spec/requests/api/v3/work_packages/form/work_package_form_resource_spec.rb b/spec/requests/api/v3/work_packages/form/work_package_form_resource_spec.rbindex 9726818b86b..16f042a978f 100644--- a/spec/requests/api/v3/work_packages/form/work_package_form_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/form/work_package_form_resource_spec.rb@@ -102,7 +102,7 @@ RSpec.describe "API v3 Work package form resource" doshared_examples_for "valid payload" dosubject { last_response.body }- it { expect(last_response.status).to eq(200) }+ it { expect(last_response).to have_http_status(:ok) }it { is_expected.to have_json_path("_embedded/payload") }@@ -232,7 +232,7 @@ RSpec.describe "API v3 Work package form resource" doinclude_context "with post request"- it { expect(last_response.status).to eq(409) }+ it { expect(last_response).to have_http_status(:conflict) }it_behaves_like "update conflict"end@@ -803,7 +803,7 @@ RSpec.describe "API v3 Work package form resource" doendit "responds with a valid body (Regression OP#37510)" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endendend@@ -825,7 +825,7 @@ RSpec.describe "API v3 Work package form resource" dosubject { last_response.body }shared_examples_for "valid payload" do- it { expect(last_response.status).to eq(200) }+ it { expect(last_response).to have_http_status(:ok) }it { is_expected.to have_json_path("_embedded/payload") }diff --git a/spec/requests/api/v3/work_packages/show_resource_spec.rb b/spec/requests/api/v3/work_packages/show_resource_spec.rbindex 9fb934c6cb1..ad4c9f94e6f 100644--- a/spec/requests/api/v3/work_packages/show_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/show_resource_spec.rb@@ -69,7 +69,7 @@ RSpec.describe "API v3 Work package resource",endit "responds with 200" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)enddescribe "response body" do@@ -248,7 +248,7 @@ RSpec.describe "API v3 Work package resource",context "with EE", with_ee: %i[baseline_comparison] doit "responds with 200" do- expect(subject && last_response.status).to eq(200)+ expect(subject && last_response).to have_http_status(:ok)endit "has the current attributes as attributes" do@@ -502,13 +502,13 @@ RSpec.describe "API v3 Work package resource",context "without EE" doshared_examples "success" doit "responds with 200" do- expect(subject && last_response.status).to eq(200)+ expect(subject && last_response).to have_http_status(:ok)endendshared_examples "error" doit "responds with 400" do- expect(subject && last_response.status).to eq(400)+ expect(subject && last_response).to have_http_status(:bad_request)endit "has the invalid timestamps message" dodiff --git a/spec/requests/api/v3/work_packages/update_resource_spec.rb b/spec/requests/api/v3/work_packages/update_resource_spec.rbindex 084aeefc6d1..9113592e44f 100644--- a/spec/requests/api/v3/work_packages/update_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/update_resource_spec.rb@@ -159,7 +159,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with updated work package subject" doexpect(subject.body).to be_json_eql("Updated subject".to_json).at_path("subject")@@ -172,7 +172,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(422) }+ it { expect(response).to have_http_status(:unprocessable_entity) }it "has a readonly error" doexpect(response.body)@@ -200,7 +200,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it_behaves_like "description updated"end@@ -214,7 +214,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it_behaves_like "description updated"end@@ -226,7 +226,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "updates the scheduling mode" doexpect(subject.body).to be_json_eql(schedule_manually.to_json).at_path("scheduleManually")@@ -239,7 +239,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with updated start date" doexpect(subject.body).to be_json_eql(date_string.to_json).at_path("startDate")@@ -254,7 +254,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with updated finish date" doexpect(subject.body).to be_json_eql(date_string.to_json).at_path("dueDate")@@ -269,7 +269,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) } # rubocop:disable RSpecRails/HaveHttpStatus+ it { expect(response).to have_http_status(:ok) }it "responds with updated finish date" doexpect(subject.body).to be_json_eql(duration.to_json).at_path("remainingTime")@@ -297,7 +297,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with updated work package status" doexpect(subject.body).to be_json_eql(target_status.name.to_json)@@ -349,7 +349,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with updated work package type" doexpect(subject.body).to be_json_eql(target_type.name.to_json)@@ -425,7 +425,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"it "is successful" do- expect(response.status).to eq(200)+ expect(response).to have_http_status(:ok)endit_behaves_like "lock version updated"@@ -496,7 +496,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it { expect(response.body).to be_json_eql(nil.to_json).at_path(href_path) }@@ -507,7 +507,7 @@ RSpec.describe "API v3 Work package resource",shared_examples_for "valid user assignment" dolet(:title) { assigned_user.name.to_s.to_json }- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it {expect(response.body)@@ -614,7 +614,7 @@ RSpec.describe "API v3 Work package resource",context "valid" doinclude_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with the work package assigned to the version" doexpect(subject.body)@@ -630,7 +630,7 @@ RSpec.describe "API v3 Work package resource",include_context "patch request"- it { expect(response.status).to eq(422) }+ it { expect(response).to have_http_status(:unprocessable_entity) }it "has a readonly error" doexpect(response.body)@@ -651,7 +651,7 @@ RSpec.describe "API v3 Work package resource",context "valid" doinclude_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with the work package assigned to the category" doexpect(subject.body)@@ -674,7 +674,7 @@ RSpec.describe "API v3 Work package resource",context "valid" doinclude_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with the work package assigned to the priority" doexpect(subject.body)@@ -698,7 +698,7 @@ RSpec.describe "API v3 Work package resource",context "valid" doinclude_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with the work package and its new budget" doexpect(subject.body).to be_json_eql(target_budget.subject.to_json)@@ -742,7 +742,7 @@ RSpec.describe "API v3 Work package resource",context "valid" doinclude_context "patch request"- it { expect(response.status).to eq(200) }+ it { expect(response).to have_http_status(:ok) }it "responds with the work package assigned to the new value" doexpect(subject.body)diff --git a/spec/requests/api/v3/work_packages/work_packages_schemas_resource_spec.rb b/spec/requests/api/v3/work_packages/work_packages_schemas_resource_spec.rbindex 1e7d94f58e8..2aea024f1a0 100644--- a/spec/requests/api/v3/work_packages/work_packages_schemas_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/work_packages_schemas_resource_spec.rb@@ -59,7 +59,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemasAPI docontext "authorized" docontext "valid" doit "returns HTTP 200" do- expect(last_response.status).to be(200)+ expect(last_response).to have_http_status(:ok)endit "returns a collection of schemas" do@@ -79,7 +79,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemasAPI dolet(:filter_values) { ["#{0}-#{type.id}"] }it "returns HTTP 200" do- expect(last_response.status).to be(200)+ expect(last_response).to have_http_status(:ok)endit "returns an empty collection" do@@ -93,7 +93,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemasAPI dolet(:filter_values) { ["#{project.id}-#{0}"] }it "returns HTTP 200" do- expect(last_response.status).to be(200)+ expect(last_response).to have_http_status(:ok)endit "returns an empty collection" do@@ -107,7 +107,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemasAPI dolet(:filter_values) { ["bogus"] }it "returns HTTP 400" do- expect(last_response.status).to be(400)+ expect(last_response).to have_http_status(:bad_request)endit "returns an error" do@@ -122,7 +122,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemasAPI dolet(:role) { create(:project_role, permissions: []) }it "returns HTTP 403" do- expect(last_response.status).to be(403)+ expect(last_response).to have_http_status(:forbidden)endendend@@ -138,7 +138,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemasAPI docontext "valid schema" doit "returns HTTP 200" do- expect(last_response.status).to be(200)+ expect(last_response).to have_http_status(:ok)endit "sets a weak ETag" do@@ -195,7 +195,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemasAPI docontext "valid schema" doit "returns HTTP 200" do- expect(last_response.status).to be(200)+ expect(last_response).to have_http_status(:ok)end# Further fields are tested in the representer specsdiff --git a/spec/requests/oauth_clients/callback_flow_spec.rb b/spec/requests/oauth_clients/callback_flow_spec.rbindex b62d6ce5586..88e5028f586 100644--- a/spec/requests/oauth_clients/callback_flow_spec.rb+++ b/spec/requests/oauth_clients/callback_flow_spec.rb@@ -60,7 +60,7 @@ RSpec.describe "OAuthClient callback endpoint" docontext "when user is not logged in" doit "requires login" doget uri.to_s- expect(last_response.status).to eq(401)+ expect(last_response).to have_http_status(:unauthorized)endend@@ -79,24 +79,23 @@ RSpec.describe "OAuthClient callback endpoint" doset_cookie "oauth_state_asdf1234=#{state_cookie}"end- # rubocop:disable RSpecRails/HaveHttpStatusshared_examples "with errors and state param with cookie, not being admin" doit "redirects to URI referenced in the state param and held in a cookie" do- expect(response.status).to eq(302)+ expect(response).to have_http_status(:found)expect(response.location).to eq redirect_uriendendshared_examples "with errors, being an admin" doit "redirects to admin settings for the storage" do- expect(response.status).to eq(302)+ expect(response).to have_http_status(:found)expect(URI(response.location).path).to eq edit_admin_settings_storage_path(oauth_client.integration)endendshared_examples "fallback redirect" doit "redirects to home" do- expect(response.status).to eq(302)+ expect(response).to have_http_status(:found)expect(URI(response.location).path).to eq API::V3::Utilities::PathHelper::ApiV3Path::root_pathendend@@ -110,7 +109,7 @@ RSpec.describe "OAuthClient callback endpoint" doit "redirects to the URL that was referenced by the state param and held by a cookie" doexpect(rack_oauth2_client).to have_received(:authorization_code=).with(code)- expect(response.status).to eq 302+ expect(response).to have_http_status :foundexpect(response.location).to eq redirect_uriexpect(OAuthClientToken.count).to eq 1expect(OAuthClientToken.last.access_token).to eq "xyzaccesstoken"@@ -185,6 +184,5 @@ RSpec.describe "OAuthClient callback endpoint" doit_behaves_like "fallback redirect"end- # rubocop:enable RSpecRails/HaveHttpStatusendenddiff --git a/spec/requests/oauth_clients/ensure_connection_flow_spec.rb b/spec/requests/oauth_clients/ensure_connection_flow_spec.rbindex eced9e187b6..e2799dfb9df 100644--- a/spec/requests/oauth_clients/ensure_connection_flow_spec.rb+++ b/spec/requests/oauth_clients/ensure_connection_flow_spec.rb@@ -45,7 +45,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :wecontext "when user is not logged in" doit "requires login" doget oauth_clients_ensure_connection_url(oauth_client_id: oauth_client.client_id)- expect(last_response.status).to eq(401)+ expect(last_response).to have_http_status(:unauthorized)endend@@ -54,7 +54,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :weit "responds with 400 when storage_id parameter is absent" doget oauth_clients_ensure_connection_url(oauth_client_id: oauth_client.client_id)- expect(last_response.status).to eq(400)+ expect(last_response).to have_http_status(:bad_request)expect(last_response.body).to eq("Required parameter missing: storage_id")end@@ -77,7 +77,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :weget oauth_clients_ensure_connection_url(oauth_client_id: oauth_client.client_id, storage_id: storage.id)oauth_client = storage.oauth_client- expect(last_response.status).to eq(302)+ expect(last_response).to have_http_status(:found)expect(last_response.location).to eq("#{storage.host}/index.php/apps/oauth2/authorize?client_id=" \"#{oauth_client.client_id}&redirect_uri=#{CGI.escape(Rails.application.root_url)}" \@@ -98,7 +98,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :wedestination_url: "#{root_url}123")oauth_client = storage.oauth_client- expect(last_response.status).to eq(302)+ expect(last_response).to have_http_status(:found)expect(last_response.location).to eq("#{storage.host}/index.php/apps/oauth2/authorize?client_id=" \"#{oauth_client.client_id}&redirect_uri=#{CGI.escape(Rails.application.root_url)}" \@@ -118,7 +118,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :wedestination_url: "#{storage.host}/index.php")oauth_client = storage.oauth_client- expect(last_response.status).to eq(302)+ expect(last_response).to have_http_status(:found)expect(last_response.location).to eq("#{storage.host}/index.php/apps/oauth2/authorize?client_id=" \"#{oauth_client.client_id}&redirect_uri=#{CGI.escape(Rails.application.root_url)}" \@@ -153,7 +153,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :weit "redirects to root_url" doget oauth_clients_ensure_connection_url(oauth_client_id: oauth_client.client_id, storage_id: storage.id)- expect(last_response.status).to eq(302)+ expect(last_response).to have_http_status(:found)expect(last_response.location).to eq("http://www.example.com/")expect(last_response.cookies.keys).to eq(["_open_project_session"])end@@ -167,7 +167,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :wedestination_url: "#{root_url}123")storage.oauth_client- expect(last_response.status).to eq(302)+ expect(last_response).to have_http_status(:found)expect(last_response.location).to eq("http://www.example.com/123")expect(last_response.cookies.keys).to eq(["_open_project_session"])end@@ -180,7 +180,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :wedestination_url: "#{storage.host}/index.php")storage.oauth_client- expect(last_response.status).to eq(302)+ expect(last_response).to have_http_status(:found)expect(last_response.location).to eq("http://www.example.com/")expect(last_response.cookies.keys).to eq(["_open_project_session"])enddiff --git a/spec/requests/openid_google_provider_callback_spec.rb b/spec/requests/openid_google_provider_callback_spec.rbindex f43e346ef8b..43906e46995 100644--- a/spec/requests/openid_google_provider_callback_spec.rb+++ b/spec/requests/openid_google_provider_callback_spec.rb@@ -96,7 +96,7 @@ RSpec.describe "OpenID Google provider callback", with_ee: %i[openid_providers]}} doresponse = get uri.to_s- expect(response.status).to eq(302)+ expect(response).to have_http_status(:found)expect(response.location).to eq("http://example.org/two_factor_authentication/request")endenddiff --git a/spec/requests/rate_limiting/api_v3_rate_limiting_spec.rb b/spec/requests/rate_limiting/api_v3_rate_limiting_spec.rbindex 118f59eb379..c2e928dcd04 100644--- a/spec/requests/rate_limiting/api_v3_rate_limiting_spec.rb+++ b/spec/requests/rate_limiting/api_v3_rate_limiting_spec.rb@@ -48,13 +48,13 @@ RSpec.describe "Rate limiting APIv3",nil,"CONTENT_TYPE" => "application/json"- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendpost "/api/v3/work_packages/form",nil,"CONTENT_TYPE" => "application/json"- expect(last_response.status).to eq 429+ expect(last_response).to have_http_status :too_many_requestsendend@@ -68,7 +68,7 @@ RSpec.describe "Rate limiting APIv3",nil,"CONTENT_TYPE" => "application/json"- expect(last_response.status).to eq 200+ expect(last_response).to have_http_status :okendendenddiff --git a/spec/support/have_http_status_with_rack_response.rb b/spec/support/have_http_status_with_rack_response.rbnew file mode 100644index 00000000000..47dfd80c791--- /dev/null+++ b/spec/support/have_http_status_with_rack_response.rb@@ -0,0 +1,45 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module HaveHttpStatusWithRackResponse+ def as_test_response(obj)+ if obj.is_a?(Rack::MockResponse)+ # `have_http_status` matcher would fail if the response object is a+ # `Rack::MockResponse`. Hack to disguise `Rack::MockResponse` into a+ # `ActionDispatch::TestResponse` object.+ obj = ActionDispatch::Response.new(obj.status, obj.headers, obj.body).tap do |resp|+ resp.request = ActionDispatch::Request.new({})+ end+ ::ActionDispatch::TestResponse.from_response(obj)+ else+ super+ end+ end+end++RSpec::Rails::Matchers::HaveHttpStatus.prepend(HaveHttpStatusWithRackResponse)diff --git a/spec/support/queries/shared_get_individual_query_examples.rb b/spec/support/queries/shared_get_individual_query_examples.rbindex ad7ee08b372..0de710dbece 100644--- a/spec/support/queries/shared_get_individual_query_examples.rb+++ b/spec/support/queries/shared_get_individual_query_examples.rb@@ -44,7 +44,7 @@ RSpec.shared_examples_for "GET individual query" doendit "succeeds" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endit "has the right endpoint set for the self reference" do@@ -140,7 +140,7 @@ RSpec.shared_examples_for "GET individual query" docontext "with EE", with_ee: %i[baseline_comparison] doit "succeeds" do- expect(last_response.status).to eq(200)+ expect(last_response).to have_http_status(:ok)endend