Sha256: 94c81791fb9499dc2d9ff85dea3406a0f0e645170d7183ac1295a9330f6c82b5
Contents?: true
Size: 669 Bytes
Versions: 15
Compression:
Stored size: 669 Bytes
Contents
require 'promise' describe 'Promise#always' do it 'calls the block when it was resolved' do x = 42 Promise.value(23).then { |v| x = v }.always { |v| x = 2 } x.should == 2 end it 'calls the block when it was rejected' do x = 42 Promise.error(23).rescue { |v| x = v }.always { |v| x = 2 } x.should == 2 end it 'acts as resolved' do x = 42 Promise.error(23).rescue { |v| x = v }.always { x = 2 }.then { x = 3 } x.should == 3 end it 'raises an exception when the promise has already been chained' do p = Promise.value(2) p.then {} proc { p.always {} }.should raise_error(ArgumentError) end end
Version data entries
15 entries across 15 versions & 2 rubygems