diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-04-26 22:09:33 +0300 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-04-26 22:21:38 +0300 |
commit | f50e143b77051428a2dbb8822603ffd730230e1f (patch) | |
tree | 8a1a0c042dcb158093019a4061b35fb0dba46ca0 /activerecord/test | |
parent | e0604f75007b1630de80b206aed3a8ab41001ffd (diff) | |
download | rails-f50e143b77051428a2dbb8822603ffd730230e1f.tar.gz rails-f50e143b77051428a2dbb8822603ffd730230e1f.tar.bz2 rails-f50e143b77051428a2dbb8822603ffd730230e1f.zip |
Refactor DatabaseTasksMigrateTest#test_migrate_receives_correct_env_vars
Add cases to ensure that environment variables VERBOSE and VERSION have
correct typecast.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/tasks/database_tasks_test.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/activerecord/test/cases/tasks/database_tasks_test.rb b/activerecord/test/cases/tasks/database_tasks_test.rb index baa41a3a47..b4983624ba 100644 --- a/activerecord/test/cases/tasks/database_tasks_test.rb +++ b/activerecord/test/cases/tasks/database_tasks_test.rb @@ -343,8 +343,23 @@ module ActiveRecord ENV["VERBOSE"] = "false" ENV["VERSION"] = "4" - ActiveRecord::Migrator.expects(:migrate).with("custom/path", 4) + ActiveRecord::Migration.expects(:verbose=).with(false) + ActiveRecord::Migration.expects(:verbose=).with(ActiveRecord::Migration.verbose) + ActiveRecord::Tasks::DatabaseTasks.migrate + + ENV.delete("VERBOSE") + ENV.delete("VERSION") + ActiveRecord::Migrator.expects(:migrate).with("custom/path", nil) + ActiveRecord::Migration.expects(:verbose=).with(true) + ActiveRecord::Migration.expects(:verbose=).with(ActiveRecord::Migration.verbose) + ActiveRecord::Tasks::DatabaseTasks.migrate + + ENV["VERBOSE"] = "yes" + ENV["VERSION"] = "unknown" + ActiveRecord::Migrator.expects(:migrate).with("custom/path", 0) + ActiveRecord::Migration.expects(:verbose=).with(true) + ActiveRecord::Migration.expects(:verbose=).with(ActiveRecord::Migration.verbose) ActiveRecord::Tasks::DatabaseTasks.migrate ensure ENV["VERBOSE"], ENV["VERSION"] = verbose, version |