upgrade to phoenix 1.7

This commit is contained in:
2023-04-14 23:34:11 -04:00
parent 1796fb822f
commit 1037f37be2
138 changed files with 2304 additions and 2252 deletions

View File

@ -9,15 +9,15 @@ defmodule CanneryWeb.UserRegistrationControllerTest do
describe "GET /users/register" do
test "renders registration page", %{conn: conn} do
conn = get(conn, Routes.user_registration_path(conn, :new))
conn = get(conn, ~p"/users/register")
response = html_response(conn, 200)
assert response =~ "Register"
assert response =~ "Log in"
end
test "redirects if already logged in", %{conn: conn} do
conn = conn |> log_in_user(user_fixture()) |> get(Routes.user_registration_path(conn, :new))
assert redirected_to(conn) == "/"
conn = conn |> log_in_user(user_fixture()) |> get(~p"/users/register")
assert redirected_to(conn) == ~p"/"
end
end
@ -25,20 +25,16 @@ defmodule CanneryWeb.UserRegistrationControllerTest do
@tag :capture_log
test "creates account and logs the user in", %{conn: conn} do
email = unique_user_email()
conn =
post(conn, Routes.user_registration_path(conn, :create), %{
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"
}
assert redirected_to(conn) =~ "/"
assert redirected_to(conn) =~ ~p"/"
# Now do a logged in request and assert on the menu
conn = get(conn, "/")
conn = get(conn, ~p"/")
response = html_response(conn, 200)
# user's email is recorded as admin
assert response =~ email
@ -46,9 +42,7 @@ defmodule CanneryWeb.UserRegistrationControllerTest do
test "render errors for invalid data", %{conn: conn} do
conn =
post(conn, Routes.user_registration_path(conn, :create), %{
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"