diff options
author | Akira Matsuda <ronnie@dio.jp> | 2014-08-29 09:40:33 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2014-08-29 10:34:26 +0900 |
commit | 17b837b3f10d52c5a39ef2f49930a1ffb1b66872 (patch) | |
tree | 2c290bc6f60d7a6c207fc298e3c63439d6bc6ec9 /activerecord/test | |
parent | 9bb495e6ae4de6d8c22f5e0cf81fbd86d95362e2 (diff) | |
download | rails-17b837b3f10d52c5a39ef2f49930a1ffb1b66872.tar.gz rails-17b837b3f10d52c5a39ef2f49930a1ffb1b66872.tar.bz2 rails-17b837b3f10d52c5a39ef2f49930a1ffb1b66872.zip |
Bring original puts back after finishing tests
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/migration/helper.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/migrator_test.rb | 12 |
2 files changed, 12 insertions, 4 deletions
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 |