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, #root_path, #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



68
69
70
# File 'lib/capybara-page-object/page.rb', line 68

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

.path(p) ⇒ Object



64
65
66
# File 'lib/capybara-page-object/page.rb', line 64

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

Instance Method Details

#formsObject



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

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?



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

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