Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/async/redis/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def self.parse(string, endpoint = nil, **options)
# @parameter scheme [String, nil] The scheme to use, e.g. "redis" or "rediss". If nil, will auto-detect.
# @parameter hostname [String] The hostname to connect to (or bind to).
# @parameter options [Hash] Additional options, passed to {#initialize}.
def self.for(scheme, host, credentials: nil, port: nil, database: nil, **options)
def self.for(scheme, host, port: nil, database: nil, **options)
# Auto-detect scheme if not provided:
if default_scheme = options.delete(:scheme)
scheme ||= default_scheme
Expand All @@ -82,7 +82,6 @@ def self.for(scheme, host, credentials: nil, port: nil, database: nil, **options
self.new(
uri_klass.build(
scheme: scheme,
userinfo: credentials&.join(":"),
host: host,
port: port,
path: path,
Expand Down
6 changes: 2 additions & 4 deletions test/async/redis/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@

it "handles credentials correctly" do
endpoint = Async::Redis::Endpoint.for("redis", "localhost", credentials: ["user", "pass"], port: 6380)
expect(endpoint.url.to_s).to be == "redis://user:pass@localhost:6380"
expect(endpoint.url.userinfo).to be == "user:pass"
expect(endpoint.url.to_s).to be == "redis://localhost:6380"
expect(endpoint.credentials).to be == ["user", "pass"]
end

Expand All @@ -131,11 +130,10 @@
port: 6380,
database: 3
)
expect(endpoint.url.to_s).to be == "rediss://user:pass@[#{ipv6}]:6380/3"
expect(endpoint.url.to_s).to be == "rediss://[#{ipv6}]:6380/3"
expect(endpoint.url.scheme).to be == "rediss"
expect(endpoint.url.host).to be == "[#{ipv6}]"
expect(endpoint.url.hostname).to be == ipv6
expect(endpoint.url.userinfo).to be == "user:pass"
expect(endpoint.url.port).to be == 6380
expect(endpoint.url.path).to be == "/3"
expect(endpoint).to be(:secure?)
Expand Down
Loading