Sha256: 1570998bd44fd8d4d40424eb6e346618a8839e58f58aca3e87131db88b101ffa
Contents?: true
Size: 886 Bytes
Versions: 21
Compression:
Stored size: 886 Bytes
Contents
require 'promise' describe 'Promise#rescue' do it 'calls the block when the promise has already been rejected' do x = 42 Promise.error(23).rescue { |v| x = v } x.should == 23 end it 'calls the block when the promise is rejected' do a = Promise.new x = 42 a.rescue { |v| x = v } a.reject(23) x.should == 23 end it 'does not call then blocks when the promise is rejected' do x = 42 y = 23 Promise.error(23).then { y = 42 }.rescue { |v| x = v } x.should == 23 y.should == 23 end it 'does not call subsequent rescue blocks' do x = 42 Promise.error(23).rescue { |v| x = v }.rescue { x = 42 } x.should == 23 end it 'raises an exception when the promise has already been chained' do p = Promise.value(2) p.then {} proc { p.rescue {} }.should raise_error(ArgumentError) end end
Version data entries
21 entries across 21 versions & 2 rubygems