File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ def connected?
54
54
@original_client . connected?
55
55
end
56
56
57
+ # Disconnect the client as quickly and silently as possible.
58
+ def disconnect!
59
+ @original_client . disconnect
60
+ end
61
+
57
62
# Authenticate to the server.
58
63
#
59
64
# @param [String] password must match the password specified in the
Original file line number Diff line number Diff line change @@ -38,6 +38,33 @@ def test_quit
38
38
assert !r . client . connected?
39
39
end
40
40
41
+ def test_disconnect
42
+ quit = 0
43
+
44
+ commands = {
45
+ :quit => lambda do
46
+ quit += 1
47
+ "+OK"
48
+ end
49
+ }
50
+
51
+ redis_mock ( commands ) do |redis |
52
+ assert_equal 0 , quit
53
+
54
+ redis . quit
55
+
56
+ assert_equal 1 , quit
57
+
58
+ redis . ping
59
+
60
+ redis . disconnect!
61
+
62
+ assert_equal 1 , quit
63
+
64
+ assert !redis . connected?
65
+ end
66
+ end
67
+
41
68
def test_shutdown
42
69
commands = {
43
70
:shutdown => lambda { :exit }
You can’t perform that action at this time.
0 commit comments