Module: EDSL::PageObject::Visitable

Included in:
Page
Defined in:
lib/edsl/page_object/visitation.rb

Instance Method Summary collapse

Instance Method Details

#page_url(url) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/edsl/page_object/visitation.rb', line 24

def page_url(url)
  define_method("goto") do
    browser.goto page_url_value
  end

  define_method('page_url_value') do
    lookup        = url.kind_of?(Symbol) ? self.send(url) : url
    erb           = ::ERB.new(%Q{#{lookup}})
    merged_params = self.class.instance_variable_get("@merged_params")
    params        = merged_params ? merged_params : self.class.params
    erb.result(binding)
  end
end

#paramsObject

Return the params that exist on this page class



20
21
22
# File 'lib/edsl/page_object/visitation.rb', line 20

def params
  @params ||= {}
end

#params=(the_params) ⇒ Object

Set some values that can be used within the class. This is typically used to provide values that help build dynamic urls in the page_url method

Parameters:

  • the (Hash)

    value to set the params



13
14
15
# File 'lib/edsl/page_object/visitation.rb', line 13

def params=(the_params)
  @params = the_params
end