aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDoug McInnes <doug@dougmcinnes.com>2009-02-03 18:37:55 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-04-07 13:21:41 -0500
commitc877857d59554d78dbf45f5f9fcaafb8badec4e2 (patch)
treef148d685b3d966ee4845e81988b90e4c259a9c72 /actionpack/test
parentf448c70b3f6c6698bce9c95fa4328c251fe085ee (diff)
downloadrails-c877857d59554d78dbf45f5f9fcaafb8badec4e2.tar.gz
rails-c877857d59554d78dbf45f5f9fcaafb8badec4e2.tar.bz2
rails-c877857d59554d78dbf45f5f9fcaafb8badec4e2.zip
Fix for TestResponse.cookies returning cookies unescaped [#1867 state:resolved]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/cookie_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/controller/cookie_test.rb b/actionpack/test/controller/cookie_test.rb
index 657be3c4e4..f7d97e160a 100644
--- a/actionpack/test/controller/cookie_test.rb
+++ b/actionpack/test/controller/cookie_test.rb
@@ -6,6 +6,10 @@ class CookieTest < ActionController::TestCase
cookies["user_name"] = "david"
end
+ def set_with_with_escapable_characters
+ cookies["that & guy"] = "foo & bar => baz"
+ end
+
def authenticate_for_fourteen_days
cookies["user_name"] = { "value" => "david", "expires" => Time.utc(2005, 10, 10,5) }
end
@@ -53,6 +57,12 @@ class CookieTest < ActionController::TestCase
assert_equal({"user_name" => "david"}, @response.cookies)
end
+ def test_setting_with_escapable_characters
+ get :set_with_with_escapable_characters
+ assert_equal ["that+%26+guy=foo+%26+bar+%3D%3E+baz; path=/"], @response.headers["Set-Cookie"]
+ assert_equal({"that & guy" => "foo & bar => baz"}, @response.cookies)
+ end
+
def test_setting_cookie_for_fourteen_days
get :authenticate_for_fourteen_days
assert_equal ["user_name=david; path=/; expires=Mon, 10-Oct-2005 05:00:00 GMT"], @response.headers["Set-Cookie"]