Skip to content

Commit 7e988ac

Browse files
committed
Improved tests for IVar and subclasses.
1 parent ac4b528 commit 7e988ac

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

spec/concurrent/delay_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ def dereferenceable_subject(value, opts = {})
2626
end
2727

2828
let(:fulfilled_subject) do
29-
delay = Delay.new(executor: :fast){ fulfilled_value }
29+
delay = Delay.new{ fulfilled_value }
3030
delay.tap{ delay.value }
3131
end
3232

3333
let(:rejected_subject) do
34-
delay = Delay.new(executor: :fast){ raise rejected_reason }
34+
delay = Delay.new{ raise rejected_reason }
3535
delay.tap{ delay.value }
3636
end
3737

spec/concurrent/future_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ module Concurrent
2424
end
2525

2626
let(:fulfilled_subject) do
27-
Future.new(executor: executor){ fulfilled_value }.execute.tap{ sleep(0.1) }
27+
Future.new(executor: :immediate){ fulfilled_value }.execute
2828
end
2929

3030
let(:rejected_subject) do
31-
Future.new(executor: executor){ raise rejected_reason }.execute.tap{ sleep(0.1) }
31+
Future.new(executor: :immediate){ raise rejected_reason }.execute
3232
end
3333

3434
it_should_behave_like :ivar do

spec/concurrent/promise_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ module Concurrent
1919
end
2020

2121
let(:fulfilled_subject) do
22-
Promise.new(executor: executor){ fulfilled_value }.execute.tap{ sleep(0.1) }
22+
Promise.new(executor: :immediate){ fulfilled_value }.execute
2323
end
2424

2525
let(:rejected_subject) do
26-
Promise.new(executor: executor){ raise rejected_reason }.execute.tap{ sleep(0.1) }
26+
Promise.new(executor: :immediate){ raise rejected_reason }.execute
2727
end
2828

2929
it_should_behave_like :ivar do

spec/concurrent/scheduled_task_spec.rb

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,11 @@ module Concurrent
1717
end
1818

1919
let(:fulfilled_subject) do
20-
latch = Concurrent::CountDownLatch.new(1)
21-
task = ScheduledTask.new(0.1){ latch.count_down; fulfilled_value }.execute
22-
latch.wait(1)
23-
sleep(0.1)
24-
task
20+
ScheduledTask.new(0, executor: :immediate){ fulfilled_value }.execute
2521
end
2622

2723
let(:rejected_subject) do
28-
latch = Concurrent::CountDownLatch.new(1)
29-
task = ScheduledTask.new(0.1){ latch.count_down; raise rejected_reason }.execute
30-
latch.wait(1)
31-
sleep(0.1)
32-
task
24+
ScheduledTask.new(0, executor: :immediate){ raise rejected_reason }.execute
3325
end
3426

3527
def dereferenceable_subject(value, opts = {})

0 commit comments

Comments
 (0)