-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,21 +6,28 @@ defmodule AppWeb.PageControllerTest do | |
assert html_response(conn, 200) =~ "effectiveness" | ||
end | ||
|
||
describe "login/register" do | ||
describe "login/register and logout" do | ||
test "display error when password invalid", %{conn: conn} do | ||
params = %{"person" => %{"email" => "[email protected]", "password" => "p"}} | ||
conn = post(conn, Routes.page_path(conn, :register), params) | ||
|
||
assert html_response(conn, 200) =~ "should be at least 6 character(s)" | ||
end | ||
|
||
test "redirects to home", %{conn: conn} do | ||
test "redirects to user info page when already logged in", %{conn: conn} do | ||
params = %{"person" => %{"email" => "[email protected]", "password" => "password"}} | ||
conn = post(conn, Routes.page_path(conn, :register), params) | ||
|
||
assert redirected_to(conn, 302) =~ "/people/info" | ||
end | ||
|
||
test "on logout redirect to index (ie / ) page", %{conn: conn} do | ||
params = %{"person" => %{"email" => "[email protected]", "password" => "password"}} | ||
conn = post(conn, Routes.page_path(conn, :register), params) | ||
conn = get(conn, Routes.person_path(conn, :logout)) | ||
assert redirected_to(conn, 302) =~ "/" | ||
end | ||
end | ||
|
||
|
||
end |