Sha256: 37f0beb3cf2fd1e0955c7ca0b520ee26643caf8b7d051c83ac761c890df63b9d

Contents?: true

Size: 889 Bytes

Versions: 12

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true

module PageMagic
  class Element
    # class NotFound - Used to represent elements which are missing. All method calls other than
    # to those that check visibility thrown a {PageMagic::ElementMissingException} exception
    class NotFound
      # @private [Capybara::ElementNotFound] exception
      def initialize(exception)
        @exception = exception
      end

      # @return [Boolean] - always false
      def visible?
        false
      end

      # @return [Boolean] - always false
      def present?
        false
      end

      # @raise [PageMagic::ElementMissingException]
      def method_missing(*_args)
        raise ElementMissingException, exception.message
      end

      # @return [Boolean] - always true
      def respond_to_missing?(*_args)
        true
      end

      private

      attr_reader :exception
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
page_magic-2.0.13 lib/page_magic/element/not_found.rb
page_magic-2.0.12 lib/page_magic/element/not_found.rb
page_magic-2.0.11 lib/page_magic/element/not_found.rb
page_magic-2.0.10 lib/page_magic/element/not_found.rb
page_magic-2.0.9 lib/page_magic/element/not_found.rb
page_magic-2.0.6 lib/page_magic/element/not_found.rb
page_magic-2.0.5 lib/page_magic/element/not_found.rb
page_magic-2.0.4 lib/page_magic/element/not_found.rb
page_magic-2.0.3 lib/page_magic/element/not_found.rb
page_magic-2.0.2 lib/page_magic/element/not_found.rb
page_magic-2.0.1 lib/page_magic/element/not_found.rb
page_magic-2.0.0 lib/page_magic/element/not_found.rb