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

Fix expected flash

Oliver Günther1a0281858c30
diff --git a/spec/support/primerized_flash/expectations.rb b/spec/support/primerized_flash/expectations.rb
index b431bf1bcb0..e13e222bfa2 100644
--- a/spec/support/primerized_flash/expectations.rb
+++ b/spec/support/primerized_flash/expectations.rb
@@ -1,9 +1,7 @@
module PrimerizedFlash
module Expectations
- include FlashMessagesHelper
-
def expect_primerized_flash(message:, type: :success, wait: 20)
- mapped_scheme = mapped_flash_type(type)
+ mapped_scheme = expected_flash_type(type)
expect(page).to have_css(".Banner--#{mapped_scheme}", text: message, wait:)
end
@@ -28,10 +26,23 @@ module PrimerizedFlash
if type.nil?
expect(page).not_to have_test_selector("op-primer-flash-message")
else
- mapped_scheme = mapped_flash_type(type)
+ mapped_scheme = expected_flash_type(type)
expect(page).to have_no_css(".Banner--#{mapped_scheme}", text: message, wait:)
end
end
+
+ def expected_flash_type(type)
+ case type
+ when :error
+ :error # The class is error, but the scheme is danger
+ when :warning
+ :warning
+ when :success, :notice
+ :success
+ else
+ :default
+ end
+ end
end
end