Type:
Module

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_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.

response_from_page
  • References/Ruby on Rails/Rails/Classes/ActionDispatch/ActionDispatch::Assertions/ActionDispatch::Assertions::SelectorAssertions

response_from_page() Instance Protected methods assert_select and

2025-01-10 15:47:30
assert_select
  • References/Ruby on Rails/Rails/Classes/ActionDispatch/ActionDispatch::Assertions/ActionDispatch::Assertions::SelectorAssertions

assert_select(*args, &block) Instance Public methods An assertion that selects

2025-01-10 15:47:30
assert_select_email
  • References/Ruby on Rails/Rails/Classes/ActionDispatch/ActionDispatch::Assertions/ActionDispatch::Assertions::SelectorAssertions

assert_select_email(&block) Instance Public methods Extracts the body of

2025-01-10 15:47:30
assert_select_encoded
  • References/Ruby on Rails/Rails/Classes/ActionDispatch/ActionDispatch::Assertions/ActionDispatch::Assertions::SelectorAssertions

assert_select_encoded(element = nil, &block) Instance Public methods Extracts

2025-01-10 15:47:30
css_select
  • References/Ruby on Rails/Rails/Classes/ActionDispatch/ActionDispatch::Assertions/ActionDispatch::Assertions::SelectorAssertions

css_select(*args) Instance Public methods

2025-01-10 15:47:30