File tree Expand file tree Collapse file tree 1 file changed +29
-5
lines changed Expand file tree Collapse file tree 1 file changed +29
-5
lines changed Original file line number Diff line number Diff line change 9
9
10
10
let ( :subscriber ) { EventSubscriber . new }
11
11
12
+ let ( :find_options ) { { } }
13
+
12
14
let ( :operation ) do
13
- collection . find . map_reduce ( 'function(){}' , 'function(){}' )
15
+ collection . find ( { } , find_options ) . map_reduce ( 'function(){}' , 'function(){}' )
14
16
end
15
17
16
18
before do
23
25
context 'read preference' do
24
26
require_topology :sharded
25
27
26
- let ( :client ) { authorized_client . with ( read : { mode : :secondary_preferred } ) }
28
+ context 'specified on client' do
29
+ let ( :client ) { authorized_client . with ( read : { mode : :secondary_preferred } ) }
27
30
28
- it 'is sent' do
29
- operation . to_a
31
+ it 'is sent' do
32
+ operation . to_a
33
+
34
+ event . command [ '$readPreference' ] . should == { 'mode' => 'secondaryPreferred' }
35
+ end
36
+ end
37
+
38
+ context 'specified on collection' do
39
+ let ( :collection ) { client [ 'mr_integration' , read : { mode : :secondary_preferred } ] }
40
+
41
+ it 'is sent' do
42
+ operation . to_a
43
+
44
+ event . command [ '$readPreference' ] . should == { 'mode' => 'secondaryPreferred' }
45
+ end
46
+ end
47
+
48
+ context 'specified on operation' do
49
+ let ( :find_options ) { { read : { mode : :secondary_preferred } } }
50
+
51
+ it 'is sent' do
52
+ operation . to_a
30
53
31
- event . command [ '$readPreference' ] . should == { 'mode' => 'secondaryPreferred' }
54
+ event . command [ '$readPreference' ] . should == { 'mode' => 'secondaryPreferred' }
55
+ end
32
56
end
33
57
end
34
58
You can’t perform that action at this time.
0 commit comments