From 86c032004e4079a1ed7c9b4bd1ac5411b94e343b Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 13 Mar 2026 19:43:04 +0100 Subject: [PATCH] fix: failing tests --- test/membership/setting_join_form_test.exs | 7 ------- test/mv_web/live/join_live_test.exs | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/test/membership/setting_join_form_test.exs b/test/membership/setting_join_form_test.exs index f9cb2f4..c0b7f14 100644 --- a/test/membership/setting_join_form_test.exs +++ b/test/membership/setting_join_form_test.exs @@ -56,13 +56,6 @@ defmodule Mv.Membership.SettingJoinFormTest do Membership.update_settings(settings, attrs) end - defp _error_message(errors, field) when is_atom(field) do - errors - |> Enum.filter(fn err -> Map.get(err, :field) == field end) - |> Enum.map(&Map.get(&1, :message, "")) - |> List.first() || "" - end - # ---- 1. Persistence and loading ---- describe "join form settings persistence and loading" do diff --git a/test/mv_web/live/join_live_test.exs b/test/mv_web/live/join_live_test.exs index 4b6c24a..bee6cf0 100644 --- a/test/mv_web/live/join_live_test.exs +++ b/test/mv_web/live/join_live_test.exs @@ -14,6 +14,7 @@ defmodule MvWeb.JoinLiveTest do import Phoenix.LiveViewTest import Ecto.Query + alias Ecto.Adapters.SQL.Sandbox alias Mv.Membership alias Mv.Repo @@ -45,6 +46,9 @@ defmodule MvWeb.JoinLiveTest do count_before = count_join_requests() {:ok, view, _html} = live(conn, "/join") + # Allow LiveView process to use the same Ecto sandbox so the test sees the created JoinRequest. + Sandbox.allow(Repo, conn.private[:ecto_sandbox], view.pid) + view |> form("#join-form", %{ "email" => "newuser#{System.unique_integer([:positive])}@example.com",