aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/test_case_test.rb
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxedconsulting.com>2016-02-16 05:55:30 +0000
committerAndrew White <andrew.white@unboxedconsulting.com>2016-02-16 05:55:30 +0000
commit7a0f784af01421161593994d4c5ec3ff6e818cc2 (patch)
treea2d3a0ec4431d181ce624419e80e4ea5efe07bda /actionpack/test/controller/test_case_test.rb
parentc032e633bd84a3569a20f0697263bf07f75441b8 (diff)
downloadrails-7a0f784af01421161593994d4c5ec3ff6e818cc2.tar.gz
rails-7a0f784af01421161593994d4c5ec3ff6e818cc2.tar.bz2
rails-7a0f784af01421161593994d4c5ec3ff6e818cc2.zip
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.
Diffstat (limited to 'actionpack/test/controller/test_case_test.rb')
-rw-r--r--actionpack/test/controller/test_case_test.rb12
1 files changed, 10 insertions, 2 deletions
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