mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
defines Rails.autoloaders.log!
This commit is contained in:
parent
841ac6ceb2
commit
5a70f33909
2 changed files with 16 additions and 0 deletions
|
@ -36,6 +36,10 @@ module Rails
|
|||
each { |loader| loader.logger = logger }
|
||||
end
|
||||
|
||||
def log!
|
||||
each(&:log!)
|
||||
end
|
||||
|
||||
def zeitwerk_enabled?
|
||||
Rails.configuration.autoloader == :zeitwerk
|
||||
end
|
||||
|
|
|
@ -385,4 +385,16 @@ class ZeitwerkIntegrationTest < ActiveSupport::TestCase
|
|||
assert_nil autoloader.logger
|
||||
end
|
||||
end
|
||||
|
||||
test "autoloaders.log!" do
|
||||
app_file "extras/utils.rb", "module Utils; end"
|
||||
|
||||
add_to_config %(config.autoload_once_paths << "\#{Rails.root}/extras")
|
||||
add_to_config "Rails.autoloaders.log!"
|
||||
|
||||
out, _err = capture_io { boot }
|
||||
|
||||
assert_match %r/^Zeitwerk@rails.main: autoload set for ApplicationRecord/, out
|
||||
assert_match %r/^Zeitwerk@rails.once: autoload set for Utils/, out
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue