1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/migration/logger_test.rb

39 lines
1,007 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2012-01-11 14:48:14 -05:00
require "cases/helper"
module ActiveRecord
class Migration
class LoggerTest < ActiveRecord::TestCase
# MySQL can't roll back ddl changes
self.use_transactional_tests = false
2012-01-17 12:18:40 -05:00
2012-12-06 19:17:11 -05:00
Migration = Struct.new(:name, :version) do
def disable_ddl_transaction; false end
def migrate(direction)
2012-01-11 15:01:04 -05:00
# do nothing
end
end
2012-01-17 12:18:40 -05:00
def setup
super
ActiveRecord::SchemaMigration.create_table
ActiveRecord::SchemaMigration.delete_all
end
teardown do
ActiveRecord::SchemaMigration.drop_table
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
migrations = [Migration.new("a", 1), Migration.new("b", 2), Migration.new("c", 3)]
2012-01-11 15:01:04 -05:00
ActiveRecord::Migrator.new(:up, migrations).migrate
2012-01-11 14:48:14 -05:00
ensure
ActiveRecord::Base.logger = previous_logger
end
end
end
end