diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2019-06-11 08:17:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-11 08:17:50 -0400 |
commit | 96f142ae76b04f5ffe6e4c33550f5b04739f4f56 (patch) | |
tree | df49ece35b5ffb350a728c22fc194fc9a7137e4b /railties/test/application/rake | |
parent | 4dcb46182a4aaa57f44f3eb722c1db54fa0ff843 (diff) | |
parent | cb8b57d07e132a6528bce47c93ee392c6cc64c10 (diff) | |
download | rails-96f142ae76b04f5ffe6e4c33550f5b04739f4f56.tar.gz rails-96f142ae76b04f5ffe6e4c33550f5b04739f4f56.tar.bz2 rails-96f142ae76b04f5ffe6e4c33550f5b04739f4f56.zip |
Merge pull request #36440 from malept/multi-db-abort_if_pending_migrations-task
Add support for multiple databases to `rails db:abort_if_pending_migrations`
Diffstat (limited to 'railties/test/application/rake')
-rw-r--r-- | railties/test/application/rake/multi_dbs_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/railties/test/application/rake/multi_dbs_test.rb b/railties/test/application/rake/multi_dbs_test.rb index 8c41b252da..2606e64424 100644 --- a/railties/test/application/rake/multi_dbs_test.rb +++ b/railties/test/application/rake/multi_dbs_test.rb @@ -299,6 +299,32 @@ module ApplicationTests db_migrate_and_schema_cache_dump_and_schema_cache_clear end + test "db:abort_if_pending_migrations works on all databases" do + require "#{app_path}/config/environment" + + app_file "db/animals_migrate/02_two_migration.rb", <<-MIGRATION + class TwoMigration < ActiveRecord::Migration::Current + end + MIGRATION + + output = rails("db:abort_if_pending_migrations", allow_failure: true) + assert_match(/You have 1 pending migration/, output) + end + + test "db:abort_if_pending_migrations:namespace works" do + require "#{app_path}/config/environment" + + app_file "db/animals_migrate/02_two_migration.rb", <<-MIGRATION + class TwoMigration < ActiveRecord::Migration::Current + end + MIGRATION + + output = rails("db:abort_if_pending_migrations:primary") + assert_no_match(/You have \d+ pending migration/, output) + output = rails("db:abort_if_pending_migrations:animals", allow_failure: true) + assert_match(/You have 1 pending migration/, output) + end + test "db:prepare works on all databases" do require "#{app_path}/config/environment" db_prepare |