File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,10 @@ def connected?
55
55
end
56
56
57
57
# Disconnect the client as quickly and silently as possible.
58
- def disconnect!
58
+ def close
59
59
@original_client . disconnect
60
60
end
61
+ alias disconnect! close
61
62
62
63
# Sends a command to Redis and returns its reply.
63
64
#
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_close
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 . close
61
+
62
+ assert_equal 1 , quit
63
+
64
+ assert !redis . connected?
65
+ end
66
+ end
67
+
41
68
def test_disconnect
42
69
quit = 0
43
70
You can’t perform that action at this time.
0 commit comments