defines Rails.autoloaders.log!
This commit is contained in:
parent
841ac6ceb2
commit
5a70f33909
@ -36,6 +36,10 @@ def logger=(logger)
|
||||
each { |loader| loader.logger = logger }
|
||||
end
|
||||
|
||||
def log!
|
||||
each(&:log!)
|
||||
end
|
||||
|
||||
def zeitwerk_enabled?
|
||||
Rails.configuration.autoloader == :zeitwerk
|
||||
end
|
||||
|
@ -385,4 +385,16 @@ def once_autoloader.reload
|
||||
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 New Issue
Block a user