2021-02-24 07:49:39 -05:00
|
|
|
defmodule Bones73kWeb.UserRegistrationControllerTest do
|
|
|
|
use Bones73kWeb.ConnCase, async: true
|
2020-09-12 20:07:02 -04:00
|
|
|
|
2021-02-24 07:49:39 -05:00
|
|
|
import Bones73k.AccountsFixtures
|
2020-09-12 20:07:02 -04:00
|
|
|
|
|
|
|
describe "GET /users/register" do
|
|
|
|
test "renders registration page", %{conn: conn} do
|
|
|
|
conn = get(conn, Routes.user_registration_path(conn, :new))
|
|
|
|
response = html_response(conn, 200)
|
2021-04-10 12:25:03 -04:00
|
|
|
assert response =~ "Register</h2>"
|
|
|
|
assert response =~ "Register</button>"
|
|
|
|
assert response =~ "Log in</a>"
|
|
|
|
assert response =~ "Forgot your password?</a>"
|
2020-09-12 20:07:02 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test "redirects if already logged in", %{conn: conn} do
|
2021-03-02 16:48:00 -05:00
|
|
|
to = Routes.user_registration_path(conn, :new)
|
|
|
|
conn = conn |> log_in_user(user_fixture()) |> get(to)
|
2020-09-12 20:07:02 -04:00
|
|
|
assert redirected_to(conn) == "/"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|