File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ def client
138
138
# @return [ Symbol ] The client name for this persistence
139
139
# context.
140
140
def client_name
141
- @client_name ||= options [ :client ] ||
141
+ @client_name ||= __evaluate__ ( options [ :client ] ) ||
142
142
Threaded . client_override ||
143
143
__evaluate__ ( storage_options [ :client ] )
144
144
end
Original file line number Diff line number Diff line change 584
584
expect ( persistence_context . client ) . to eq ( Mongoid ::Clients . with_name ( :alternative ) )
585
585
end
586
586
587
+ context 'when the client option is a proc' do
588
+ let ( :options ) { { client : -> { :alternative } } }
589
+
590
+ it 'evaluates the proc' do
591
+ expect ( persistence_context . client ) . to eq ( Mongoid ::Clients . with_name ( :alternative ) )
592
+ end
593
+ end
594
+
587
595
context 'when there is a client override' do
588
596
persistence_context_override :client , :other
589
597
You can’t perform that action at this time.
0 commit comments