Permalink
Browse files

Fixed problem with cookies not being set to path=/ by default and a t…

…est buggerboo

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@110 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 0c72e6d commit 1188d3005a35df9a9ef3fd43b6ab7252b10399aa @dhh dhh committed Dec 10, 2004
Showing with 5 additions and 4 deletions.
  1. +3 −2 actionpack/lib/action_controller/cookies.rb
  2. +2 −2 actionpack/test/template/url_helper_test.rb
@@ -44,7 +44,7 @@ def []=(name, options)
options.each { |key, value| options[key.to_s] = value }
options["name"] = name.to_s
else
- options = [ name, options ]
+ options = { "name" => name, "value" => options }
end
set_cookie(name, options)
@@ -57,7 +57,8 @@ def delete(name)
private
def set_cookie(name, options) #:doc:
- cookie = options.is_a?(Array) ? CGI::Cookie.new(*options) : CGI::Cookie.new(options)
+ options["path"] = "/" unless options["path"]
+ cookie = CGI::Cookie.new(options)
@controller.logger.info "Cookie set: #{cookie}" unless @controller.logger.nil?
@controller.response.headers["cookie"] << cookie
end
@@ -29,12 +29,12 @@ def test_link_tag_with_javascript_confirm
def test_link_to_image
assert_equal(
- "<a href=\"http://www.world.com\"><img alt=\"Rss\" height=\"45\" src=\"/images/rss.png\" width=\"30\" /></a>",
+ "<a href=\"http://www.world.com\"><img alt=\"Rss\" border=\"0\" height=\"45\" src=\"/images/rss.png\" width=\"30\" /></a>",
link_to_image("rss", "http://www.world.com", "size" => "30x45")
)
assert_equal(
- "<a class=\"admin\" href=\"http://www.world.com\"><img alt=\"Feed\" height=\"45\" src=\"/images/rss.gif\" width=\"30\" /></a>",
+ "<a class=\"admin\" href=\"http://www.world.com\"><img alt=\"Feed\" border=\"0\" height=\"45\" src=\"/images/rss.gif\" width=\"30\" /></a>",
link_to_image("rss.gif", "http://www.world.com", "size" => "30x45", "alt" => "Feed", "class" => "admin")
)
end

0 comments on commit 1188d30

Please sign in to comment.