Class: CapybaraPageObject::Page

Inherits:
Node
  • Object
show all
Extended by:
ClassMethods
Includes:
Collections, InstanceMethods
Defined in:
lib/capybara-page-object/page.rb

Instance Attribute Summary

Attributes inherited from Node

#source

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

current?, from_string, visit

Methods included from InstanceMethods

#path, #prefix, #visit_path

Methods included from Collections

#key, #value

Methods inherited from Node

#classes, element, field, from_string, #initialize

Methods included from Delegators

#all, #find, #text

Constructor Details

This class inherits a constructor from CapybaraPageObject::Node

Class Method Details

.component(name, &block) ⇒ Object



66
67
68
# File 'lib/capybara-page-object/page.rb', line 66

def self.component(name, &block)
  define_method(name, &block)
end

.path(p) ⇒ Object



62
63
64
# File 'lib/capybara-page-object/page.rb', line 62

def self.path(p)
  define_method(:path) { p }
end

Instance Method Details

#formsObject



55
56
57
58
59
60
# File 'lib/capybara-page-object/page.rb', line 55

def forms
  all('form').each_with_object({}) do |e, hash|
    f = CapybaraPageObject::Form.new(e)
    hash[f.key] = f
  end
end

#tablesObject

TODO why doesn’t this work when in the module?



48
49
50
51
52
53
# File 'lib/capybara-page-object/page.rb', line 48

def tables
  all('table').each_with_object({}) do |e, hash|
    t = CapybaraPageObject::Table.new(e)
    hash[t.key] = t
  end
end