diff options
author | Mark Lee <rails@lazymalevolence.com> | 2019-06-07 11:13:18 -0700 |
---|---|---|
committer | Mark Lee <rails@lazymalevolence.com> | 2019-06-10 18:01:32 -0700 |
commit | cb8b57d07e132a6528bce47c93ee392c6cc64c10 (patch) | |
tree | f63d5817d9284de073071cb16aa1cd362e7b928b /railties/test/application | |
parent | 0542e0608f86d9e4089861f4e72c578bc983f89f (diff) | |
download | rails-cb8b57d07e132a6528bce47c93ee392c6cc64c10.tar.gz rails-cb8b57d07e132a6528bce47c93ee392c6cc64c10.tar.bz2 rails-cb8b57d07e132a6528bce47c93ee392c6cc64c10.zip |
Convert the db:abort_if_pending_migrations task to be multi-DB aware
Diffstat (limited to 'railties/test/application')
-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 |