aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrevor Turk <trevorturk@gmail.com>2013-04-02 18:20:24 -0500
committerTrevor Turk <trevorturk@gmail.com>2013-04-02 18:20:24 -0500
commitc0b1eb112f2a604e39e52c3d840b58095f40f8f5 (patch)
treef1559fe0df4f345b7ef7a6f4ca00665225426101
parentc959798571b4060b19712e022f4236d75b2b7cfd (diff)
downloadrails-c0b1eb112f2a604e39e52c3d840b58095f40f8f5.tar.gz
rails-c0b1eb112f2a604e39e52c3d840b58095f40f8f5.tar.bz2
rails-c0b1eb112f2a604e39e52c3d840b58095f40f8f5.zip
Fix permanent cookie jar accessor typo
-rw-r--r--actionpack/lib/action_dispatch/middleware/cookies.rb2
-rw-r--r--actionpack/test/dispatch/cookies_test.rb7
2 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb
index 08c75632ba..2c37067b06 100644
--- a/actionpack/lib/action_dispatch/middleware/cookies.rb
+++ b/actionpack/lib/action_dispatch/middleware/cookies.rb
@@ -358,7 +358,7 @@ module ActionDispatch
end
def [](key)
- @parent_jar[name.to_s]
+ @parent_jar[key.to_s]
end
def []=(key, options)
diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb
index 68034e7f7b..08c0c876dc 100644
--- a/actionpack/test/dispatch/cookies_test.rb
+++ b/actionpack/test/dispatch/cookies_test.rb
@@ -349,12 +349,17 @@ class CookiesTest < ActionController::TestCase
assert response.headers["Set-Cookie"] =~ /user_name=david/
end
- def test_permanent_cookie
+ def test_set_permanent_cookie
get :set_permanent_cookie
assert_match(/Jamie/, @response.headers["Set-Cookie"])
assert_match(%r(#{20.years.from_now.utc.year}), @response.headers["Set-Cookie"])
end
+ def test_read_permanent_cookie
+ get :set_permanent_cookie
+ assert_equal 'Jamie', @controller.send(:cookies).permanent[:user_name]
+ end
+
def test_signed_cookie
get :set_signed_cookie
assert_equal 45, @controller.send(:cookies).signed[:user_id]