File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
lib/concurrent-ruby/concurrent Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -250,6 +250,7 @@ def execute
250250 realize ( @promise_body )
251251 end
252252 else
253+ compare_and_set_state ( :pending , :unscheduled )
253254 @parent . execute
254255 end
255256 self
Original file line number Diff line number Diff line change @@ -195,6 +195,14 @@ def get_ivar_from_args(opts)
195195 end_latch . count_down
196196 end
197197 end
198+
199+ context "when called on child after parent completes" do
200+ let ( :parent_promise ) { Concurrent ::Promise . execute { 1 + 1 } . tap { |p | p . wait } }
201+ it 'sets state to :pending immediately' do
202+ child_promise = parent_promise . then { |two | two + 2 } . execute
203+ expect ( child_promise . state ) . to eq ( :pending )
204+ end
205+ end
198206 end
199207 end
200208
You can’t perform that action at this time.
0 commit comments