Class: Moto::Page

Inherits:
Object
  • Object
show all
Includes:
TestLogging
Defined in:
lib/page.rb

Instance Method Summary collapse

Methods included from TestLogging

included

Constructor Details

#initialize(website) ⇒ Page

Returns a new instance of Page.



10
11
12
13
# File 'lib/page.rb', line 10

def initialize(website)
  @website = website
  @context = @website.context
end

Instance Method Details

#const(key) ⇒ Object



15
16
17
# File 'lib/page.rb', line 15

def const(key)
  @website.context.const(key)
end

#page(p) ⇒ Object



23
24
25
# File 'lib/page.rb', line 23

def page(p)
  @context.client(@website.class.name.split('::').pop).page(p)
end

#raise_unless_loadedObject



27
28
29
# File 'lib/page.rb', line 27

def raise_unless_loaded
  raise "Invalid state: page #{self.class.name} is not loaded." unless loaded?
end

#sessionObject



19
20
21
# File 'lib/page.rb', line 19

def session
  @website.session
end