Class: Testable::Node

Inherits:
Object show all
Includes:
DSL
Defined in:
lib/testable/capybara/node.rb

Direct Known Subclasses

Page

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DSL

included

Constructor Details

#initialize(node:) ⇒ Node

A Capybara node is being wrapped in a node instance.



13
14
15
# File 'lib/testable/capybara/node.rb', line 13

def initialize(node:)
  @node = node
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

Any Capybara API calls will be sent to the node object.



18
19
20
21
22
23
24
# File 'lib/testable/capybara/node.rb', line 18

def method_missing(name, *args, &block)
  if @node.respond_to?(name)
    @node.send(name, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



10
11
12
# File 'lib/testable/capybara/node.rb', line 10

def node
  @node
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/testable/capybara/node.rb', line 26

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