File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -392,11 +392,8 @@ def _parse_options(options)
392
392
if uri . scheme == "unix"
393
393
defaults [ :path ] = uri . path
394
394
elsif uri . scheme == "redis"
395
- # Require the URL to have at least a host
396
- raise ArgumentError , "invalid url: #{ uri } " unless uri . host
397
-
398
395
defaults [ :scheme ] = uri . scheme
399
- defaults [ :host ] = uri . host
396
+ defaults [ :host ] = uri . host if uri . host
400
397
defaults [ :port ] = uri . port if uri . port
401
398
defaults [ :password ] = CGI . unescape ( uri . password ) if uri . password
402
399
defaults [ :db ] = uri . path [ 1 ..-1 ] . to_i if uri . path
Original file line number Diff line number Diff line change @@ -129,4 +129,10 @@ def test_uses_redis_url_over_default_if_available
129
129
130
130
ENV . delete ( "REDIS_URL" )
131
131
end
132
+
133
+ def test_defaults_to_localhost
134
+ redis = Redis . new ( :url => "redis:///" )
135
+
136
+ assert_equal "127.0.0.1" , redis . client . host
137
+ end
132
138
end
You can’t perform that action at this time.
0 commit comments