Skip to content

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

Replace expect_primerized_error -> expect_primerized_flash

Oliver Günther9cc3d98391a9
diff --git a/modules/bim/spec/features/model_management_spec.rb b/modules/bim/spec/features/model_management_spec.rb
index 7d8686a3ca5..919d9f9874a 100644
--- a/modules/bim/spec/features/model_management_spec.rb
+++ b/modules/bim/spec/features/model_management_spec.rb
@@ -130,7 +130,7 @@ RSpec.describe "model management", :js, with_config: { edition: "bim" } do
it "I can't see any models and perform no actions" do
expected = "[Error 403] You are not authorized to access this page."
- expect_primerized_error(expected)
+ expect_primerized_flash(type: :error, message: expected)
index_page.add_model_allowed false
end
diff --git a/modules/bim/spec/features/model_viewer_spec.rb b/modules/bim/spec/features/model_viewer_spec.rb
index cda6ce1b769..4229b29e959 100644
--- a/modules/bim/spec/features/model_viewer_spec.rb
+++ b/modules/bim/spec/features/model_viewer_spec.rb
@@ -135,7 +135,7 @@ RSpec.describe "model viewer", :js, with_config: { edition: "bim" } do
it "shows no viewer" do
expected = "[Error 403] You are not authorized to access this page."
- expect_primerized_error(expected)
+ expect_primerized_flash(type: :error, message: expected)
show_model_page.model_viewer_visible false
show_model_page.model_viewer_shows_a_toolbar false
diff --git a/modules/boards/spec/features/board_management_spec.rb b/modules/boards/spec/features/board_management_spec.rb
index cbc2ad6ca2f..2c1c691e155 100644
--- a/modules/boards/spec/features/board_management_spec.rb
+++ b/modules/boards/spec/features/board_management_spec.rb
@@ -300,7 +300,7 @@ RSpec.describe "Board management spec", :js, with_ee: %i[board_view] do
it "does not allow viewing of boards" do
visit project_work_package_board_path(project, board_view)
- expect_primerized_error(I18n.t(:notice_not_authorized))
+ expect_primerized_flash(type: :error, message: I18n.t(:notice_not_authorized))
board_index.expect_editable false
end
@@ -311,7 +311,7 @@ RSpec.describe "Board management spec", :js, with_ee: %i[board_view] do
it "does not allow viewing of boards" do
board_index.visit!
- expect_primerized_error(I18n.t(:notice_not_authorized))
+ expect_primerized_flash(type: :error, message: I18n.t(:notice_not_authorized))
end
end
end
diff --git a/modules/meeting/spec/features/structured_meetings/history_spec.rb b/modules/meeting/spec/features/structured_meetings/history_spec.rb
index ffafbdaea5e..e2fb2aac866 100644
--- a/modules/meeting/spec/features/structured_meetings/history_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/history_spec.rb
@@ -355,6 +355,6 @@ RSpec.describe "history",
visit history_meeting_path(meeting)
expected = "[Error 403] You are not authorized to access this page."
- expect_primerized_error(expected)
+ expect_primerized_flash(type: :error, message: expected)
end
end
diff --git a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb b/modules/reporting/spec/features/support/components/cost_reports_base_table.rb
index aab032b1734..d2ce032bc97 100644
--- a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb
+++ b/modules/reporting/spec/features/support/components/cost_reports_base_table.rb
@@ -33,7 +33,7 @@ module Components
include Capybara::DSL
include Capybara::RSpecMatchers
include RSpec::Matchers
- include PrimerizedFlash::Expectations
+ include Flash::Expectations
attr_reader :time_logging_modal
diff --git a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb
index 6d868259c62..68ad1f662a9 100644
--- a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe "Admin 2FA management", :js, with_settings: {
click_button I18n.t(:button_continue)
# Enter valid phone number
- expect_primerized_error("Phone number must be of format +XX XXXXXXXXX")
+ expect_primerized_flash(type: :error, message: "Phone number must be of format +XX XXXXXXXXX")
SeleniumHubWaiter.wait
fill_in "device_phone_number", with: "+49 123456789"
diff --git a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
index b2bfe0e6310..d678b2ea783 100644
--- a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
+++ b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
@@ -50,7 +50,7 @@ RSpec.describe "Login with 2FA backup code", :js, with_settings: {
click_on "Submit"
# Expect failure
- expect_primerized_error(I18n.t("two_factor_authentication.error_invalid_backup_code"))
+ expect_primerized_flash(type: :error, message: I18n.t("two_factor_authentication.error_invalid_backup_code"))
expect(page).to have_current_path signin_path
# Try again!
diff --git a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
index 7af11b31c1f..d09c7a613ae 100644
--- a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe "Login with enforced 2FA", :js, with_settings: {
first_login_step
two_factor_step("whatever")
- expect_primerized_error(I18n.t(:notice_account_otp_invalid))
+ expect_primerized_flash(type: :error, message: I18n.t(:notice_account_otp_invalid))
expect(page).to have_current_path signin_path
end
end
diff --git a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
index 75df63bbf05..dac190b4907 100644
--- a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe "Login with 2FA device", :js, with_settings: {
first_login_step
two_factor_step("whatever")
- expect_primerized_error(I18n.t(:notice_account_otp_invalid))
+ expect_primerized_flash(type: :error, message: I18n.t(:notice_account_otp_invalid))
expect(page).to have_current_path signin_path
end
end
diff --git a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
index 0271c7f9ec4..39ebe5139e5 100644
--- a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe "My Account 2FA configuration", :js, with_settings: {
click_button I18n.t(:button_continue)
# Enter valid phone number
- expect_primerized_error("Phone number must be of format +XX XXXXXXXXX")
+ expect_primerized_flash(type: :error, message: "Phone number must be of format +XX XXXXXXXXX")
fill_in "device_phone_number", with: "+49 123456789"
click_button I18n.t(:button_continue)
@@ -56,7 +56,7 @@ RSpec.describe "My Account 2FA configuration", :js, with_settings: {
expect(page).to have_css("h2", text: I18n.t("two_factor_authentication.devices.confirm_device"))
expect(page).to have_css("input#otp")
- expect_primerized_error(I18n.t("two_factor_authentication.devices.registration_failed_token_invalid"))
+ expect_primerized_flash(type: :error, message: I18n.t("two_factor_authentication.devices.registration_failed_token_invalid"))
# Fill in correct token
fill_in "otp", with: sms_token
diff --git a/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb b/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
index cad8428e776..d4d29eb0f8d 100644
--- a/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
+++ b/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
@@ -46,7 +46,7 @@ RSpec.shared_examples "create enforced sms device" do
click_on "Continue"
# Expect error on invalid phone
- expect_primerized_error("Phone number must be of format +XX XXXXXXXXX")
+ expect_primerized_flash(type: :error, message: "Phone number must be of format +XX XXXXXXXXX")
SeleniumHubWaiter.wait
fill_in "device_phone_number", with: "+49 123456789"
@@ -71,7 +71,7 @@ RSpec.shared_examples "create enforced sms device" do
expect(page).to have_css("h2", text: I18n.t("two_factor_authentication.devices.confirm_device"))
expect(page).to have_css("input#otp")
- expect_primerized_error(I18n.t("two_factor_authentication.devices.registration_failed_token_invalid"))
+ expect_primerized_flash(type: :error, message: I18n.t("two_factor_authentication.devices.registration_failed_token_invalid"))
SeleniumHubWaiter.wait
# Fill in wrong token
diff --git a/spec/features/admin/attribute_help_texts_spec.rb b/spec/features/admin/attribute_help_texts_spec.rb
index ad855dc80af..fdbdf4f49e7 100644
--- a/spec/features/admin/attribute_help_texts_spec.rb
+++ b/spec/features/admin/attribute_help_texts_spec.rb
@@ -113,7 +113,7 @@ RSpec.describe "Attribute help texts", :js, :with_cuprite do
click_button "Save"
# Handle errors
- expect_primerized_error("Help text can't be blank.")
+ expect_primerized_flash(type: :error, message: "Help text can't be blank.")
SeleniumHubWaiter.wait
editor.set_markdown("New**help**text")
click_button "Save"
diff --git a/spec/features/admin/enterprise/enterprise_spec.rb b/spec/features/admin/enterprise/enterprise_spec.rb
index 78e92e56d34..5c60ca726d8 100644
--- a/spec/features/admin/enterprise/enterprise_spec.rb
+++ b/spec/features/admin/enterprise/enterprise_spec.rb
@@ -60,7 +60,8 @@ RSpec.describe "Enterprise token", :js, :with_cuprite do
submit_button.click
# Error output
- expect_primerized_error("Enterprise support token can't be read. Are you sure it is a support token?")
+ expect_primerized_flash(type: :error,
+ message: "Enterprise support token can't be read. Are you sure it is a support token?")
within "span.errorSpan" do
expect(page).to have_css("#enterprise_token_encoded_token")
diff --git a/spec/features/admin/oauth/oauth_applications_management_spec.rb b/spec/features/admin/oauth/oauth_applications_management_spec.rb
index 63119d2e3a2..30dddbbfa25 100644
--- a/spec/features/admin/oauth/oauth_applications_management_spec.rb
+++ b/spec/features/admin/oauth/oauth_applications_management_spec.rb
@@ -49,14 +49,14 @@ RSpec.describe "OAuth applications management", :js, :with_cuprite do
fill_in "application_redirect_uri", with: "not a url!"
click_on "Create"
- expect_primerized_error("Redirect URI must be an absolute URI.")
+ expect_primerized_flash(type: :error, message: "Redirect URI must be an absolute URI.")
fill_in("application_redirect_uri", with: "")
# Fill redirect_uri which does not provide a Secure Context
fill_in "application_redirect_uri", with: "http://example.org"
click_on "Create"
- expect_primerized_error('Redirect URI is not providing a "Secure Context"')
+ expect_primerized_flash(type: :error, message: 'Redirect URI is not providing a "Secure Context"')
# Can create localhost without https (https://community.openproject.com/wp/34025)
fill_in "application_redirect_uri", with: "urn:ietf:wg:oauth:2.0:oob\nhttp://localhost/my/callback"
diff --git a/spec/features/admin/test_mail_notification_spec.rb b/spec/features/admin/test_mail_notification_spec.rb
index 97b2d3579ec..5cb2ceedb3d 100644
--- a/spec/features/admin/test_mail_notification_spec.rb
+++ b/spec/features/admin/test_mail_notification_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe "Test mail notification", :js, :with_cuprite do
click_link "Send a test email"
expected = "An error occurred while sending mail (#{error_message})"
- expect_primerized_error(expected)
+ expect_primerized_flash(type: :error, message: expected)
expect(page).to have_no_css(".op-toast.-error strong")
end
end
diff --git a/spec/features/admin/working_days_spec.rb b/spec/features/admin/working_days_spec.rb
index 67dcc545b13..81b9d1724bc 100644
--- a/spec/features/admin/working_days_spec.rb
+++ b/spec/features/admin/working_days_spec.rb
@@ -141,7 +141,7 @@ RSpec.describe "Working Days", :js, :with_cuprite do
dialog.confirm
end
- expect_primerized_error("At least one day of the week must be defined as a working day.")
+ expect_primerized_flash(type: :error, message: "At least one day of the week must be defined as a working day.")
# Restore the checkboxes to their valid state
expect(page).to have_checked_field "Monday"
expect(page).to have_checked_field "Tuesday"
@@ -171,7 +171,8 @@ RSpec.describe "Working Days", :js, :with_cuprite do
# Not executing the background jobs
dialog.confirm
- expect_primerized_error("The previous changes to the working days configuration have not been applied yet.")
+ expect_primerized_flash(type: :error,
+ message: "The previous changes to the working days configuration have not been applied yet.")
end
end
diff --git a/spec/features/auth/consent_auth_stage_spec.rb b/spec/features/auth/consent_auth_stage_spec.rb
index 2c4b968bad1..04751d2e80f 100644
--- a/spec/features/auth/consent_auth_stage_spec.rb
+++ b/spec/features/auth/consent_auth_stage_spec.rb
@@ -256,7 +256,7 @@ RSpec.describe "Authentication Stages" do
# Decline the consent
click_on I18n.t(:button_decline)
- expect_primerized_error("[email protected]")
+ expect_primerized_flash(type: :error, message: "[email protected]")
end
end
end
diff --git a/spec/features/projects/modules_spec.rb b/spec/features/projects/modules_spec.rb
index a84be7858ee..a15fcb1dee4 100644
--- a/spec/features/projects/modules_spec.rb
+++ b/spec/features/projects/modules_spec.rb
@@ -65,11 +65,10 @@ RSpec.describe "Projects module administration" do
check "Calendar"
click_button "Save"
- expect_primerized_error(
+ expect_primerized_flash(type: :error, message:
I18n.t(:"activerecord.errors.models.project.attributes.enabled_modules.dependency_missing",
dependency: "Work packages",
- module: "Calendars")
- )
+ module: "Calendars"))
expect(page).to have_no_xpath(project_work_packages_menu_link_selector)
diff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb
index 14c9eb68528..97a901455c3 100644
--- a/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb
+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe "Edit project custom fields on project overview page", :js do
member_with_project_attributes_edit_permissions.reload
dialog.submit
- expect_primerized_error(I18n.t(:notice_not_authorized))
+ expect_primerized_flash(type: :error, message: I18n.t(:notice_not_authorized))
end
end
end
diff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rb
index 20e862d4ab1..d3635a0dc3c 100644
--- a/spec/features/projects/projects_index_spec.rb
+++ b/spec/features/projects/projects_index_spec.rb
@@ -274,7 +274,7 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { login
error_text = "Orders ><script src='/foobar js'></script> is not set to one of the allowed values. and does not exist."
error_html = "Orders &gt;&lt;script src='/foobar js'&gt;&lt;/script&gt; is not set to one of the allowed values. and does not exist."
- expect_primerized_error(error_text)
+ expect_primerized_flash(type: :error, message: error_text)
error_container = find_primerized_flash(type: :error)
expect(error_container["innerHTML"]).to include error_html
diff --git a/spec/features/roles/create_spec.rb b/spec/features/roles/create_spec.rb
index 9ef403e7401..0ceeb15f38e 100644
--- a/spec/features/roles/create_spec.rb
+++ b/spec/features/roles/create_spec.rb
@@ -55,7 +55,7 @@ RSpec.describe "Role creation", :js, :with_cuprite do
click_button "Create"
- expect_primerized_error("Name has already been taken")
+ expect_primerized_flash(type: :error, message: "Name has already been taken")
fill_in "Name", with: "New role name"
@@ -64,7 +64,8 @@ RSpec.describe "Role creation", :js, :with_cuprite do
click_button "Create"
- expect_primerized_error("Permissions need to also include 'View members' as 'Manage members' is selected.")
+ expect_primerized_flash(type: :error,
+ message: "Permissions need to also include 'View members' as 'Manage members' is selected.")
check "View members"
select existing_role.name, from: "Copy workflow from"
diff --git a/spec/features/types/crud_spec.rb b/spec/features/types/crud_spec.rb
index 37434bf3606..dd6b1f6f4c7 100644
--- a/spec/features/types/crud_spec.rb
+++ b/spec/features/types/crud_spec.rb
@@ -52,7 +52,7 @@ RSpec.describe "Types", :js, :with_cuprite do
click_button "Create"
- expect_primerized_error("Name has already been taken.")
+ expect_primerized_flash(type: :error, message: "Name has already been taken.")
# Values are retained
expect(page)
@@ -122,7 +122,7 @@ RSpec.describe "Types", :js, :with_cuprite do
end
it "renders an error message with links to the archived project in the projects list" do
- expect_primerized_error project.name
+ expect_primerized_flash type: :error, message: project.name
end
end
end
diff --git a/spec/features/users/password_change_spec.rb b/spec/features/users/password_change_spec.rb
index 1736832fa2b..0c905a6f36d 100644
--- a/spec/features/users/password_change_spec.rb
+++ b/spec/features/users/password_change_spec.rb
@@ -144,13 +144,13 @@ RSpec.describe "random password generation", :js, :with_cuprite do
fill_in "user_password", with: "adminADMIN"
fill_in "user_password_confirmation", with: "adminADMIN"
scroll_to_and_click(find(".button", text: "Save"))
- expect_primerized_error("Password Must contain characters of the following classes")
+ expect_primerized_flash(type: :error, message: "Password Must contain characters of the following classes")
# 2 of 3 classes
fill_in "user_password", with: "adminADMIN123"
fill_in "user_password_confirmation", with: "adminADMIN123"
scroll_to_and_click(find(".button", text: "Save"))
- expect_primerized_error("Password Must contain characters of the following classes")
+ expect_primerized_flash(type: :error, message: "Password Must contain characters of the following classes")
# All classes
fill_in "user_password", with: "adminADMIN!"
diff --git a/spec/features/versions/delete_spec.rb b/spec/features/versions/delete_spec.rb
index c93ef2882c1..b2204174197 100644
--- a/spec/features/versions/delete_spec.rb
+++ b/spec/features/versions/delete_spec.rb
@@ -53,7 +53,7 @@ RSpec.describe "version delete", :js, :with_cuprite do
end
end
- expect_primerized_error(I18n.t(:error_can_not_delete_in_use_archived_undisclosed))
+ expect_primerized_flash(type: :error, message: I18n.t(:error_can_not_delete_in_use_archived_undisclosed))
expect(page).to have_no_css("a", text: "Archived child")
user.update!(admin: true)
@@ -67,7 +67,7 @@ RSpec.describe "version delete", :js, :with_cuprite do
end
end
- expect_primerized_error("There are also work packages in archived projects.")
+ expect_primerized_flash(type: :error, message: "There are also work packages in archived projects.")
expect(page).to have_css("a", text: "Archived child")
end
end
diff --git a/spec/features/work_packages/bulk/copy_work_package_spec.rb b/spec/features/work_packages/bulk/copy_work_package_spec.rb
index ec6e7d24ba0..13f34af8785 100644
--- a/spec/features/work_packages/bulk/copy_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/copy_work_package_spec.rb
@@ -201,13 +201,17 @@ RSpec.describe "Copy work packages through Rails view", :js, :with_cuprite do
it "fails, informing of the reasons" do
click_on "Copy and follow"
- expect_primerized_error(I18n.t("work_packages.bulk.none_could_be_saved", total: 3))
- expect_primerized_error(I18n.t("work_packages.bulk.selected_because_descendants", total: 3, selected: 2))
- expect_primerized_error("#{work_package.id}: Type #{I18n.t('activerecord.errors.messages.inclusion')}")
- expect_primerized_error("#{work_package2.id}: Type #{I18n.t('activerecord.errors.messages.inclusion')}")
- expect_primerized_error(
- "#{child.id} (descendant of selected): Type #{I18n.t('activerecord.errors.messages.inclusion')}"
- )
+ expect_primerized_flash(type: :error, message: I18n.t("work_packages.bulk.none_could_be_saved", total: 3))
+ expect_primerized_flash(type: :error,
+ message: I18n.t(
+ "work_packages.bulk.selected_because_descendants", total: 3, selected: 2
+ ))
+ expect_primerized_flash(type: :error,
+ message: "#{work_package.id}: Type #{I18n.t('activerecord.errors.messages.inclusion')}")
+ expect_primerized_flash(type: :error,
+ message: "#{work_package2.id}: Type #{I18n.t('activerecord.errors.messages.inclusion')}")
+ expect_primerized_flash(type: :error, message:
+ "#{child.id} (descendant of selected): Type #{I18n.t('activerecord.errors.messages.inclusion')}")
end
context "when the limit to move in the frontend is 0",
diff --git a/spec/features/work_packages/bulk/move_work_package_spec.rb b/spec/features/work_packages/bulk/move_work_package_spec.rb
index 49fa31633a5..0e73db0be38 100644
--- a/spec/features/work_packages/bulk/move_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/move_work_package_spec.rb
@@ -140,7 +140,7 @@ RSpec.describe "Moving a work package through Rails view", :js do
click_on "Move and follow"
wait_for_reload
- expect_primerized_error I18n.t(:"work_packages.bulk.none_could_be_saved", total: 1)
+ expect_primerized_flash type: :error, message: I18n.t(:"work_packages.bulk.none_could_be_saved", total: 1)
# Should NOT have moved
child_wp.reload
@@ -167,7 +167,7 @@ RSpec.describe "Moving a work package through Rails view", :js do
click_on "Move and follow"
end
- expect_primerized_error I18n.t(:"work_packages.bulk.none_could_be_saved", total: 1)
+ expect_primerized_flash type: :error, message: I18n.t(:"work_packages.bulk.none_could_be_saved", total: 1)
child_wp.reload
work_package.reload
expect(work_package.project_id).to eq(project.id)
@@ -209,15 +209,15 @@ RSpec.describe "Moving a work package through Rails view", :js do
end
it "displays an error message explaining which work package could not be moved and why" do
- expect_primerized_error(I18n.t("work_packages.bulk.could_not_be_saved"))
- expect_primerized_error("#{work_package2.id}: Project #{I18n.t('activerecord.errors.messages.error_readonly')}")
+ expect_primerized_flash(type: :error, message: I18n.t("work_packages.bulk.could_not_be_saved"))
+ expect_primerized_flash(type: :error,
+ message: "#{work_package2.id}: Project #{I18n.t('activerecord.errors.messages.error_readonly')}")
- expect_primerized_error(
+ expect_primerized_flash(type: :error, message:
I18n.t("work_packages.bulk.x_out_of_y_could_be_saved",
failing: 1,
total: 2,
- success: 1)
- )
+ success: 1))
expect(work_package.reload.project_id).to eq(project2.id)
expect(work_package2.reload.project_id).to eq(project.id)
diff --git a/spec/features/work_packages/bulk/update_work_package_spec.rb b/spec/features/work_packages/bulk/update_work_package_spec.rb
index fe949ad54f2..8381b71454c 100644
--- a/spec/features/work_packages/bulk/update_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/update_work_package_spec.rb
@@ -111,10 +111,11 @@ RSpec.describe "Bulk update work packages through Rails view", :js, :with_cuprit
fill_in "Parent", with: "-1"
click_on "Submit"
- expect_primerized_error(I18n.t("work_packages.bulk.none_could_be_saved", total: 2))
- expect_primerized_error("#{work_package.id}: Parent #{I18n.t('activerecord.errors.messages.does_not_exist')}")
+ expect_primerized_flash(type: :error, message: I18n.t("work_packages.bulk.none_could_be_saved", total: 2))
+ expect_primerized_flash(type: :error,
+ message: "#{work_package.id}: Parent #{I18n.t('activerecord.errors.messages.does_not_exist')}")
- expect_primerized_error(
+ expect_primerized_flash(type: :error, message:
<<~MSG.squish
#{work_package2.id}:
Parent #{I18n.t('activerecord.errors.messages.does_not_exist')}
@@ -142,11 +143,10 @@ RSpec.describe "Bulk update work packages through Rails view", :js, :with_cuprit
fill_in custom_field.name, with: "Custom field text"
click_on "Submit"
- expect_primerized_error(
- I18n.t("work_packages.bulk.x_out_of_y_could_be_saved", total: 2, failing: 1, success: 1)
- )
+ expect_primerized_flash(type: :error, message:
+ I18n.t("work_packages.bulk.x_out_of_y_could_be_saved", total: 2, failing: 1, success: 1))
- expect_primerized_error(
+ expect_primerized_flash(type: :error, message:
<<~MSG.squish
#{work_package2.id}:
#{custom_field.name} #{I18n.t('activerecord.errors.messages.error_readonly')}
diff --git a/spec/support/components/password_confirmation_dialog.rb b/spec/support/components/password_confirmation_dialog.rb
index 1870544ff33..cab61adf830 100644
--- a/spec/support/components/password_confirmation_dialog.rb
+++ b/spec/support/components/password_confirmation_dialog.rb
@@ -33,7 +33,7 @@ module Components
include Capybara::DSL
include Capybara::RSpecMatchers
include RSpec::Matchers
- include PrimerizedFlash::Expectations
+ include Flash::Expectations
def confirm_flow_with(password, with_keyboard: false, should_fail: false)
expect_open
@@ -71,7 +71,7 @@ module Components
end
if should_fail
- expect_primerized_error(I18n.t(:notice_password_confirmation_failed))
+ expect_primerized_flash(type: :error, message: I18n.t(:notice_password_confirmation_failed))
else
expect(page).to have_no_css(".op-toast.-error")
end
diff --git a/spec/support/primerized_flash/expectations.rb b/spec/support/flash/expectations.rb
similarity index 91%
rename from spec/support/primerized_flash/expectations.rb
rename to spec/support/flash/expectations.rb
index 1ad9b32bd87..daa1ca69ea5 100644
--- a/spec/support/primerized_flash/expectations.rb
+++ b/spec/support/flash/expectations.rb
@@ -1,9 +1,5 @@
-module PrimerizedFlash
+module Flash
module Expectations
- def expect_primerized_error(message)
- expect_primerized_flash(message:, type: :error)
- end
-
def expect_primerized_flash(message:, type: :success, wait: 20)
expected_css = expected_flash_css(type)
expect(page).to have_css(expected_css, text: message, wait:)
@@ -66,5 +62,5 @@ module PrimerizedFlash
end
RSpec.configure do |config|
- config.include PrimerizedFlash::Expectations
+ config.include Flash::Expectations
end
diff --git a/spec/support/pages/page.rb b/spec/support/pages/page.rb
index dfc03e770df..91fe9504fc0 100644
--- a/spec/support/pages/page.rb
+++ b/spec/support/pages/page.rb
@@ -37,7 +37,7 @@ module Pages
include RSpec::Matchers
include OpenProject::StaticRouting::UrlHelpers
include Toasts::Expectations
- include PrimerizedFlash::Expectations
+ include Flash::Expectations
def current_page?
URI.parse(current_url).path == path
diff --git a/spec/support/toasts/expectations.rb b/spec/support/toasts/expectations.rb
index f27aee85311..47baac2be88 100644
--- a/spec/support/toasts/expectations.rb
+++ b/spec/support/toasts/expectations.rb
@@ -4,8 +4,8 @@ module Toasts
if toast_type == :angular
expect(page).to have_css(".op-toast.-#{type}", text: message, wait:)
elsif type == :error
- ActiveSupport::Deprecation.warn("Use `expect_primerized_error(message)` instead of expect_toast with type: :error")
- expect_primerized_error(message)
+ ActiveSupport::Deprecation.warn("Use `expect_primerized_flash(type: :error, message: message)` instead of expect_toast with type: :error")
+ expect_primerized_flash(type: :error, message:)
elsif type == :success
ActiveSupport::Deprecation.warn(
"Use `expect_primerized_flash(type: :success, message:)` instead of expect_toast with type: :success"