From 53e6fe96b5664e92ee6cd64d08681254fc816f44 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 19 Mar 2017 17:20:41 +0900 Subject: Correctly check whether key is defined in configuration It can not check correctly with `defined?` ```ruby irb(main):001:0> Rails.application.config.active_record => {:maintain_test_schema=>true, :belongs_to_required_by_default=>true} irb(main):002:0> defined?(Rails.application.config.active_record) => nil ``` Follow up to #28469 --- railties/test/generators/app_generator_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'railties/test/generators') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 281376cdee..ac43e8d22d 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -160,6 +160,18 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_no_file "config/initializers/new_framework_defaults_5_1.rb" end + def test_new_application_load_defaults + app_root = File.join(destination_root, "myfirstapp") + run_generator [app_root] + output = nil + + Dir.chdir(app_root) do + output = `./bin/rails r "puts Rails.application.config.assets.unknown_asset_fallback"` + end + + assert_equal "false\n", output + end + def test_app_update_keep_the_cookie_serializer_if_it_is_already_configured app_root = File.join(destination_root, "myapp") run_generator [app_root] -- cgit v1.2.3