Sha256: 245b514d00717bc50501784bae6a9e9996c0ad0bfeada2ce8fb38df9c418c1f3
Contents?: true
Size: 504 Bytes
Versions: 1
Compression:
Stored size: 504 Bytes
Contents
# from: https://gist.github.com/mattwynne/1228927 # usage: # it "should return a result of 5" do # eventually { long_running_thing.result.should eq(5) } # end module AsyncHelper def eventually(options = {}) timeout = options[:timeout] || 2 interval = options[:interval] || 0.1 time_limit = Time.now + timeout loop do begin yield rescue => error end return if error.nil? raise error if Time.now >= time_limit sleep interval end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoes-4.0.0.pre1 | spec/async_helper.rb |