aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/tasks
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2017-04-26 22:09:33 +0300
committerbogdanvlviv <bogdanvlviv@gmail.com>2017-04-26 22:21:38 +0300
commitf50e143b77051428a2dbb8822603ffd730230e1f (patch)
tree8a1a0c042dcb158093019a4061b35fb0dba46ca0 /activerecord/test/cases/tasks
parente0604f75007b1630de80b206aed3a8ab41001ffd (diff)
downloadrails-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/cases/tasks')
-rw-r--r--activerecord/test/cases/tasks/database_tasks_test.rb17
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