diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-12-01 18:16:06 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-12-03 09:50:28 +0900 |
commit | dbee80bca0ef504120219e6c7686437456511060 (patch) | |
tree | 0b7db3246f94a7df6ca928c1a8a7bf8515e6bc97 /railties/test/isolation | |
parent | 33a3f7123bc4cc49b99b01a40bbfd463b2e73f76 (diff) | |
download | rails-dbee80bca0ef504120219e6c7686437456511060.tar.gz rails-dbee80bca0ef504120219e6c7686437456511060.tar.bz2 rails-dbee80bca0ef504120219e6c7686437456511060.zip |
Make `Migrator.current_version` work without a current database
This is necessary in order to make the processing dependent on
`Migrator.current_version` work even without database.
Context: https://github.com/rails/rails/pull/31135#issuecomment-348404326
Diffstat (limited to 'railties/test/isolation')
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 7522237a38..5b1c06d4e5 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -381,6 +381,21 @@ module TestHelpers $:.reject! { |path| path =~ %r'/(#{to_remove.join('|')})/' } end + + def use_postgresql + File.open("#{app_path}/config/database.yml", "w") do |f| + f.puts <<-YAML + default: &default + adapter: postgresql + pool: 5 + database: railties_test + development: + <<: *default + test: + <<: *default + YAML + end + end end end |