Fix the tests broken by the new add_autoload_paths_to_load_path

I didn't pay attention to CI at all -_-.
This commit is contained in:
Jean Boussier 2022-01-11 14:24:10 +01:00
parent dc7bb3aa7e
commit f8e67bcfc0
3 changed files with 8 additions and 12 deletions

View File

@ -1822,7 +1822,8 @@ module ApplicationTests
end
end
test "autoload paths are added to $LOAD_PATH by default" do
test "autoload paths are not added to $LOAD_PATH if opted-in" do
add_to_config "config.add_autoload_paths_to_load_path = true"
app "development"
# Action Mailer modifies AS::Dependencies.autoload_paths in-place.
@ -1838,8 +1839,7 @@ module ApplicationTests
assert_empty Rails.configuration.paths.load_paths - $LOAD_PATH
end
test "autoload paths are not added to $LOAD_PATH if opted-out" do
add_to_config "config.add_autoload_paths_to_load_path = false"
test "autoload paths are not added to $LOAD_PATH by default" do
app "development"
assert_empty ActiveSupport::Dependencies.autoload_paths & $LOAD_PATH
@ -1868,10 +1868,6 @@ module ApplicationTests
assert_includes config.autoload_once_paths, "#{app_path}/custom_autoload_once_path"
assert_includes config.eager_load_paths, "#{app_path}/custom_eager_load_path"
end
assert_includes $LOAD_PATH, "#{app_path}/custom_autoload_path"
assert_includes $LOAD_PATH, "#{app_path}/custom_autoload_once_path"
assert_includes $LOAD_PATH, "#{app_path}/custom_eager_load_path"
end
test "load_database_yaml returns blank hash if configuration file is blank" do

View File

@ -15,13 +15,13 @@ module ApplicationTests
teardown_app
end
test "initializing an application adds the application paths to the load path" do
test "initializing an application doesn't add the application paths to the load path" do
add_to_config <<-RUBY
config.root = "#{app_path}"
RUBY
require "#{app_path}/config/environment"
assert_includes $:, "#{app_path}/app/models"
assert_not_includes $:, "#{app_path}/app/models"
end
test "initializing an application allows to load code on lib path inside application class definition" do

View File

@ -69,12 +69,12 @@ module ApplicationTests
end
test "load path includes each of the paths in config.paths as long as the directories exist" do
assert_in_load_path "app", "controllers"
assert_in_load_path "app", "models"
assert_in_load_path "app", "helpers"
assert_in_load_path "lib"
assert_in_load_path "vendor"
assert_not_in_load_path "app", "controllers"
assert_not_in_load_path "app", "models"
assert_not_in_load_path "app", "helpers"
assert_not_in_load_path "app", "views"
assert_not_in_load_path "config"
assert_not_in_load_path "config", "locales"