tests/redic_test.rb in redic-1.4.0 vs tests/redic_test.rb in redic-1.4.1
- old
+ new
@@ -3,10 +3,11 @@
REDIS_URL = "redis://localhost:6379/"
prepare do
c = Redic.new(REDIS_URL)
+
begin
c.call("FLUSHDB")
rescue
c.call("AUTH", "foo")
c.call("FLUSHDB")
@@ -185,12 +186,25 @@
assert_equal "PONG", c1.call("PING")
end
test "reconnect" do |c1|
+ url = "redis://:foo@localhost:6379/"
+
+ assert url != c1.url
+
c1.call("CONFIG", "SET", "requirepass", "foo")
- c1.configure("redis://:foo@localhost:6379/")
+ c1.configure(url)
+
+ assert url == c1.url
+ assert url.object_id == c1.url.object_id
+
+ # Reconfigure only if URLs differ
+ c1.configure(url.dup)
+
+ # No reconnection ocurred
+ assert url.object_id == c1.url.object_id
assert_equal "PONG", c1.call("PING")
end
test "disconnect" do |c1|