Sha256: c0ee46d7d7a6309d05d2e649d9de4663bf1e2476b6112d8329adbdfbbe638cab

Contents?: true

Size: 485 Bytes

Versions: 1

Compression:

Stored size: 485 Bytes

Contents

require 'spec_helper'
require 'futuroscope/future'
require 'timeout'

module Futuroscope
  describe Future do
    it "will return an instant value" do
      future = Future.new{ :edballs }
      sleep(0.1)

      expect(future).to eq(:edballs)
    end

    it "will execute the future in the background and wait for it" do
      future = Future.new{ sleep(1); :edballs }

      sleep(1)
      Timeout::timeout(0.9) do
        expect(future).to eq(:edballs)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
futuroscope-0.0.2 spec/futuroscope/future_spec.rb