1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

make CGI::Cookie handle deleting a cookie properly

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
Rich Cavanaugh 2008-05-13 12:19:27 -04:00 committed by Jeremy Kemper
parent d16fbe53b2
commit d8bcec6ce6
2 changed files with 2 additions and 1 deletions

View file

@ -37,7 +37,7 @@ class CGI #:nodoc:
@path = nil
else
@name = name['name']
@value = name['value'].kind_of?(String) ? [name['value']] : Array(name['value'])
@value = (name['value'].kind_of?(String) ? [name['value']] : Array(name['value'])).delete_if(&:blank?)
@domain = name['domain']
@expires = name['expires']
@secure = name['secure'] || false

View file

@ -82,6 +82,7 @@ class CookieTest < Test::Unit::TestCase
def test_expiring_cookie
get :logout
assert_equal [ CGI::Cookie::new("name" => "user_name", "value" => "", "expires" => Time.at(0)) ], @response.headers["cookie"]
assert_equal CGI::Cookie::new("name" => "user_name", "value" => "", "expires" => Time.at(0)).value, []
end
def test_cookiejar_accessor