Permalink
Browse files

Provide a more meaningful inspect.

  • Loading branch information...
djanowski committed Jun 6, 2010
1 parent 90f28bf commit b870e447fa334d79bd013724cb2fd01b8227325a
Showing with 8 additions and 0 deletions.
  1. +4 −0 lib/redis.rb
  2. +4 −0 test/redis_test.rb
View
@@ -519,6 +519,10 @@ def id
@client.id
end
+ def inspect
+ "#<Redis client v#{Redis::VERSION} connected to #{id} (Redis v#{info["redis_version"]})>"
+ end
+
def method_missing(command, *args)
@client.call(command, *args)
end
View
@@ -82,6 +82,10 @@ class RedisTest < Test::Unit::TestCase
@r.info
end
end
+
+ test "provides a meaningful inspect" do
+ assert_equal "#<Redis client v#{Redis::VERSION} connected to redis://127.0.0.1:6379/15 (Redis v#{@r.info["redis_version"]})>", @r.inspect
+ end
end
context "Connection handling" do

0 comments on commit b870e44

Please sign in to comment.