From 7a0f784af01421161593994d4c5ec3ff6e818cc2 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Tue, 16 Feb 2016 05:55:30 +0000 Subject: Move test for #22828 into it's own test The `cookies` hash isn't updated with the value generated by the output from `to_header` so it wasn't testing anything. Rendering the cookie value in the controller makes sure that the escaping is actually working. --- actionpack/test/controller/test_case_test.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'actionpack/test/controller/test_case_test.rb') diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index a054477282..aeea974212 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -142,6 +142,10 @@ XML render plain: 'ok' end + def render_cookie + render plain: cookies["foo"] + end + def delete_cookie cookies.delete("foo") render plain: 'ok' @@ -830,10 +834,14 @@ XML def test_should_have_knowledge_of_client_side_cookie_state_even_if_they_are_not_set cookies['foo'] = 'bar' - cookies['escape'] = '+' get :no_op assert_equal 'bar', cookies['foo'] - assert_equal '+', cookies['escape'] + end + + def test_cookies_should_be_escaped_properly + cookies['foo'] = '+' + get :render_cookie + assert_equal '+', @response.body end def test_should_detect_if_cookie_is_deleted -- cgit v1.2.3