class ActiveRecord::DatabaseTasksMigrateTest
Public Instance Methods
setup()
click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 335 def setup ActiveRecord::Tasks::DatabaseTasks.migrations_paths = "custom/path" end
teardown()
click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 339 def teardown ActiveRecord::Tasks::DatabaseTasks.migrations_paths = nil end
test_migrate_clears_schema_cache_afterward()
click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 379 def test_migrate_clears_schema_cache_afterward ActiveRecord::Base.expects(:clear_cache!) ActiveRecord::Tasks::DatabaseTasks.migrate end
test_migrate_raise_error_on_empty_version()
click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 370 def test_migrate_raise_error_on_empty_version version = ENV["VERSION"] ENV["VERSION"] = "" e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.migrate } assert_equal "Empty VERSION provided", e.message ensure ENV["VERSION"] = version end
test_migrate_receives_correct_env_vars()
click to toggle source
# File activerecord/test/cases/tasks/database_tasks_test.rb, line 343 def test_migrate_receives_correct_env_vars verbose, version = ENV["VERBOSE"], ENV["VERSION"] 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 end