提交 0349278f 编写于 作者: O Olly Legg 提交者: Joshua Peek

Memoize cookies so that updates to cookies are available in the current...

Memoize cookies so that updates to cookies are available in the current request. [#2733 state:resolved]
Signed-off-by: NJoshua Peek <josh@joshpeek.com>
上级 d17fb9dc
......@@ -51,7 +51,7 @@ def self.included(base)
protected
# Returns the cookie container, which operates as described above.
def cookies
CookieJar.new(self)
@cookies ||= CookieJar.new(self)
end
end
......
......@@ -123,6 +123,12 @@ def test_delete_cookie_with_path
assert_cookie_header "user_name=; path=/beaten; expires=Thu, 01-Jan-1970 00:00:00 GMT"
end
def test_cookies_persist_throughout_request
get :authenticate
cookies = @controller.send(:cookies)
assert_equal 'david', cookies['user_name']
end
private
def assert_cookie_header(expected)
header = @response.headers["Set-Cookie"]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册