Add test case for unable to run migration if ActiveRecord::Base.logger is nil (#3434)

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Prem Sichanugrist
2010-01-26 16:21:12 +07:00
committed by José Valim
parent f4e5303bcf
commit ea2cbc86f7

View File

@@ -1350,6 +1350,16 @@ if ActiveRecord::Base.connection.supports_migrations?
end
end
def test_migration_should_be_run_without_logger
previous_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil
assert_nothing_raised do
ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid")
end
ensure
ActiveRecord::Base.logger = previous_logger
end
protected
def with_env_tz(new_tz = 'US/Eastern')
old_tz, ENV['TZ'] = ENV['TZ'], new_tz