Module: Pouch

Includes:
Elements
Defined in:
lib/pouch.rb,
lib/pouch/version.rb,
lib/pouch/elements.rb

Defined Under Namespace

Modules: Elements Classes: ContextualReplacementError

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Elements

#button, #checkbox, #div, #element, #file_field, #form, #h1, #h2, #h3, #h4, #h5, #h6, #image, #link, #list_item, #ordered_list, #paragraph, #radio_button, #select_list, #span, #table, #table_cell, #table_header, #table_row, #text_area, #text_field, #unordered_list

Class Method Details

.included(base) ⇒ Object



9
10
11
# File 'lib/pouch.rb', line 9

def self.included base
  base.extend self
end

Instance Method Details

#browserObject



25
26
27
# File 'lib/pouch.rb', line 25

def browser
  @browser
end

#contextObject



29
30
31
# File 'lib/pouch.rb', line 29

def context
  @context
end

#initialize(browser, start = false, opts = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pouch.rb', line 13

def initialize browser, start = false, opts = {}
  if start.is_a?(Hash) && opts.empty?
    opts = start
    start = false
  end
  
  @browser = browser
  @context = standardize opts[:context] if opts[:context]
  visit if self.respond_to?(:visit) && start
  contextualize_methods
end

#page_url=(str) ⇒ Object



33
34
35
36
37
# File 'lib/pouch.rb', line 33

def page_url= str
  define_method :visit do
    self.browser.goto str
  end
end