aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/test/cases/migration/logger_test.rb
blob: 6ea38c2650e6d8655bdbf5779642a50acd15a029 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11




                                             





                                         


                                                     

                                                                           





                                                   
require "cases/helper"

module ActiveRecord
  class Migration
    class LoggerTest < ActiveRecord::TestCase
      Migration = Struct.new(:version) do
        def migrate direction
          # do nothing
        end
      end

      def test_migration_should_be_run_without_logger
        previous_logger = ActiveRecord::Base.logger
        ActiveRecord::Base.logger = nil
        migrations = [Migration.new(1), Migration.new(2), Migration.new(3)]
        ActiveRecord::Migrator.new(:up, migrations).migrate
      ensure
        ActiveRecord::Base.logger = previous_logger
      end
    end
  end
end