@@ -11,21 +11,21 @@ module Concurrent
11
11
end
12
12
13
13
subject do
14
- shared_actor_test_class . spawn
14
+ create_actor_test_class . spawn
15
15
end
16
16
17
17
it_should_behave_like :actor_ref
18
18
19
19
context 'construction' do
20
20
21
21
it 'supports :args being nil' do
22
- subject = shared_actor_test_class . spawn
22
+ subject = create_actor_test_class . spawn
23
23
actor = subject . instance_variable_get ( :@actor )
24
24
actor . argv . should be_empty
25
25
end
26
26
27
27
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 ] )
29
29
actor = subject . instance_variable_get ( :@actor )
30
30
actor . argv . should eq [ 1 , 2 , 3 , 4 ]
31
31
end
@@ -34,44 +34,40 @@ module Concurrent
34
34
subject # prevent the after(:all) block from breaking this test
35
35
opts = { foo : :bar , hello : :world }
36
36
described_class . should_receive ( :new ) . once . with ( anything , opts )
37
- shared_actor_test_class . spawn ( opts )
37
+ create_actor_test_class . spawn ( opts )
38
38
end
39
39
40
40
it 'calls #on_start on the actor' do
41
- actor = double ( :shared_actor_test_class )
41
+ actor = double ( :create_actor_test_class )
42
42
actor . should_receive ( :on_start ) . once . with ( no_args )
43
43
SimpleActorRef . new ( actor )
44
44
end
45
45
end
46
46
47
47
context 'reset_on_error' do
48
48
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 )
59
55
end
60
56
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 )
67
63
end
68
64
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 )
75
71
end
76
72
end
77
73
@@ -82,7 +78,7 @@ module Concurrent
82
78
end
83
79
84
80
it 'rescues Exception in the actor thread when true' do
85
- @ref = shared_actor_test_class . spawn (
81
+ @ref = create_actor_test_class . spawn (
86
82
abort_on_exception : false ,
87
83
rescue_exception : true
88
84
)
@@ -97,7 +93,7 @@ module Concurrent
97
93
end
98
94
99
95
it 'rescues StandardError in the actor thread when false' do
100
- @ref = shared_actor_test_class . spawn (
96
+ @ref = create_actor_test_class . spawn (
101
97
abort_on_exception : false ,
102
98
rescue_exception : false
103
99
)
@@ -112,7 +108,7 @@ module Concurrent
112
108
end
113
109
114
110
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 )
116
112
117
113
ivar = @ref . post ( :poison )
118
114
sleep ( 0.1 )
0 commit comments