File tree Expand file tree Collapse file tree 1 file changed +42
-1
lines changed Expand file tree Collapse file tree 1 file changed +42
-1
lines changed Original file line number Diff line number Diff line change 33module Concurrent
44
55 describe Probe do
6- it 'should be written'
6+
7+ let ( :probe ) { Probe . new }
8+
9+ describe '#set_unless_assigned' do
10+ context 'empty probe' do
11+ it 'assigns the value' do
12+ probe . set_unless_assigned ( 32 )
13+ probe . value . should eq 32
14+ end
15+
16+ it 'returns true' do
17+ probe . set_unless_assigned ( 'hi' ) . should eq true
18+ end
19+ end
20+
21+ context 'fulfilled probe' do
22+ before ( :each ) { probe . set ( 27 ) }
23+
24+ it 'does not assign the value' do
25+ probe . set_unless_assigned ( 88 )
26+ probe . value . should eq 27
27+ end
28+
29+ it 'returns false' do
30+ probe . set_unless_assigned ( 'hello' ) . should eq false
31+ end
32+ end
33+
34+ context 'rejected probe' do
35+ before ( :each ) { probe . fail }
36+
37+ it 'does not assign the value' do
38+ probe . set_unless_assigned ( 88 )
39+ probe . should be_rejected
40+ end
41+
42+ it 'returns false' do
43+ probe . set_unless_assigned ( 'hello' ) . should eq false
44+ end
45+ end
46+ end
47+
748 end
849end
You can’t perform that action at this time.
0 commit comments