improve formatting
This commit is contained in:
parent
56e6eb3609
commit
026bf22f60
@ -23,11 +23,7 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
||||
describe "POST /users/confirm" do
|
||||
@tag :capture_log
|
||||
test "sends a new confirmation token", %{conn: conn, user: user} do
|
||||
conn =
|
||||
post(conn, ~p"/users/confirm", %{
|
||||
user: %{email: user.email}
|
||||
})
|
||||
|
||||
conn = post(conn, ~p"/users/confirm", %{user: %{email: user.email}})
|
||||
assert redirected_to(conn) == ~p"/"
|
||||
|
||||
conn.assigns.flash["info"] =~
|
||||
@ -39,11 +35,7 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
||||
test "does not send confirmation token if User is confirmed", %{conn: conn, user: user} do
|
||||
Repo.update!(Accounts.User.confirm_changeset(user))
|
||||
|
||||
conn =
|
||||
post(conn, ~p"/users/confirm", %{
|
||||
user: %{email: user.email}
|
||||
})
|
||||
|
||||
conn = post(conn, ~p"/users/confirm", %{user: %{email: user.email}})
|
||||
assert redirected_to(conn) == ~p"/"
|
||||
|
||||
conn.assigns.flash["info"] =~
|
||||
@ -51,11 +43,7 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
||||
end
|
||||
|
||||
test "does not send confirmation token if email is invalid", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, ~p"/users/confirm", %{
|
||||
user: %{email: "unknown@example.com"}
|
||||
})
|
||||
|
||||
conn = post(conn, ~p"/users/confirm", %{user: %{email: "unknown@example.com"}})
|
||||
assert redirected_to(conn) == ~p"/"
|
||||
|
||||
conn.assigns.flash["info"] =~
|
||||
|
@ -25,11 +25,7 @@ defmodule MemexWeb.UserRegistrationControllerTest do
|
||||
@tag :capture_log
|
||||
test "creates account and logs the user in", %{conn: conn} do
|
||||
email = unique_user_email()
|
||||
|
||||
conn =
|
||||
post(conn, ~p"/users/register", %{
|
||||
user: valid_user_attributes(email: email)
|
||||
})
|
||||
conn = post(conn, ~p"/users/register", %{user: valid_user_attributes(email: email)})
|
||||
|
||||
assert get_session(conn, :phoenix_flash) == %{
|
||||
"info" => "please check your email to verify your account"
|
||||
@ -40,9 +36,7 @@ defmodule MemexWeb.UserRegistrationControllerTest do
|
||||
|
||||
test "render errors for invalid data", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, ~p"/users/register", %{
|
||||
user: %{email: "with spaces", password: "too short"}
|
||||
})
|
||||
post(conn, ~p"/users/register", %{user: %{email: "with spaces", password: "too short"}})
|
||||
|
||||
response = html_response(conn, 200)
|
||||
assert response =~ "register"
|
||||
|
@ -23,11 +23,7 @@ defmodule MemexWeb.UserResetPasswordControllerTest do
|
||||
describe "POST /users/reset_password" do
|
||||
@tag :capture_log
|
||||
test "sends a new reset password token", %{conn: conn, user: user} do
|
||||
conn =
|
||||
post(conn, ~p"/users/reset_password", %{
|
||||
user: %{email: user.email}
|
||||
})
|
||||
|
||||
conn = post(conn, ~p"/users/reset_password", %{user: %{email: user.email}})
|
||||
assert redirected_to(conn) == ~p"/"
|
||||
|
||||
conn.assigns.flash["info"] =~
|
||||
@ -37,11 +33,7 @@ defmodule MemexWeb.UserResetPasswordControllerTest do
|
||||
end
|
||||
|
||||
test "does not send reset password token if email is invalid", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, ~p"/users/reset_password", %{
|
||||
user: %{email: "unknown@example.com"}
|
||||
})
|
||||
|
||||
conn = post(conn, ~p"/users/reset_password", %{user: %{email: "unknown@example.com"}})
|
||||
assert redirected_to(conn) == ~p"/"
|
||||
|
||||
conn.assigns.flash["info"] =~
|
||||
|
@ -71,11 +71,7 @@ defmodule MemexWeb.UserSessionControllerTest do
|
||||
|
||||
test "emits error message with invalid credentials",
|
||||
%{conn: conn, current_user: current_user} do
|
||||
conn =
|
||||
post(conn, ~p"/users/log_in", %{
|
||||
user: %{email: current_user.email, password: "bad"}
|
||||
})
|
||||
|
||||
conn = post(conn, ~p"/users/log_in", %{user: %{email: current_user.email, password: "bad"}})
|
||||
response = html_response(conn, 200)
|
||||
assert response =~ "log in"
|
||||
assert response =~ "invalid email or password"
|
||||
|
Loading…
Reference in New Issue
Block a user