Module

SelectorAssertions

Adds the #assert_select method for use in Rails functional test cases, which can be used to make assertions on the response HTML of a controller action. You can also call #assert_select within another #assert_select to make assertions on elements selected by the enclosing assertion.

Use #css_select to select elements without making an assertions, either from the response HTML or elements selected by the enclosing assertion.

In addition to HTML responses, you can make the following assertions:

  • #assert_select_rjs — Assertions on HTML content of RJS update and
    insertion operations.
  • #assert_select_encoded — Assertions on HTML encoded inside XML,
    for example for dealing with feed item descriptions.
  • #assert_select_email — Assertions on the HTML body of an e-mail.

Also see HTML::Selector to learn how to use selectors.

Constants
RJS_INSERTIONS
RJS_PATTERN_EVERYTHING
RJS_PATTERN_HTML
RJS_PATTERN_UNICODE_ESCAPED_CHAR
RJS_STATEMENTS
Public Methods
assert_select An assertion that selects elements and makes one or more equality tests.
assert_select_email Extracts the body of an email and runs nested assertions on it.
assert_select_encoded Extracts the content of an element, treats it as encoded HTML and runs nested assertion on it.
assert_select_rjs Selects content from the RJS response.
count_description
css_select Select and return all matching elements.
Protected Methods
response_from_page_or_rjs #assert_select and #css_select call this to obtain the content in the HTML page, or from all the RJS statements, depending on the type of response.
unescape_rjs Unescapes a RJS string.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.