Skip to content
Snippets Groups Projects
Commit ab0525a4 authored by Nurdaulet Seilkhanov's avatar Nurdaulet Seilkhanov
Browse files

Fixed tests for last commit

parent 69474423
No related branches found
No related tags found
1 merge request!4Resolve "FR-01: Account registration"
Pipeline #43063 passed
......@@ -23,7 +23,7 @@ defmodule UserRegistrationContext do
end
given_ ~r/^I am on the registration page$/, fn state ->
navigate_to("/users/new")
navigate_to("/register")
{:ok, state}
end
......@@ -37,7 +37,7 @@ defmodule UserRegistrationContext do
"test123",
"test123"
)
{:ok, Map.put(state, :name, "Test")}
{:ok, state}
end
and_ ~r/^I submit the form$/, fn state ->
......
......@@ -17,7 +17,7 @@ defmodule PropTrackrWeb.UserControllerTest do
end
test "AC1: unauthenticated user can register an account", %{conn: conn, user_params: user_params} do
conn = post(conn, "/users", user: user_params)
conn = post(conn, "/register", user: user_params)
assert html_response(conn, 302)
assert get_flash(conn, :info) == "User created successfully."
assert redirected_to(conn) == "/users"
......@@ -25,18 +25,18 @@ defmodule PropTrackrWeb.UserControllerTest do
test "AC2 and AC3: user sees an error when passwords do not match", %{conn: conn, user_params: user_params} do
mismatched_params = Map.put(user_params, :confirm_password, "different_password")
conn = post(conn, "/users", user: mismatched_params)
conn = post(conn, "/register", user: mismatched_params)
assert html_response(conn, 200) =~ "Passwords do not match."
end
test "AC4: user sees an error if an account with the same email exists", %{conn: conn, user_params: user_params} do
Repo.insert!(%User{email: user_params[:email], password: "test123"})
conn = post(conn, "/users", user: user_params)
conn = post(conn, "/register", user: user_params)
assert html_response(conn, 200) =~ "An account with this email already exists"
end
test "AC5, AC6, AC7: user is logged in, redirected, and shown notification upon successful registration", %{conn: conn, user_params: user_params} do
conn = post(conn, "/users", user: user_params)
conn = post(conn, "/register", user: user_params)
assert get_flash(conn, :info) == "User created successfully."
assert redirected_to(conn) == "/users"
assert get_session(conn, :user_id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment