core/lib/spree/testing_support/kernel.rb

Summary

Maintainability
A
20 mins
Test Coverage
module Spree
  module TestingSupport
    module Kernel
      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