diff options
Diffstat (limited to 'railties/test/generators/generators_test_helper.rb')
-rw-r--r-- | railties/test/generators/generators_test_helper.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index 6cc91f166b..94099fcd2e 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -49,4 +49,14 @@ module GeneratorsTestHelper end end end + + 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 |