Class: AePageObjects::DocumentQuery::Condition
- Inherits:
-
Object
- Object
- AePageObjects::DocumentQuery::Condition
- Defined in:
- lib/ae_page_objects/document_query.rb
Instance Attribute Summary collapse
-
#document_class ⇒ Object
readonly
Returns the value of attribute document_class.
-
#document_conditions ⇒ Object
readonly
Returns the value of attribute document_conditions.
Instance Method Summary collapse
-
#initialize(document_class, document_conditions = {}, &block_condition) ⇒ Condition
constructor
A new instance of Condition.
- #match?(document) ⇒ Boolean
Constructor Details
#initialize(document_class, document_conditions = {}, &block_condition) ⇒ Condition
Returns a new instance of Condition.
6 7 8 9 10 11 |
# File 'lib/ae_page_objects/document_query.rb', line 6 def initialize(document_class, document_conditions = {}, &block_condition) @document_class = document_class @document_conditions = document_conditions || {} @document_conditions[:block] = block_condition if block_condition end |
Instance Attribute Details
#document_class ⇒ Object (readonly)
Returns the value of attribute document_class.
4 5 6 |
# File 'lib/ae_page_objects/document_query.rb', line 4 def document_class @document_class end |
#document_conditions ⇒ Object (readonly)
Returns the value of attribute document_conditions.
4 5 6 |
# File 'lib/ae_page_objects/document_query.rb', line 4 def document_conditions @document_conditions end |
Instance Method Details
#match?(document) ⇒ Boolean
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ae_page_objects/document_query.rb', line 13 def match?(document) @document_conditions.each do |type, value| case type when :title then return false unless Capybara.current_session.driver.browser.title.include?(value) when :url then return false unless document.current_url.include?(value) when :block then return false unless value.call(document) end end true end |