Created
January 14, 2014 09:28
-
-
Save lukesarnacki/8415600 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActionDispatch::Session::JsonSerializer | |
def self.load(value) | |
JSON.load(value) + " and loaded" | |
end | |
def self.dump(value) | |
JSON.dump(value + " was dumped") | |
end | |
end | |
def test_encrypted_cookie_using_json_serializer | |
@request.env["action_dispatch.session_serializer"] = :json_serializer | |
get :set_encrypted_cookie | |
cookies = @controller.send :cookies | |
assert_not_equal 'bar', cookies[:foo] | |
assert_raises TypeError do | |
cookies.signed[:foo] | |
end | |
assert_equal 'bar was dumped and loaded', cookies.encrypted[:foo] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment