1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Bring original puts back after finishing tests

This commit is contained in:
Akira Matsuda 2014-08-29 09:40:33 +09:00
parent 9bb495e6ae
commit 17b837b3f1
2 changed files with 12 additions and 4 deletions

View file

@ -5,10 +5,6 @@ module ActiveRecord
class << self; attr_accessor :message_count; end
self.message_count = 0
def puts(text="")
ActiveRecord::Migration.message_count += 1
end
module TestHelper
attr_reader :connection, :table_name

View file

@ -24,11 +24,23 @@ class MigratorTest < ActiveRecord::TestCase
ActiveRecord::SchemaMigration.create_table
ActiveRecord::SchemaMigration.delete_all rescue nil
@verbose_was = ActiveRecord::Migration.verbose
ActiveRecord::Migration.class_eval do
undef :puts
def puts(*)
ActiveRecord::Migration.message_count += 1
end
end
end
teardown do
ActiveRecord::SchemaMigration.delete_all rescue nil
ActiveRecord::Migration.verbose = @verbose_was
ActiveRecord::Migration.class_eval do
undef :puts
def puts(*)
super
end
end
end
def test_migrator_with_duplicate_names