Skip to content

Commit ccc6390

Browse files
committed
Implemented more specs.
1 parent bc4fe4b commit ccc6390

7 files changed

+13
-10
lines changed

lib/concurrent/java_cached_thread_pool.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def initialize(opts = {})
3737
java.util.concurrent.SynchronousQueue.new,
3838
OVERFLOW_POLICIES[@overflow_policy].new)
3939

40+
# without this the process may fail to exit
4041
at_exit { self.kill }
4142
end
4243
end

lib/concurrent/java_fixed_thread_pool.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def initialize(num_threads, opts = {})
2929
java.util.concurrent.LinkedBlockingQueue.new,
3030
OVERFLOW_POLICIES[@overflow_policy].new)
3131

32+
# without this the process may fail to exit
3233
at_exit { self.kill }
3334
end
3435
end

lib/concurrent/java_thread_pool_executor.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def initialize(opts = {})
6161
idletime, java.util.concurrent.TimeUnit::SECONDS,
6262
queue, OVERFLOW_POLICIES[@overflow_policy].new)
6363

64+
# without this the process may fail to exit
6465
at_exit { self.kill }
6566
end
6667

spec/concurrent/configuration_spec.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ module Concurrent
44

55
describe 'module functions' do
66

7-
context '#task' do
8-
pending
7+
let(:executor){ ImmediateExecutor.new }
8+
9+
specify '#task posts to the global task pool' do
10+
Concurrent.configuration.should_receive(:global_task_pool).and_return(executor)
11+
executor.should_receive(:post).with(1, 2, 3)
12+
Concurrent::task(1, 2, 3){|a, b, c| nil }
913
end
1014

11-
context '#operation' do
12-
pending
15+
specify '#operation posts to the global operation pool' do
16+
Concurrent.configuration.should_receive(:global_operation_pool).and_return(executor)
17+
executor.should_receive(:post).with(1, 2, 3)
18+
Concurrent::operation(1, 2, 3){|a, b, c| nil }
1319
end
1420
end
1521

spec/concurrent/java_cached_thread_pool_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ module Concurrent
1717

1818
it_should_behave_like :cached_thread_pool
1919

20-
it 'defines an #at_exit shutdown hook'
21-
2220
context '#initialize' do
2321

2422
it 'sets :min_length correctly' do

spec/concurrent/java_fixed_thread_pool_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ module Concurrent
1717

1818
it_should_behave_like :fixed_thread_pool
1919

20-
it 'defines an #at_exit shutdown hook'
21-
2220
context '#initialize' do
2321

2422
it 'sets :min_length correctly' do

spec/concurrent/java_thread_pool_executor_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ module Concurrent
2525

2626
it_should_behave_like :thread_pool_executor
2727

28-
it 'defines an #at_exit shutdown hook'
29-
3028
context '#overload_policy' do
3129

3230
specify ':abort maps to AbortPolicy' do

0 commit comments

Comments
 (0)