Revert "Revert "Improve testing of cookies in functional tests:""

This reverts commit ba117b2b43a00c282bb4905fb003dd169a5312df.

@strzalek this is also worked around in rails3