Sha256: 11aa54f340e203b7ec7e9d766920fdad235a0a9659f6188bb78fdb3d8daec588
Contents?: true
Size: 846 Bytes
Versions: 28
Compression:
Stored size: 846 Bytes
Contents
require "stringio" module DeepTest module ObjectExtension def capture_stdout old_stdout, $stdout = $stdout, StringIO.new yield $stdout.string ensure $stdout = old_stdout if old_stdout end def capture_stderr old_stderr, $stderr = $stderr, StringIO.new yield $stderr.string ensure $stderr = old_stderr if old_stderr end def retrying(description = nil, times = 5) i = 0 loop do begin return yield rescue => e i += 1 print "#{description} received exception #{e}. " if i < times puts "Retrying..." sleep 0.5 else puts "Aborting." raise e end end end end end end Object.send :include, DeepTest::ObjectExtension
Version data entries
28 entries across 28 versions & 5 rubygems