2012-01-11 14:48:14 -05:00
|
|
|
require "cases/helper"
|
|
|
|
|
|
|
|
module ActiveRecord
|
|
|
|
class Migration
|
|
|
|
class LoggerTest < ActiveRecord::TestCase
|
2012-01-11 15:01:04 -05:00
|
|
|
Migration = Struct.new(:version) do
|
|
|
|
def migrate direction
|
|
|
|
# do nothing
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-01-11 14:48:14 -05:00
|
|
|
def test_migration_should_be_run_without_logger
|
|
|
|
previous_logger = ActiveRecord::Base.logger
|
|
|
|
ActiveRecord::Base.logger = nil
|
2012-01-11 15:01:04 -05:00
|
|
|
migrations = [Migration.new(1), Migration.new(2), Migration.new(3)]
|
|
|
|
ActiveRecord::Migrator.new(:up, migrations).migrate
|
2012-01-11 14:48:14 -05:00
|
|
|
ensure
|
|
|
|
ActiveRecord::Base.logger = previous_logger
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|