Sha256: f3fe4d1ebcf4ffaf3f4f2c92912fef8e334cc4fdff88f3b769b6185299d2609d
Contents?: true
Size: 685 Bytes
Versions: 1
Compression:
Stored size: 685 Bytes
Contents
require 'promise_pool/test' describe PromisePool::Promise do would 'claim' do value = 'body' Promise.claim(value).future.should.eq value end would 'then then then' do plusone = lambda{ |r| r + 1 } promise = Promise.new 2.times{ promise.then(&plusone).then(&plusone).then(&plusone) } promise.fulfill(0) promise.future.should.eq 6 end after do Muack.verify end would 'call in a new thread if no pool' do thread = nil rd, wr = IO.pipe mock(Thread).new.with_any_args.peek_return do |t| thread = t wr.puts end Promise.new.defer do rd.gets Thread.current.should.eq thread end.yield end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
promise_pool-0.1.0 | test/test_promise.rb |