From f8d9a51949d6f6cfcab7cc7d501e137836eb88dc Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sat, 30 Aug 2014 02:28:44 +0900 Subject: [PATCH] Don't allow AR::Tasks::DatabaseTasks.migrate to mutate Migration.verbose value This fixes random test failure in migrator_test.rb --- activerecord/lib/active_record/tasks/database_tasks.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index e4164f263e..a21c3f1868 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -131,10 +131,12 @@ module ActiveRecord verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil scope = ENV['SCOPE'] - Migration.verbose = verbose + verbose_was = Migration.verbose Migrator.migrate(Migrator.migrations_paths, version) do |migration| scope.blank? || scope == migration.scope end + ensure + Migration.verbose = verbose_was end def charset_current(environment = env)