From 17b837b3f10d52c5a39ef2f49930a1ffb1b66872 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 29 Aug 2014 09:40:33 +0900 Subject: Bring original puts back after finishing tests --- activerecord/test/cases/migration/helper.rb | 4 ---- activerecord/test/cases/migrator_test.rb | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/migration/helper.rb b/activerecord/test/cases/migration/helper.rb index 4dad77e8fd..5bc0898f33 100644 --- a/activerecord/test/cases/migration/helper.rb +++ b/activerecord/test/cases/migration/helper.rb @@ -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 diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb index a9e4a4d058..2574242b03 100644 --- a/activerecord/test/cases/migrator_test.rb +++ b/activerecord/test/cases/migrator_test.rb @@ -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 -- cgit v1.2.3