Skip to content

Commit

Permalink
Do not provide nil values for missing connection pool options
Browse files Browse the repository at this point in the history
  • Loading branch information
shepmaster committed Dec 19, 2018
1 parent 34d60c7 commit 8edcb1d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/redis/rack/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def pool_options
{
size: @options[:pool_size],
timeout: @options[:pool_timeout]
}
}.reject { |key, value| value.nil? }.to_h
end
end
end
Expand Down
11 changes: 11 additions & 0 deletions test/redis/rack/connection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ def setup
conn.pooled?.must_equal false
conn.store.to_s.must_match(/127\.0\.0\.1:6380 against DB 1$/)
end

it "does not include nil options for the connection pool" do
conn = Connection.new
conn.pool_options.must_be_empty

conn = Connection.new(pool_size: nil)
conn.pool_options.must_be_empty

conn = Connection.new(pool_timeout: nil)
conn.pool_options.must_be_empty
end
end
end
end

0 comments on commit 8edcb1d

Please sign in to comment.