aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorJack Danger Canty <github@jackcanty.com>2014-07-30 14:51:17 -0700
committerJack Danger Canty <github@jackcanty.com>2014-07-31 10:06:04 -0700
commitd66ed3b08d8035d4bcb20a26a5739415c0b92428 (patch)
tree3b228e0ddc05687cbca47fd0766680a10808698b /activerecord/test/cases
parent30194a5b475ea91f9709f64a08e6645cedbe4cb5 (diff)
downloadrails-d66ed3b08d8035d4bcb20a26a5739415c0b92428.tar.gz
rails-d66ed3b08d8035d4bcb20a26a5739415c0b92428.tar.bz2
rails-d66ed3b08d8035d4bcb20a26a5739415c0b92428.zip
Add ActiveRecord::Tasks::DatabaseTasks.migrate
This extracts the logic that was embedded in a Rake task into a static method. Bonus: the first test for `rake db:migrate`
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/tasks/database_tasks_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/tasks/database_tasks_test.rb b/activerecord/test/cases/tasks/database_tasks_test.rb
index 0f48c8d5fc..01d373b691 100644
--- a/activerecord/test/cases/tasks/database_tasks_test.rb
+++ b/activerecord/test/cases/tasks/database_tasks_test.rb
@@ -273,6 +273,19 @@ module ActiveRecord
end
end
+ class DatabaseTasksMigrateTest < ActiveRecord::TestCase
+ def test_migrate_receives_correct_env_vars
+ verbose, version = ENV['VERBOSE'], ENV['VERSION']
+
+ ENV['VERBOSE'] = 'false'
+ ENV['VERSION'] = '4'
+
+ ActiveRecord::Migrator.expects(:migrate).with(ActiveRecord::Migrator.migrations_paths, 4)
+ ActiveRecord::Tasks::DatabaseTasks.migrate
+ ensure
+ ENV['VERBOSE'], ENV['VERSION'] = verbose, version
+ end
+ end
class DatabaseTasksPurgeTest < ActiveRecord::TestCase
include DatabaseTasksSetupper