diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 22:08:41 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-04 11:58:40 -0300 |
commit | 481e49c64f790e46f4aff3ed539ed227d2eb46cb (patch) | |
tree | 2554f68cb6760765764799be4cf6fd58212a8686 /activerecord/test/cases/migration | |
parent | 98ea19925d6db642731741c3b91bd085fac92241 (diff) | |
download | rails-481e49c64f790e46f4aff3ed539ed227d2eb46cb.tar.gz rails-481e49c64f790e46f4aff3ed539ed227d2eb46cb.tar.bz2 rails-481e49c64f790e46f4aff3ed539ed227d2eb46cb.zip |
Remove deprecated methods at `Kernel`.
`silence_stderr`, `silence_stream`, `capture` and `quietly`.
Diffstat (limited to 'activerecord/test/cases/migration')
-rw-r--r-- | activerecord/test/cases/migration/foreign_key_test.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/activerecord/test/cases/migration/foreign_key_test.rb b/activerecord/test/cases/migration/foreign_key_test.rb index 51e21528c2..ad35d690bd 100644 --- a/activerecord/test/cases/migration/foreign_key_test.rb +++ b/activerecord/test/cases/migration/foreign_key_test.rb @@ -29,7 +29,7 @@ module ActiveRecord teardown do if defined?(@connection) - @connection.drop_table "astronauts" if @connection.table_exists? 'astronauts' + @connection.drop_table "astronauts" if @connection.table_exists? 'astronauts' @connection.drop_table "rockets" if @connection.table_exists? 'rockets' end end @@ -220,6 +220,18 @@ module ActiveRecord ensure silence_stream($stdout) { migration.migrate(:down) } end + + private + + def silence_stream(stream) + old_stream = stream.dup + stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null') + stream.sync = true + yield + ensure + stream.reopen(old_stream) + old_stream.close + end end end end |