use atom keys in tests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-03-28 21:57:29 -04:00
parent 8c95536ffd
commit bab2b26c13
28 changed files with 720 additions and 861 deletions

View File

@ -4,7 +4,6 @@ defmodule CanneryWeb.UserRegistrationControllerTest do
"""
use CanneryWeb.ConnCase, async: true
import CanneryWeb.Gettext
@moduletag :user_registration_controller_test
@ -12,8 +11,8 @@ defmodule CanneryWeb.UserRegistrationControllerTest do
test "renders registration page", %{conn: conn} do
conn = get(conn, Routes.user_registration_path(conn, :new))
response = html_response(conn, 200)
assert response =~ dgettext("actions", "Register")
assert response =~ dgettext("actions", "Log in")
assert response =~ "Register"
assert response =~ "Log in"
end
test "redirects if already logged in", %{conn: conn} do
@ -29,11 +28,11 @@ defmodule CanneryWeb.UserRegistrationControllerTest do
conn =
post(conn, Routes.user_registration_path(conn, :create), %{
"user" => valid_user_attributes(email: email)
user: valid_user_attributes(email: email)
})
assert get_session(conn, :phoenix_flash) == %{
"info" => dgettext("prompts", "Please check your email to verify your account")
"info" => "Please check your email to verify your account"
}
assert redirected_to(conn) =~ "/"
@ -48,11 +47,11 @@ 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"}
user: %{email: "with spaces", password: "too short"}
})
response = html_response(conn, 200)
assert response =~ gettext("Register")
assert response =~ "Register"
assert response =~ "must have the @ sign and no spaces"
assert response =~ "should be at least 12 character"
end