Sha256: 64701625b7c432efc48086753ecffa674f08f8e5edaefd1babf94c27bb8027aa
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
require 'promise_pool/test' describe PromisePool::Timer do before do @timer = Timer.new(0.01) end def expect_raise expect.raise(@timer.error.class) do yield end.should.eq @timer.error end would 'raise timeout if task has not started' do pool = ThreadPool.new(0) expect_raise do Promise.new(@timer).defer(pool) do never called end.yield end end describe 'with flag' do before do @flag = false end after do @flag.should.eq true end would 'raise timeout if the task started' do pool = ThreadPool.new(1) expect_raise do Promise.new(@timer).defer(pool) do @flag = true sleep never called end.yield end pool.shutdown end would 'raise timeout in the thread' do expect_raise do Promise.new(@timer).defer do @flag = true sleep never called end.yield end end would 'raise timeout even with inline call' do expect_raise do Promise.new(@timer).call do @flag = true sleep never called end.yield end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
promise_pool-0.9.2 | test/test_timer.rb |
promise_pool-0.9.1 | test/test_timer.rb |
promise_pool-0.9.0 | test/test_timer.rb |