diff options
Diffstat (limited to 'railties')
6 files changed, 20 insertions, 10 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index b42ffe50d8..1bdaf91c46 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -179,6 +179,7 @@ module Rails values.reverse_merge!(shared) end end + loaded_yaml.reject! { |_, values| !values["database"] } Hash.new(shared).merge(loaded_yaml) elsif ENV["DATABASE_URL"] # Value from ENV['DATABASE_URL'] is set to default database connection diff --git a/railties/lib/rails/generators/rails/controller/controller_generator.rb b/railties/lib/rails/generators/rails/controller/controller_generator.rb index 6d45d6e8f8..6e2495d45f 100644 --- a/railties/lib/rails/generators/rails/controller/controller_generator.rb +++ b/railties/lib/rails/generators/rails/controller/controller_generator.rb @@ -16,6 +16,7 @@ module Rails def add_routes return if options[:skip_routes] + return if actions.empty? route generate_routing_code end diff --git a/railties/test/generators/api_app_generator_test.rb b/railties/test/generators/api_app_generator_test.rb index 857124b23a..9c523ad372 100644 --- a/railties/test/generators/api_app_generator_test.rb +++ b/railties/test/generators/api_app_generator_test.rb @@ -13,7 +13,7 @@ class ApiAppGeneratorTest < Rails::Generators::TestCase Rails.application = TestApp::Application super - Kernel::silence_warnings do + Kernel.silence_warnings do Thor::Base.shell.send(:attr_accessor, :always_force) @shell = Thor::Base.shell.new @shell.send(:always_force=, true) diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index cc4a376d31..99790e602d 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -315,6 +315,15 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file "Gemfile", /^# gem 'mini_magick'/ end + def test_mini_magick_gem_when_skip_active_storage_is_given + app_root = File.join(destination_root, "myapp") + run_generator [app_root, "--skip-active-storage"] + + assert_file "#{app_root}/Gemfile" do |content| + assert_no_match(/gem 'mini_magick'/, content) + end + end + def test_app_update_does_not_generate_active_storage_contents_when_skip_active_storage_is_given app_root = File.join(destination_root, "myapp") run_generator [app_root, "--skip-active-storage"] @@ -336,10 +345,6 @@ class AppGeneratorTest < Rails::Generators::TestCase end assert_no_file "#{app_root}/config/storage.yml" - - assert_file "#{app_root}/Gemfile" do |content| - assert_no_match(/gem 'mini_magick'/, content) - end end def test_app_update_does_not_generate_active_storage_contents_when_skip_active_record_is_given @@ -363,10 +368,6 @@ class AppGeneratorTest < Rails::Generators::TestCase end assert_no_file "#{app_root}/config/storage.yml" - - assert_file "#{app_root}/Gemfile" do |content| - assert_no_match(/gem 'mini_magick'/, content) - end end def test_app_update_does_not_change_config_target_version diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb index a3218951a6..91e4a86775 100644 --- a/railties/test/generators/controller_generator_test.rb +++ b/railties/test/generators/controller_generator_test.rb @@ -109,4 +109,11 @@ class ControllerGeneratorTest < Rails::Generators::TestCase assert_match(/^ namespace :admin do\n get 'dashboard\/index'\n get 'dashboard\/show'\n end$/, route) end end + + def test_does_not_add_routes_when_action_is_not_specified + run_generator ["admin/dashboard"] + assert_file "config/routes.rb" do |routes| + assert_no_match(/namespace :admin/, routes) + end + end end diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index 97d43af60a..aa577e4234 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -9,7 +9,7 @@ module SharedGeneratorTests super Rails::Generators::AppGenerator.instance_variable_set("@desc", nil) - Kernel::silence_warnings do + Kernel.silence_warnings do Thor::Base.shell.send(:attr_accessor, :always_force) @shell = Thor::Base.shell.new @shell.send(:always_force=, true) |