Sha256: b98d728eeea71b2c9ecec3e6c6ad9b4f7060c4fc86346ef17377af8c181412e0

Contents?: true

Size: 748 Bytes

Versions: 6

Compression:

Stored size: 748 Bytes

Contents

require "testable/capybara/dsl"

module Testable
  class Node
    # The Node class represents a wrapped HTML page or fragment. It exposes all
    # methods of the Cogent DSL, making sure that any Capybara API methods
    # are passed to the node instance.
    include DSL

    attr_reader :node

    # A Capybara node is being wrapped in a node instance.
    def initialize(node:)
      @node = node
    end

    # Any Capybara API calls will be sent to the node object.
    def method_missing(name, *args, &block)
      if @node.respond_to?(name)
        @node.send(name, *args, &block)
      else
        super
      end
    end

    def respond_to_missing?(name, include_private = false)
      @node.respond_to?(name) || super
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
testable-0.10.0 lib/testable/capybara/node.rb
testable-0.9.0 lib/testable/capybara/node.rb
testable-0.8.0 lib/testable/capybara/node.rb
testable-0.7.0 lib/testable/capybara/node.rb
testable-0.6.0 lib/testable/capybara/node.rb
testable-0.5.0 lib/testable/capybara/node.rb