Compare commits
No commits in common. "994aa96a20fd52778f1b62ce807c36fb9de51226" and "56e6eb36091974e0fd5dc209dca3b221aa07f591" have entirely different histories.
994aa96a20
...
56e6eb3609
@ -88,7 +88,9 @@ defmodule MemexWeb.Components.NotesTableComponent do
|
|||||||
|
|
||||||
@spec get_value_for_key(atom(), Note.t(), additional_data :: map()) ::
|
@spec get_value_for_key(atom(), Note.t(), additional_data :: map()) ::
|
||||||
any() | {any(), Rendered.t()}
|
any() | {any(), Rendered.t()}
|
||||||
defp get_value_for_key(:slug, %{slug: slug} = assigns, _additional_data) do
|
defp get_value_for_key(:slug, %{slug: slug}, _additional_data) do
|
||||||
|
assigns = %{slug: slug}
|
||||||
|
|
||||||
slug_block = ~H"""
|
slug_block = ~H"""
|
||||||
<.link navigate={~p"/note/#{@slug}"} class="link">
|
<.link navigate={~p"/note/#{@slug}"} class="link">
|
||||||
<%= @slug %>
|
<%= @slug %>
|
||||||
@ -98,7 +100,9 @@ defmodule MemexWeb.Components.NotesTableComponent do
|
|||||||
{slug, slug_block}
|
{slug, slug_block}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(:tags, assigns, _additional_data) do
|
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
|
||||||
|
assigns = %{tags: tags}
|
||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div class="flex flex-wrap justify-center space-x-1">
|
<div class="flex flex-wrap justify-center space-x-1">
|
||||||
<.link :for={tag <- @tags} patch={~p"/notes/#{tag}"} class="link">
|
<.link :for={tag <- @tags} patch={~p"/notes/#{tag}"} class="link">
|
||||||
|
@ -89,7 +89,9 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
|
|||||||
|
|
||||||
@spec get_value_for_key(atom(), Pipeline.t(), additional_data :: map()) ::
|
@spec get_value_for_key(atom(), Pipeline.t(), additional_data :: map()) ::
|
||||||
any() | {any(), Rendered.t()}
|
any() | {any(), Rendered.t()}
|
||||||
defp get_value_for_key(:slug, %{slug: slug} = assigns, _additional_data) do
|
defp get_value_for_key(:slug, %{slug: slug}, _additional_data) do
|
||||||
|
assigns = %{slug: slug}
|
||||||
|
|
||||||
slug_block = ~H"""
|
slug_block = ~H"""
|
||||||
<.link navigate={~p"/pipeline/#{@slug}"} class="link">
|
<.link navigate={~p"/pipeline/#{@slug}"} class="link">
|
||||||
<%= @slug %>
|
<%= @slug %>
|
||||||
@ -99,7 +101,9 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
|
|||||||
{slug, slug_block}
|
{slug, slug_block}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(:description, %{description: description} = assigns, _additional_data) do
|
defp get_value_for_key(:description, %{description: description}, _additional_data) do
|
||||||
|
assigns = %{description: description}
|
||||||
|
|
||||||
description_block = ~H"""
|
description_block = ~H"""
|
||||||
<div class="truncate max-w-sm">
|
<div class="truncate max-w-sm">
|
||||||
<%= @description %>
|
<%= @description %>
|
||||||
@ -109,7 +113,9 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
|
|||||||
{description, description_block}
|
{description, description_block}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_value_for_key(:tags, assigns, _additional_data) do
|
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
|
||||||
|
assigns = %{tags: tags}
|
||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div class="flex flex-wrap justify-center space-x-1">
|
<div class="flex flex-wrap justify-center space-x-1">
|
||||||
<.link :for={tag <- @tags} patch={~p"/pipelines/#{tag}"} class="link">
|
<.link :for={tag <- @tags} patch={~p"/pipelines/#{tag}"} class="link">
|
||||||
|
@ -23,7 +23,11 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
|||||||
describe "POST /users/confirm" do
|
describe "POST /users/confirm" do
|
||||||
@tag :capture_log
|
@tag :capture_log
|
||||||
test "sends a new confirmation token", %{conn: conn, user: user} do
|
test "sends a new confirmation token", %{conn: conn, user: user} do
|
||||||
conn = post(conn, ~p"/users/confirm", %{user: %{email: user.email}})
|
conn =
|
||||||
|
post(conn, ~p"/users/confirm", %{
|
||||||
|
user: %{email: user.email}
|
||||||
|
})
|
||||||
|
|
||||||
assert redirected_to(conn) == ~p"/"
|
assert redirected_to(conn) == ~p"/"
|
||||||
|
|
||||||
conn.assigns.flash["info"] =~
|
conn.assigns.flash["info"] =~
|
||||||
@ -35,7 +39,11 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
|||||||
test "does not send confirmation token if User is confirmed", %{conn: conn, user: user} do
|
test "does not send confirmation token if User is confirmed", %{conn: conn, user: user} do
|
||||||
Repo.update!(Accounts.User.confirm_changeset(user))
|
Repo.update!(Accounts.User.confirm_changeset(user))
|
||||||
|
|
||||||
conn = post(conn, ~p"/users/confirm", %{user: %{email: user.email}})
|
conn =
|
||||||
|
post(conn, ~p"/users/confirm", %{
|
||||||
|
user: %{email: user.email}
|
||||||
|
})
|
||||||
|
|
||||||
assert redirected_to(conn) == ~p"/"
|
assert redirected_to(conn) == ~p"/"
|
||||||
|
|
||||||
conn.assigns.flash["info"] =~
|
conn.assigns.flash["info"] =~
|
||||||
@ -43,7 +51,11 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "does not send confirmation token if email is invalid", %{conn: conn} do
|
test "does not send confirmation token if email is invalid", %{conn: conn} do
|
||||||
conn = post(conn, ~p"/users/confirm", %{user: %{email: "unknown@example.com"}})
|
conn =
|
||||||
|
post(conn, ~p"/users/confirm", %{
|
||||||
|
user: %{email: "unknown@example.com"}
|
||||||
|
})
|
||||||
|
|
||||||
assert redirected_to(conn) == ~p"/"
|
assert redirected_to(conn) == ~p"/"
|
||||||
|
|
||||||
conn.assigns.flash["info"] =~
|
conn.assigns.flash["info"] =~
|
||||||
|
@ -25,7 +25,11 @@ defmodule MemexWeb.UserRegistrationControllerTest do
|
|||||||
@tag :capture_log
|
@tag :capture_log
|
||||||
test "creates account and logs the user in", %{conn: conn} do
|
test "creates account and logs the user in", %{conn: conn} do
|
||||||
email = unique_user_email()
|
email = unique_user_email()
|
||||||
conn = post(conn, ~p"/users/register", %{user: valid_user_attributes(email: email)})
|
|
||||||
|
conn =
|
||||||
|
post(conn, ~p"/users/register", %{
|
||||||
|
user: valid_user_attributes(email: email)
|
||||||
|
})
|
||||||
|
|
||||||
assert get_session(conn, :phoenix_flash) == %{
|
assert get_session(conn, :phoenix_flash) == %{
|
||||||
"info" => "please check your email to verify your account"
|
"info" => "please check your email to verify your account"
|
||||||
@ -36,7 +40,9 @@ defmodule MemexWeb.UserRegistrationControllerTest do
|
|||||||
|
|
||||||
test "render errors for invalid data", %{conn: conn} do
|
test "render errors for invalid data", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
post(conn, ~p"/users/register", %{user: %{email: "with spaces", password: "too short"}})
|
post(conn, ~p"/users/register", %{
|
||||||
|
user: %{email: "with spaces", password: "too short"}
|
||||||
|
})
|
||||||
|
|
||||||
response = html_response(conn, 200)
|
response = html_response(conn, 200)
|
||||||
assert response =~ "register"
|
assert response =~ "register"
|
||||||
|
@ -23,7 +23,11 @@ defmodule MemexWeb.UserResetPasswordControllerTest do
|
|||||||
describe "POST /users/reset_password" do
|
describe "POST /users/reset_password" do
|
||||||
@tag :capture_log
|
@tag :capture_log
|
||||||
test "sends a new reset password token", %{conn: conn, user: user} do
|
test "sends a new reset password token", %{conn: conn, user: user} do
|
||||||
conn = post(conn, ~p"/users/reset_password", %{user: %{email: user.email}})
|
conn =
|
||||||
|
post(conn, ~p"/users/reset_password", %{
|
||||||
|
user: %{email: user.email}
|
||||||
|
})
|
||||||
|
|
||||||
assert redirected_to(conn) == ~p"/"
|
assert redirected_to(conn) == ~p"/"
|
||||||
|
|
||||||
conn.assigns.flash["info"] =~
|
conn.assigns.flash["info"] =~
|
||||||
@ -33,7 +37,11 @@ defmodule MemexWeb.UserResetPasswordControllerTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "does not send reset password token if email is invalid", %{conn: conn} do
|
test "does not send reset password token if email is invalid", %{conn: conn} do
|
||||||
conn = post(conn, ~p"/users/reset_password", %{user: %{email: "unknown@example.com"}})
|
conn =
|
||||||
|
post(conn, ~p"/users/reset_password", %{
|
||||||
|
user: %{email: "unknown@example.com"}
|
||||||
|
})
|
||||||
|
|
||||||
assert redirected_to(conn) == ~p"/"
|
assert redirected_to(conn) == ~p"/"
|
||||||
|
|
||||||
conn.assigns.flash["info"] =~
|
conn.assigns.flash["info"] =~
|
||||||
|
@ -71,7 +71,11 @@ defmodule MemexWeb.UserSessionControllerTest do
|
|||||||
|
|
||||||
test "emits error message with invalid credentials",
|
test "emits error message with invalid credentials",
|
||||||
%{conn: conn, current_user: current_user} do
|
%{conn: conn, current_user: current_user} do
|
||||||
conn = post(conn, ~p"/users/log_in", %{user: %{email: current_user.email, password: "bad"}})
|
conn =
|
||||||
|
post(conn, ~p"/users/log_in", %{
|
||||||
|
user: %{email: current_user.email, password: "bad"}
|
||||||
|
})
|
||||||
|
|
||||||
response = html_response(conn, 200)
|
response = html_response(conn, 200)
|
||||||
assert response =~ "log in"
|
assert response =~ "log in"
|
||||||
assert response =~ "invalid email or password"
|
assert response =~ "invalid email or password"
|
||||||
|
Loading…
Reference in New Issue
Block a user