diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2019-06-05 10:31:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-05 10:31:52 -0400 |
commit | ccb30615a3b6d5fd78b94fe44155310854241f6a (patch) | |
tree | 855e4ee2752305f3c48b1358f934d56f508647c7 /railties/test/application/rake/multi_dbs_test.rb | |
parent | 71a019efe8eaaac100640645d14ea6016fff2df7 (diff) | |
parent | 87796b3c8120becf583529756cbe5f36b4a3132c (diff) | |
download | rails-ccb30615a3b6d5fd78b94fe44155310854241f6a.tar.gz rails-ccb30615a3b6d5fd78b94fe44155310854241f6a.tar.bz2 rails-ccb30615a3b6d5fd78b94fe44155310854241f6a.zip |
Merge pull request #36416 from freeletics/fix-db-prepare
Fixed db:prepare task for multiple databases.
Diffstat (limited to 'railties/test/application/rake/multi_dbs_test.rb')
-rw-r--r-- | railties/test/application/rake/multi_dbs_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/railties/test/application/rake/multi_dbs_test.rb b/railties/test/application/rake/multi_dbs_test.rb index 31ea2246a9..8c41b252da 100644 --- a/railties/test/application/rake/multi_dbs_test.rb +++ b/railties/test/application/rake/multi_dbs_test.rb @@ -303,6 +303,26 @@ module ApplicationTests require "#{app_path}/config/environment" db_prepare end + + test "db:prepare setups missing database without clearing existing one" do + require "#{app_path}/config/environment" + Dir.chdir(app_path) do + # Bug not visible on SQLite3. Can be simplified when https://github.com/rails/rails/issues/36383 resolved + use_postgresql(multi_db: true) + generate_models_for_animals + + rails "db:create:animals", "db:migrate:animals", "db:create:primary", "db:migrate:primary", "db:schema:dump" + rails "db:drop:primary" + Dog.create! + output = rails("db:prepare") + + assert_match(/Created database/, output) + assert_equal 1, Dog.count + ensure + Dog.connection.disconnect! + rails "db:drop" rescue nil + end + end end end end |