Sha256: 70f46504da07bab450e8625f060d0c53fcf09265681909d3fcd4bb6f9a3c3dc4
Contents?: true
Size: 877 Bytes
Versions: 7
Compression:
Stored size: 877 Bytes
Contents
require 'spec/helper' require 'innate/state/thread' describe Innate::State::Thread do T = Innate::State::Thread it 'sets value in current thread with #[]=' do t = T.new t[:a] = :b Thread.current[:a].should == :b end it 'gets value in current thread with #[]' do t = T.new Thread.current[:b] = :c t[:b].should == :c end it 'executes block in #wrap' do t = T.new t.wrap{ :foo }.should == :foo end it 'reraises exceptions occured in #wrap thread' do t = T.new Thread.abort_on_exception = false lambda{ t.wrap{ raise 'foo' } }.should.raise end it 'defers execution of passed block in #defer' do t = T.new t.defer{ :foo }.value.should == :foo end it 'copies thread variables to thread spawned in #defer' do t = T.new t[:a] = :b t.defer{ Thread.current[:a] }.value.should == :b end end
Version data entries
7 entries across 7 versions & 2 rubygems