Sha256: 2a7de27a5fbf244cdd6895d8e3dd101d9e7f0312928c8b5cf57ac3163987fcf4

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

module Mache
  module Helpers
    module Rails
      # The {Flash} module can be Included into page object classes that support
      # flash behaviour.
      module Flash
        def self.included(base)
          base.extend(ClassMethods)
        end

        module ClassMethods # :nodoc:
          def flash(selector)
            element :flash, selector
          end
        end

        # rubocop:disable Style/PredicateName
        def has_notice_message?(text)
          css_class = flash[:class] || ""
          css_class.include?("notice") && flash.text =~ /\s*#{text}\s*/
        end

        def has_alert_message?(text)
          css_class = flash[:class] || ""
          css_class.include?("error") && flash.text =~ /\s*#{text}\s*/
        end
        # rubocop:enable Style/PredicateName
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mache-2.1.0 lib/mache/helpers/rails/flash.rb