Class: AePageObjects::Node
- Inherits:
-
Object
- Object
- AePageObjects::Node
show all
- Extended by:
- Dsl
- Defined in:
- lib/ae_page_objects/node.rb
Constant Summary
collapse
- METHODS_TO_DELEGATE_TO_NODE =
[:find, :all, :value, :set, :text, :visible?]
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Dsl
collection, element, form_for, inherited
#ensure_class_for_param!
Constructor Details
#initialize(capybara_node) ⇒ Node
Returns a new instance of Node.
15
16
17
18
19
20
|
# File 'lib/ae_page_objects/node.rb', line 15
def initialize(capybara_node)
@node = capybara_node
@stale = false
ensure_loaded!
end
|
Class Method Details
.current_url ⇒ Object
6
7
8
|
# File 'lib/ae_page_objects/node.rb', line 6
def current_url
Capybara.current_session.current_url.sub(/^https?:\/\/[^\/]*/, '')
end
|
.current_url_without_params ⇒ Object
10
11
12
|
# File 'lib/ae_page_objects/node.rb', line 10
def current_url_without_params
current_url.sub(/(\?|\#).*/, '')
end
|
Instance Method Details
#current_url ⇒ Object
42
43
44
|
# File 'lib/ae_page_objects/node.rb', line 42
def current_url
self.class.current_url
end
|
#current_url_without_params ⇒ Object
46
47
48
|
# File 'lib/ae_page_objects/node.rb', line 46
def current_url_without_params
self.class.current_url_without_params
end
|
#document ⇒ Object
38
39
40
|
# File 'lib/ae_page_objects/node.rb', line 38
def document
raise "Must implement!"
end
|
#node ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/ae_page_objects/node.rb', line 22
def node
if stale?
raise StalePageObject, "Can't access stale page object '#{self}'"
end
@node
end
|
#stale! ⇒ Object
34
35
36
|
# File 'lib/ae_page_objects/node.rb', line 34
def stale!
@stale = true
end
|
#stale? ⇒ Boolean
30
31
32
|
# File 'lib/ae_page_objects/node.rb', line 30
def stale?
@stale
end
|