bones73k/test/bones73k_web/controllers/user_registration_controller_test.exs

21 lines
685 B
Elixir
Raw Normal View History

2021-02-24 07:49:39 -05:00
defmodule Bones73kWeb.UserRegistrationControllerTest do
use Bones73kWeb.ConnCase, async: true
2021-02-24 07:49:39 -05:00
import Bones73k.AccountsFixtures
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)
assert response =~ "Register\n </h3>"
assert response =~ "Log in\n</a>"
assert response =~ "Register\n</a>"
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) == "/"
end
end
end