Last active
September 9, 2015 08:24
-
-
Save blacksails/1a064b2ca91b54f9a101 to your computer and use it in GitHub Desktop.
This file contains 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
# Test looks like this | |
test "call should set current_user to nil if auth fails" do | |
conn = post(conn, auth_path(conn, :login), | |
auth: %{@credentials | password: "cheesesticks"}) | |
conn = VerifySession.call(conn, []) | |
refute conn.private.current_user | |
end | |
# This is what happens at the endpoint: | |
conn | |
# If i comment in the following two lines, the test passes else it doesn't | |
# |> fetch_session | |
# |> put_session(:token, nil) | |
|> put_status(Status.code(:unauthorized)) | |
|> render("error.json", msg: "invalid email or password") | |
# Verify session does this: | |
conn | |
|> fetch_session # Plug.Conn.AlreadySentError raised on this line | |
|> get_token | |
|> verify_token | |
|> assign_user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment