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)
75
75
private
76
76
77
77
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
79
80
raise Error ::UnsupportedFeatures . new ( server_wire_versions )
80
81
end
81
82
end
Original file line number Diff line number Diff line change 15
15
end
16
16
end
17
17
18
- context 'when the server wire version range is higher' do
18
+ context 'when the server wire version range min is higher' do
19
19
20
20
it 'raises an exception' do
21
21
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 )
23
23
} . to raise_error ( Mongo ::Error ::UnsupportedFeatures )
24
24
end
25
25
end
26
26
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
28
48
29
49
let ( :features ) do
30
50
described_class . new ( 0 ..2 )
You can’t perform that action at this time.
0 commit comments