Skip to content

Commit

Permalink
make CGI::Cookie handle deleting a cookie properly
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information
Rich Cavanaugh authored and jeremy committed May 13, 2008
1 parent d16fbe5 commit d8bcec6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/cgi_ext/cookie.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions actionpack/test/controller/cookie_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit d8bcec6

Please sign in to comment.