Module: Testable::Pages::Attribute
- Includes:
- Situation
- Defined in:
- lib/testable/attribute.rb
Instance Method Summary collapse
-
#title_attribute ⇒ Object
This allows a test to query for the title attribute that was set on the model.
-
#title_is(title = nil) ⇒ Object
This is an attribute that can be specified on a model, such as a page object.
-
#url_attribute ⇒ Object
This allows a test to query for the url attribute that was set on the model.
-
#url_is(url = nil) ⇒ Object
This is an attribute that can be specified on a model, such as a page object.
-
#url_match_attribute ⇒ Object
This allows a test to query for the url match attribute that was set on the model.
-
#url_matches(pattern = nil) ⇒ Object
This is an attribute that can be specified on a model, such as a page object.
Instance Method Details
#title_attribute ⇒ Object
This allows a test to query for the title attribute that was set on the model. It’s important to note that this is not the actual title in the browser, but rather whatever was created on the model.
55 56 57 |
# File 'lib/testable/attribute.rb', line 55 def title_attribute @title end |
#title_is(title = nil) ⇒ Object
This is an attribute that can be specified on a model, such as a page object. When this attribute is provided, the model will have a bit of text that provides information about what the title of a browser page should be. This is not checking the title; it’s simply providing the text that will be checked against the actual title.
47 48 49 50 |
# File 'lib/testable/attribute.rb', line 47 def title_is(title = nil) title_is_empty if title.nil? || title.empty? @title = title end |
#url_attribute ⇒ Object
This allows a test to query for the url attribute that was set on the model. It’s important to note that this is not the actual URL in the browser, but rather whatever was created on the model.
20 21 22 |
# File 'lib/testable/attribute.rb', line 20 def url_attribute @url end |
#url_is(url = nil) ⇒ Object
This is an attribute that can be specified on a model, such as a page object. When this attribute is provided, the model will have a URL that can be navigated to automatically by Testable.
11 12 13 14 15 |
# File 'lib/testable/attribute.rb', line 11 def url_is(url = nil) url_is_empty if url.nil? && url_attribute.nil? url_is_empty if url.nil? || url.empty? @url = url end |
#url_match_attribute ⇒ Object
This allows a test to query for the url match attribute that was set on the model. This does not perform a match or do anything to check if a URL is matching. This simply returns the attribute that was provided for the URL matching.
38 39 40 |
# File 'lib/testable/attribute.rb', line 38 def url_match_attribute @url_match end |
#url_matches(pattern = nil) ⇒ Object
This is an attribute that can be specified on a model, such as a page object. When this attribute is provided, the model will have a way to match the URL in the browser with the matcher provided via this attribute.
28 29 30 31 32 |
# File 'lib/testable/attribute.rb', line 28 def url_matches(pattern = nil) url_match_is_empty if pattern.nil? url_match_is_empty if pattern.is_a?(String) && pattern.empty? @url_match = pattern end |