Sha256: 1454983701f9238d5f98b29719c2fad058e070ede39fd3a78b2f7840d08c42ea

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

require 'promise_pool/test'

describe PromisePool::Future do
  would 'return the value' do
    Promise.new.defer{ 'value' }.future.should.eq 'value'
  end

  would 'raise an exception' do
    expect.raise(RuntimeError) do
      Promise.new.defer do
        raise 'nnf'
      end.future.oops
    end.message.should.eq 'nnf'
  end

  would 'raise an exception if it is returning an exception' do
    expect.raise(RuntimeError) do
      Promise.new.defer{ RuntimeError.new('nnf') }.future.oops
    end.message.should.eq 'nnf'
  end

  would 'respond_to_missing? properly' do
    [Promise.new.defer{0}.future].flatten.first.should.eq 0
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
promise_pool-0.9.0 test/test_future.rb