Prefer `ActionDispatch::IntegrationTest` over `ActionController::TestCase`
andyw8 opened this issue · 0 comments
andyw8 commented
As per https://api.rubyonrails.org/classes/ActionController/TestCase.html
Rails discourages the use of functional tests in favor of integration tests (use ActionDispatch::IntegrationTest).
New Rails applications no longer generate functional style controller tests and they should only be used for backward compatibility. Integration style controller tests perform actual requests, whereas functional style controller tests merely simulate a request. Besides, integration tests are as fast as functional tests and provide lot of helpers such as as, parsed_body for effective testing of controller actions including even API endpoints.
This could have a corresponding RuboCop check.