6

Wrap `ActionController::TestCase` with Rails executor by ghiculescu · Pull Reque...

 2 years ago
source link: https://github.com/rails/rails/pull/43734
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Member

ghiculescu commented 16 days ago

Currently when you run an integration test (ActionDispatch::IntegrationTest), current attributes etc are reset at the end of each request, even if a test has multiple requests in it. This was refactored in #43550 but the functionality has been there for a long time.

The same is not true if you use ActionController::TestCase. Since #43550 attributes are reset at the end of a test, but if a test makes more than one request, current attributes will persist between requests.

This PR calls Executor#wrap around each request in a test if config.active_support.executor_around_test_case is enabled. It is by default in Rails 7, but not in older Rails.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK