Testing signed cookies in rails -
i'm using signed cookies in rails 3 enable "remember-me" feature in application. works except i'm not able functional test cookies, since comparing cookies['remember_id']
gives me encrypted cookie, , cookies.signed
not defined.
any clues?
the problem (at least on surface) in context of functional test (actioncontroller::testcase), "cookies" object hash, whereas when work controllers, it's actiondispatch::cookies::cookiejar object. need convert cookiejar object can use "signed" method on convert signedcookiejar.
you can put following functional tests (after request) convert cookies hash cookiejar object
@request.cookies.merge!(cookies) cookies = actiondispatch::cookies::cookiejar.build(@request)
Comments
Post a Comment