Testing | ViewComponent

submited by
Style Pass
2024-11-10 22:30:08

Note: assert_selector only matches on visible elements by default. To match on elements regardless of visibility, add visible: false. See the Capybara documentation for more details.

In the absence of capybara, assert against the return value of render_inline, which is an instance of Nokogiri::HTML::DocumentFragment:

Component tests assume the existence of an ApplicationController class, which can be configured globally using the test_controller option:

Some Rails helpers won’t work unless request.path_parameters are set correctly, resulting in an ActionController::UrlGenerationError.

Leave a Comment