Permalink
Browse files

make CGI::Cookie handle deleting a cookie properly

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent d16fbe5 commit d8bcec6ce6b48f271af5c566791417a58b8a617d Rich Cavanaugh committed with jeremy May 13, 2008
@@ -37,7 +37,7 @@ def initialize(name = '', *value)
@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
@@ -82,6 +82,7 @@ def test_setting_test_cookie
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

0 comments on commit d8bcec6

Please sign in to comment.