@@ -100,18 +100,31 @@ def many(*args, &block) nil; end
100
100
end
101
101
end
102
102
103
- context '# executor' do
103
+ context 'executor' do
104
104
105
- it 'returns the default executor when #executor= has never been called'
106
-
107
- it 'returns the memo after #executor= has been called'
108
- end
109
-
110
- context '#executor=' do
105
+ it 'returns the default executor when #executor= has never been called' do
106
+ Concurrent . configuration . should_receive ( :global_task_pool ) .
107
+ and_return ( ImmediateExecutor . new )
108
+ subject = async_class . new
109
+ subject . async . echo ( :foo )
110
+ end
111
111
112
- it 'memoizes the given executor'
112
+ it 'returns the memo after #executor= has been called' do
113
+ executor = ImmediateExecutor . new
114
+ executor . should_receive ( :post )
115
+ subject = async_class . new
116
+ subject . executor = executor
117
+ subject . async . echo ( :foo )
118
+ end
113
119
114
- it 'raises an exception if called multiple times'
120
+ it 'raises an exception if #executor= is called multiple times' do
121
+ executor = ImmediateExecutor . new
122
+ subject = async_class . new
123
+ subject . executor = executor
124
+ expect {
125
+ subject . executor = executor
126
+ } . to raise_error ( ArgumentError )
127
+ end
115
128
end
116
129
117
130
context '#async' do
@@ -140,7 +153,13 @@ def many(*args, &block) nil; end
140
153
val . should be_pending
141
154
end
142
155
143
- it 'runs the Future on the memoized executor'
156
+ it 'runs the Future on the memoized executor' do
157
+ executor = ImmediateExecutor . new
158
+ executor . should_receive ( :post ) . with ( any_args )
159
+ subject = async_class . new
160
+ subject . executor = executor
161
+ subject . async . echo ( :foo )
162
+ end
144
163
145
164
it 'sets the value on success' do
146
165
val = subject . async . echo ( :foo )
0 commit comments