@@ -11,21 +11,21 @@ module Concurrent
1111 end
1212
1313 subject do
14- shared_actor_test_class . spawn
14+ create_actor_test_class . spawn
1515 end
1616
1717 it_should_behave_like :actor_ref
1818
1919 context 'construction' do
2020
2121 it 'supports :args being nil' do
22- subject = shared_actor_test_class . spawn
22+ subject = create_actor_test_class . spawn
2323 actor = subject . instance_variable_get ( :@actor )
2424 actor . argv . should be_empty
2525 end
2626
2727 it 'passes all :args option to the actor constructor' do
28- subject = shared_actor_test_class . spawn ( args : [ 1 , 2 , 3 , 4 ] )
28+ subject = create_actor_test_class . spawn ( args : [ 1 , 2 , 3 , 4 ] )
2929 actor = subject . instance_variable_get ( :@actor )
3030 actor . argv . should eq [ 1 , 2 , 3 , 4 ]
3131 end
@@ -34,44 +34,40 @@ module Concurrent
3434 subject # prevent the after(:all) block from breaking this test
3535 opts = { foo : :bar , hello : :world }
3636 described_class . should_receive ( :new ) . once . with ( anything , opts )
37- shared_actor_test_class . spawn ( opts )
37+ create_actor_test_class . spawn ( opts )
3838 end
3939
4040 it 'calls #on_start on the actor' do
41- actor = double ( :shared_actor_test_class )
41+ actor = double ( :create_actor_test_class )
4242 actor . should_receive ( :on_start ) . once . with ( no_args )
4343 SimpleActorRef . new ( actor )
4444 end
4545 end
4646
4747 context 'reset_on_error' do
4848
49- after ( :each ) do
50- @ref . shutdown if @ref
51- end
52-
53- it 'causes #on_reset to be called on exception when true' do
54- @ref = shared_actor_test_class . spawn ( reset_on_error : true )
55- actor = @ref . instance_variable_get ( :@actor )
56- actor . should_receive ( :on_reset ) . once . with ( no_args )
57- @ref << :poison
58- sleep ( 0.1 )
49+ it 'creates a new actor on exception when true' do
50+ clazz = create_actor_test_class
51+ args = [ :foo , :bar , :hello , :world ]
52+ ref = clazz . spawn ( reset_on_error : true , args : args )
53+ clazz . should_receive ( :new ) . once . with ( *args )
54+ ref . post ( :poison )
5955 end
6056
61- it 'prevents #on_reset form being called on exception when false' do
62- @ref = shared_actor_test_class . spawn ( reset_on_error : false )
63- actor = @ref . instance_variable_get ( :@actor )
64- actor . should_not_receive ( :on_reset ) . with ( any_args )
65- @ref << :poison
66- sleep ( 0.1 )
57+ it 'does not create a new actor on exception when false' do
58+ clazz = create_actor_test_class
59+ args = [ :foo , :bar , :hello , :world ]
60+ ref = clazz . spawn ( reset_on_error : true , args : args )
61+ clazz . should_not_receive ( :new ) . with ( any_args )
62+ ref . post ( :poison )
6763 end
6864
69- it 'defaults to true ' do
70- @ref = shared_actor_test_class . spawn
71- actor = @ref . instance_variable_get ( :@actor )
72- actor . should_receive ( :on_reset ) . once . with ( no_args )
73- @ref << :poison
74- sleep ( 0.1 )
65+ it 'defaults to false ' do
66+ clazz = create_actor_test_class
67+ args = [ :foo , :bar , :hello , :world ]
68+ ref = clazz . spawn ( args : args )
69+ clazz . should_not_receive ( :new ) . with ( any_args )
70+ ref . post ( :poison )
7571 end
7672 end
7773
@@ -82,7 +78,7 @@ module Concurrent
8278 end
8379
8480 it 'rescues Exception in the actor thread when true' do
85- @ref = shared_actor_test_class . spawn (
81+ @ref = create_actor_test_class . spawn (
8682 abort_on_exception : false ,
8783 rescue_exception : true
8884 )
@@ -97,7 +93,7 @@ module Concurrent
9793 end
9894
9995 it 'rescues StandardError in the actor thread when false' do
100- @ref = shared_actor_test_class . spawn (
96+ @ref = create_actor_test_class . spawn (
10197 abort_on_exception : false ,
10298 rescue_exception : false
10399 )
@@ -112,7 +108,7 @@ module Concurrent
112108 end
113109
114110 it 'defaults to false' do
115- @ref = shared_actor_test_class . spawn ( abort_on_exception : false )
111+ @ref = create_actor_test_class . spawn ( abort_on_exception : false )
116112
117113 ivar = @ref . post ( :poison )
118114 sleep ( 0.1 )
0 commit comments