File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -69,25 +69,30 @@ def dereferenceable_subject(value, opts = {})
6969 end
7070
7171 context 'when a block is given' do
72+
7273 it 'yields current value to the block and puts back value' do
7374 m = MVar . new ( 14 )
7475 expect { |b | m . take ( &b ) } . to yield_with_args ( 14 )
7576 expect ( m . take ) . to eq ( 14 )
7677 end
78+
7779 it 'puts back value even if an exception is raised' do
7880 m = MVar . new ( 14 )
7981 expect { m . take { fail 'boom!' } } . to raise_error ( 'boom!' )
8082 expect ( m . take ) . to eq ( 14 )
8183 end
84+
8285 it 'returns the returned value of the block' do
8386 m = MVar . new ( 14 )
8487 expect ( m . take { 2 } ) . to eq ( 2 )
8588 expect ( m . take ) . to eq ( 14 )
8689 end
90+
8791 it 'returns TIMEOUT on timeout on an empty MVar' do
8892 m = MVar . new
8993 expect ( m . take ( 0.1 ) { } ) . to eq MVar ::TIMEOUT
9094 end
95+
9196 end
9297
9398 end
You can’t perform that action at this time.
0 commit comments