Commit 93c34e76 by Esteban Pastorino Committed by Tute Costa

Add `silence_stream` method removed in Rails 5

Ref: https://github.com/rails/rails/commit/481e49c64f790e46f4aff3ed539ed227d2eb46cb

`silence_stream` was deprecated in Rails 4.2 and removed in Rails 5
because it was not thread safe. Paperclip is not running the tests in
threaded mode, it's safe to add the method back in a test support
module.
parent 49faabb3
......@@ -36,6 +36,7 @@ RSpec.configure do |config|
config.include Assertions
config.include ModelReconstruction
config.include TestData
config.include Reporting
config.extend VersionHelper
config.mock_framework = :mocha
config.before(:all) do
......
module Reporting
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment