aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/generators_test_helper.rb
diff options
context:
space:
mode:
authorGannon McGibbon <gannon.mcgibbon@gmail.com>2018-09-28 13:36:06 -0400
committerGannon McGibbon <gannon.mcgibbon@gmail.com>2018-09-28 14:24:36 -0400
commit4775d3d051af1a506b63a7e4069c94e49c82177d (patch)
treebd4dfbe583b86ee24e2548b83cc50f323891a918 /railties/test/generators/generators_test_helper.rb
parent7d89337b1722587961b9bb81031661b99935d919 (diff)
downloadrails-4775d3d051af1a506b63a7e4069c94e49c82177d.tar.gz
rails-4775d3d051af1a506b63a7e4069c94e49c82177d.tar.bz2
rails-4775d3d051af1a506b63a7e4069c94e49c82177d.zip
Refactor migrations_path command option to database
Diffstat (limited to 'railties/test/generators/generators_test_helper.rb')
-rw-r--r--railties/test/generators/generators_test_helper.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb
index ad2a55f496..355d4b09a8 100644
--- a/railties/test/generators/generators_test_helper.rb
+++ b/railties/test/generators/generators_test_helper.rb
@@ -42,6 +42,20 @@ module GeneratorsTestHelper
end
end
+ def with_secondary_database_configuration
+ ActiveRecord::Base.configurations = {
+ test: {
+ secondary: {
+ database: "db/secondary.sqlite3",
+ migrations_paths: "db/secondary_migrate",
+ },
+ },
+ }
+ yield
+ ensure
+ ActiveRecord::Base.configurations = {}
+ end
+
def copy_routes
routes = File.expand_path("../../lib/rails/generators/rails/app/templates/config/routes.rb.tt", __dir__)
destination = File.join(destination_root, "config")