Skip to content
Permalink
Browse files

Fix spec timing

  • Loading branch information...
pitr-ch committed Mar 12, 2019
1 parent a423377 commit 8ad788d393000a1724f39c85a11b40b1478c1b23
Showing with 8 additions and 6 deletions.
  1. +1 −1 spec/concurrent/delay_spec.rb
  2. +7 −5 spec/concurrent/edge/erlang_actor_spec.rb
@@ -22,7 +22,7 @@ def dereferenceable_subject(value, opts = {})
let!(:rejected_reason) { StandardError.new('mojo jojo') }

let(:pending_subject) do
Delay.new(executor: :fast){ sleep 0.05; fulfilled_value }
Delay.new(executor: :fast){ sleep 0.1; fulfilled_value }
end

let(:fulfilled_subject) do
@@ -917,17 +917,19 @@
end

specify "timing out" do
body = { on_thread: -> { m = receive; sleep 0.01; reply m },
on_pool: -> { receive { |m| sleep 0.01; reply m } } }
count_down = Concurrent::CountDownLatch.new
body = { on_thread: -> { m = receive; count_down.wait; reply m },
on_pool: -> { receive { |m| count_down.wait; reply m } } }
a = Concurrent::ErlangActor.spawn(type: type, &body.fetch(type))
expect(a.ask(:err, 0, 42)).to eq 42
count_down.count_down
expect(a.terminated.value!).to eq false

body = { on_thread: -> { reply receive },
on_pool: -> { receive { |m| reply m } } }
a = Concurrent::ErlangActor.spawn(type: type, &body.fetch(type))
expect(a.ask(:v, 1, 42)).to eq :v
expect(a.terminated.value!).to eq true
b = Concurrent::ErlangActor.spawn(type: type, &body.fetch(type))
expect(b.ask(:v, 1, 42)).to eq :v
expect(b.terminated.value!).to eq true
end

specify "rejects on no reply" do

0 comments on commit 8ad788d

Please sign in to comment.
You can’t perform that action at this time.