Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't force controller or integration tests to load #51150

Merged
merged 1 commit into from Feb 21, 2024

Conversation

eugeneius
Copy link
Member

#32776 replaced references to ActionController::TestCase and ActionDispatch::IntegrationTest in this file with lazy load hooks to avoid loading them prematurely, but these requires meant that they were still loaded anyway.

Aside from the direct benefit of loading as little as possible until necessary, this will allow users of https://github.com/amatsuda/routes_lazy_routes to run e.g. a model test without loading the application's routes, which can reduce boot time significantly for large applications.

2730f10 replaced references to
ActionController::TestCase and ActionDispatch::IntegrationTest in this
file with lazy load hooks to avoid loading them prematurely, but these
requires meant that they were still loaded anyway.
@rails-bot rails-bot bot added the railties label Feb 21, 2024
@eugeneius eugeneius merged commit 7c135ed into rails:main Feb 21, 2024
4 checks passed
@@ -7,9 +7,6 @@
abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production?

require "active_support/test_case"
require "action_controller"
require "action_controller/test_case"
require "action_dispatch/testing/integration"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removal broke our tests at github. We have been including Rails::Dom::Testing::Assertions in our BasicTestCase class to use dom assertions like assert_select. To fix that I had to manually require "rails-dom-testing". I think it is good that we are loading less stuff by default, but I'm wondering whether it is worth or not a CHANGELOG entry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for changelog. The fact that "rails-dom-testing" was already loaded by rails/test_help was never documented as a feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants