-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only load example group modules when they're used
Currently the example group modules for all spec types are always loaded, regardless of which type of spec is being run. Some of those modules force parts of the user's application to load; for example, RSpec::Rails::HelperExampleGroup includes ActionView::TestCase::Behavior and loading ActionView::TestCase loads all of the application's helpers. By autoloading these modules and including them lazily the first time the corresponding spec type is defined, we can avoid loading parts of the user's application unnecessarily. Co-authored-by: Iliana Hadzhiatanasova <me@iliana.dev>
- Loading branch information
Showing
3 changed files
with
72 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
require 'rspec/rails/example/rails_example_group' | ||
require 'rspec/rails/example/controller_example_group' | ||
require 'rspec/rails/example/request_example_group' | ||
require 'rspec/rails/example/helper_example_group' | ||
require 'rspec/rails/example/view_example_group' | ||
require 'rspec/rails/example/mailer_example_group' | ||
require 'rspec/rails/example/routing_example_group' | ||
require 'rspec/rails/example/model_example_group' | ||
require 'rspec/rails/example/job_example_group' | ||
require 'rspec/rails/example/feature_example_group' | ||
require 'rspec/rails/example/system_example_group' | ||
require 'rspec/rails/example/channel_example_group' | ||
require 'rspec/rails/example/mailbox_example_group' | ||
RSpec.warn_deprecation <<~WARNING | ||
Requiring rspec/rails/example.rb no longer has any effect, and it will be removed in RSpec Rails 7. | ||
WARNING |