Sha256: 4ac6c966666cf11557abe00c3bd7c627ef362f81536788bd10fb493f22f09926
Contents?: true
Size: 896 Bytes
Versions: 6
Compression:
Stored size: 896 Bytes
Contents
module Runyoufools class Test attr_reader :ok attr_reader :trials def initialize( testFile, retries, command ) @file = testFile @ok = nil @retries = retries @command = command end def run @trials = 0 @retries.times do Runyoufools.log :info, "retrying #{@file}..." if @trials > 0 @trials += 1 _run return if @ok end end def _run Runyoufools.log :info, "RUNNING #{@file}" if @command toRun = "#{@command} #{@file}" else toRun = @file end @ok = system( toRun ) if @ok == nil Runyoufools.log :error, "could not execute: #{toRun}" end Runyoufools.log :info,( "#{self}" ) end def to_s result = { true => "OK ".green.bold, false => "FAIL ".red.bold, nil => "ERROR".white.bold.on_red }[ @ok ] "#{result}: #{@trials} trial(s) : #{@file}" end end end
Version data entries
6 entries across 6 versions & 1 rubygems