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 = {})
69
69
end
70
70
71
71
context 'when a block is given' do
72
+
72
73
it 'yields current value to the block and puts back value' do
73
74
m = MVar . new ( 14 )
74
75
expect { |b | m . take ( &b ) } . to yield_with_args ( 14 )
75
76
expect ( m . take ) . to eq ( 14 )
76
77
end
78
+
77
79
it 'puts back value even if an exception is raised' do
78
80
m = MVar . new ( 14 )
79
81
expect { m . take { fail 'boom!' } } . to raise_error ( 'boom!' )
80
82
expect ( m . take ) . to eq ( 14 )
81
83
end
84
+
82
85
it 'returns the returned value of the block' do
83
86
m = MVar . new ( 14 )
84
87
expect ( m . take { 2 } ) . to eq ( 2 )
85
88
expect ( m . take ) . to eq ( 14 )
86
89
end
90
+
87
91
it 'returns TIMEOUT on timeout on an empty MVar' do
88
92
m = MVar . new
89
93
expect ( m . take ( 0.1 ) { } ) . to eq MVar ::TIMEOUT
90
94
end
95
+
91
96
end
92
97
93
98
end
You can’t perform that action at this time.
0 commit comments