Skip to content

Commit 1ca5143

Browse files
committed
Fix spec determenism
1 parent 52c08fc commit 1ca5143

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spec/concurrent/promise_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,10 @@ def get_ivar_from_args(opts)
199199
context "when called on child after parent completes" do
200200
let(:parent_promise) { Concurrent::Promise.execute { 1 + 1 }.tap { |p| p.wait } }
201201
it 'sets state to :pending immediately' do
202-
child_promise = parent_promise.then { |two| two + 2 }.execute
202+
latch = CountDownLatch.new
203+
child_promise = parent_promise.then { |_| latch.wait }.execute
203204
expect(child_promise.state).to eq(:pending)
205+
latch.count_down
204206
end
205207
end
206208
end

0 commit comments

Comments
 (0)