diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-08-03 16:40:37 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-08-03 16:57:48 -0400 |
commit | f601a01b2cb4c6c0b9f6397874c2998810993bed (patch) | |
tree | 0f1771645e89e810a631c503c544cc045ce2fe7b /railties/test/application | |
parent | 6a36b6b0cc35ef2272219069bc642b2817895d6a (diff) | |
download | rails-f601a01b2cb4c6c0b9f6397874c2998810993bed.tar.gz rails-f601a01b2cb4c6c0b9f6397874c2998810993bed.tar.bz2 rails-f601a01b2cb4c6c0b9f6397874c2998810993bed.zip |
Do not eager load ActiveRecord::Base
Everything inside the app directory of a engine is autoload/eager loaded automatically so we don't need to require them.
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/initializers/frameworks_test.rb | 10 | ||||
-rw-r--r-- | railties/test/application/rake/dbs_test.rb | 6 |
2 files changed, 6 insertions, 10 deletions
diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb index add4cc23fc..eb2c578f91 100644 --- a/railties/test/application/initializers/frameworks_test.rb +++ b/railties/test/application/initializers/frameworks_test.rb @@ -233,11 +233,9 @@ module ApplicationTests test "active record establish_connection uses Rails.env if DATABASE_URL is not set" do begin - orig_database_url = ENV.delete("DATABASE_URL") - require "#{app_path}/config/environment" + orig_database_url = ENV.delete("DATABASE_URL") orig_rails_env, Rails.env = Rails.env, "development" - ActiveRecord::Base.establish_connection assert ActiveRecord::Base.connection assert_match(/#{ActiveRecord::Base.configurations[Rails.env]['database']}/, ActiveRecord::Base.connection_config[:database]) @@ -250,13 +248,11 @@ module ApplicationTests test "active record establish_connection uses DATABASE_URL even if Rails.env is set" do begin + require "#{app_path}/config/environment" orig_database_url = ENV.delete("DATABASE_URL") + orig_rails_env, Rails.env = Rails.env, "development" database_url_db_name = "db/database_url_db.sqlite3" ENV["DATABASE_URL"] = "sqlite3:#{database_url_db_name}" - - require "#{app_path}/config/environment" - orig_rails_env, Rails.env = Rails.env, "development" - ActiveRecord::Base.establish_connection assert ActiveRecord::Base.connection assert_match(/#{database_url_db_name}/, ActiveRecord::Base.connection_config[:database]) diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index 9b29b35553..3216121de3 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -42,8 +42,8 @@ module ApplicationTests end test "db:create and db:drop with database url" do - set_database_url require "#{app_path}/config/environment" + set_database_url db_create_and_drop database_url_db_name end @@ -154,8 +154,8 @@ module ApplicationTests end test "db:fixtures:load with database_url" do - set_database_url require "#{app_path}/config/environment" + set_database_url db_fixtures_load database_url_db_name end @@ -189,8 +189,8 @@ module ApplicationTests end test "db:structure:dump and db:structure:load with database_url" do - set_database_url require "#{app_path}/config/environment" + set_database_url db_structure_dump_and_load database_url_db_name end |