lib/mache/helpers/rails/flash.rb in mache-2.1.1 vs lib/mache/helpers/rails/flash.rb in mache-3.0.0

- old
+ new

@@ -2,11 +2,11 @@ module Helpers module Rails # The {Flash} module can be Included into page object classes that support # flash behaviour. # - # rubocop:disable Style/PredicateName + # rubocop:disable Naming/PredicateName module Flash def self.included(base) base.extend(ClassMethods) end @@ -16,50 +16,50 @@ end end # Tests whether the page has a flash message. # - # @param [String, Symbol] type a flash message type - # @param [Regexp, String] text a value to match + # @param type [String, Symbol] a flash message type + # @param text [Regexp, String] a value to match # @return `true` if the page has a matching message, `false` otherwise def has_message?(type, text) - css_class = flash[:class] || "" + css_class = flash[:class] || '' regexp = text.is_a?(String) ? /\A#{Regexp.escape(text)}\Z/ : text css_class.include?(type.to_s) && flash.text.strip =~ regexp end # Tests whether the page has a success message. # - # @param [Regexp, String] text a value to match + # @param text [Regexp, String] a value to match # @return `true` if the page has a matching message, `false` otherwise def has_success_message?(text) has_message?(:success, text) end # Tests whether the page has a notice message. # - # @param [Regexp, String] text a value to match + # @param text [Regexp, String] a value to match # @return `true` if the page has a matching message, `false` otherwise def has_notice_message?(text) has_message?(:notice, text) end # Tests whether the page has an alert message. # - # @param [Regexp, String] text a value to match + # @param text [Regexp, String] a value to match # @return `true` if the page has a matching message, `false` otherwise def has_alert_message?(text) has_message?(:alert, text) end # Tests whether the page has an error message. # - # @param [Regexp, String] text a value to match + # @param text [Regexp, String] a value to match # @return `true` if the page has a matching message, `false` otherwise def has_error_message?(text) has_message?(:error, text) end end - # rubocop:enable Style/PredicateName + # rubocop:enable Naming/PredicateName end end end