Class: AePageObjects::Document
- Defined in:
- lib/ae_page_objects/document.rb
Constant Summary
Constants inherited from Node
Node::METHODS_TO_DELEGATE_TO_NODE
Instance Attribute Summary collapse
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Class Method Summary collapse
Instance Method Summary collapse
- #browser ⇒ Object
- #document ⇒ Object
-
#initialize ⇒ Document
constructor
A new instance of Document.
Methods inherited from Node
current_url, #current_url, current_url_without_params, #current_url_without_params, #node, #stale!, #stale?
Methods included from Dsl
#collection, #element, #form_for, #inherited
Methods included from InternalHelpers
Constructor Details
#initialize ⇒ Document
Returns a new instance of Document.
47 48 49 50 51 52 |
# File 'lib/ae_page_objects/document.rb', line 47 def initialize super(Capybara.current_session) @window = browser.current_window @window.current_document = self end |
Instance Attribute Details
#window ⇒ Object (readonly)
Returns the value of attribute window.
45 46 47 |
# File 'lib/ae_page_objects/document.rb', line 45 def window @window end |
Class Method Details
.can_load_from_current_url? ⇒ Boolean
4 5 6 7 8 9 10 11 12 |
# File 'lib/ae_page_objects/document.rb', line 4 def can_load_from_current_url? return true if paths.empty? url = current_url_without_params paths.any? do |path| site.path_recognizes_url?(path, url) end end |
.visit(*args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ae_page_objects/document.rb', line 14 def visit(*args) args = args.dup = args.last.is_a?(::Hash)? args.last : {} path = .delete(:via) || paths.first full_path = site.generate_path(path, *args) raise PathNotResolvable, "#{self.name} not visitable via #{paths.first}(#{args.inspect})" unless full_path Capybara.current_session.visit(full_path) new end |
Instance Method Details
#browser ⇒ Object
54 55 56 |
# File 'lib/ae_page_objects/document.rb', line 54 def browser AePageObjects.browser end |
#document ⇒ Object
58 59 60 |
# File 'lib/ae_page_objects/document.rb', line 58 def document self end |