File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
lib/mongo/server/description
spec/mongo/server/description Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,8 @@ def initialize(server_wire_versions)
7575 private
7676
7777 def check_driver_support!
78- if DRIVER_WIRE_VERSIONS . max < server_wire_versions . max
78+ if DRIVER_WIRE_VERSIONS . max < server_wire_versions . min ||
79+ DRIVER_WIRE_VERSIONS . min > server_wire_versions . max
7980 raise Error ::UnsupportedFeatures . new ( server_wire_versions )
8081 end
8182 end
Original file line number Diff line number Diff line change 1515 end
1616 end
1717
18- context 'when the server wire version range is higher' do
18+ context 'when the server wire version range min is higher' do
1919
2020 it 'raises an exception' do
2121 expect {
22- described_class . new ( 0 .. 4 )
22+ described_class . new ( described_class :: DRIVER_WIRE_VERSIONS . max + 1 .. described_class :: DRIVER_WIRE_VERSIONS . max + 2 )
2323 } . to raise_error ( Mongo ::Error ::UnsupportedFeatures )
2424 end
2525 end
2626
27- context 'when the server wire version range is lower' do
27+ context 'when the server wire version range max is higher' do
28+
29+ let ( :features ) do
30+ described_class . new ( 0 ..4 )
31+ end
32+
33+ it 'sets the server wire version range' do
34+ expect ( features . server_wire_versions ) . to eq ( 0 ..4 )
35+ end
36+ end
37+
38+ context 'when the server wire version range max is lower' do
39+
40+ it 'raises an exception' do
41+ expect {
42+ described_class . new ( described_class ::DRIVER_WIRE_VERSIONS . min -2 ..described_class ::DRIVER_WIRE_VERSIONS . min -1 )
43+ } . to raise_error ( Mongo ::Error ::UnsupportedFeatures )
44+ end
45+ end
46+
47+ context 'when the server wire version range max is lower' do
2848
2949 let ( :features ) do
3050 described_class . new ( 0 ..2 )
You can’t perform that action at this time.
0 commit comments