Permalink
Browse files

Bring original puts back after finishing tests

  • Loading branch information...
amatsuda committed Aug 29, 2014
1 parent 9bb495e commit 17b837b3f10d52c5a39ef2f49930a1ffb1b66872
Showing with 12 additions and 4 deletions.
  1. +0 −4 activerecord/test/cases/migration/helper.rb
  2. +12 −0 activerecord/test/cases/migrator_test.rb
@@ -5,10 +5,6 @@ class Migration
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
@@ -24,11 +24,23 @@ def setup
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

0 comments on commit 17b837b

Please sign in to comment.