pat / combustion

Simple, elegant testing for Rails Engines
MIT License
708 stars 51 forks source link

Remove `silence_stream` usage for rails 5 compatibility #64

Closed bricker closed 9 years ago

bricker commented 9 years ago

Discussion: https://github.com/rails/rails/pull/13139 Deprecation (4.2.0): https://github.com/rails/rails/pull/13392 Removal (5.0.0): https://github.com/rails/rails/commit/481e49c64f790e46f4aff3ed539ed227d2eb46cb

I could also copy-and-paste the (now-private) silence_stream methods Rails is using into this class. It would look like:

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

Personally, the extra output doesn't bother me and I don't think it's worth it to copy this code over, but that's just me.

pat commented 9 years ago

Fair enough. Will leave it out for the moment... I do like my tests to not be too noisy (so it's easy to focus on each test result), but I'm loath to bring across old code if I can help it.