module Testable::Pages::Attribute

Public Instance Methods

title_attribute() click to toggle source

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.

# File lib/testable/attribute.rb, line 55
def title_attribute
  @title
end
title_is(title = nil) click to toggle source

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.

# 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() click to toggle source

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.

# File lib/testable/attribute.rb, line 20
def url_attribute
  @url
end
url_is(url = nil) click to toggle source

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.

# 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() click to toggle source

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.

# File lib/testable/attribute.rb, line 38
def url_match_attribute
  @url_match
end
url_matches(pattern = nil) click to toggle source

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.

# 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