diff --git a/test/music_library_web/live/artist_live/show_test.exs b/test/music_library_web/live/artist_live/show_test.exs index fea83bdf..175abbd7 100644 --- a/test/music_library_web/live/artist_live/show_test.exs +++ b/test/music_library_web/live/artist_live/show_test.exs @@ -9,12 +9,6 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do setup :verify_on_exit! - defp escape(string) do - string - |> Phoenix.HTML.html_escape() - |> Phoenix.HTML.safe_to_string() - end - defp fill_collection(_config) do collection_record = record_with_artist("Steven Wilson", %{ diff --git a/test/music_library_web/live/collection_live/index_test.exs b/test/music_library_web/live/collection_live/index_test.exs index 371a109e..9e1ccdac 100644 --- a/test/music_library_web/live/collection_live/index_test.exs +++ b/test/music_library_web/live/collection_live/index_test.exs @@ -22,12 +22,6 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do %{wishlist: records} end - defp escape(string) do - string - |> Phoenix.HTML.html_escape() - |> Phoenix.HTML.safe_to_string() - end - describe "Collection" do setup [:fill_collection, :fill_wishlist] diff --git a/test/music_library_web/live/collection_live/show_test.exs b/test/music_library_web/live/collection_live/show_test.exs index 6f20fa70..84be83d9 100644 --- a/test/music_library_web/live/collection_live/show_test.exs +++ b/test/music_library_web/live/collection_live/show_test.exs @@ -4,12 +4,6 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do import MusicLibrary.RecordsFixtures alias MusicLibrary.Records.Record - defp escape(string) do - string - |> Phoenix.HTML.html_escape() - |> Phoenix.HTML.safe_to_string() - end - describe "Edit record from show page" do test "can navigate to the record edit form", %{conn: conn} do record = record() diff --git a/test/music_library_web/live/stats_live/index_test.exs b/test/music_library_web/live/stats_live/index_test.exs index e0d77e74..b27260fe 100644 --- a/test/music_library_web/live/stats_live/index_test.exs +++ b/test/music_library_web/live/stats_live/index_test.exs @@ -20,12 +20,6 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do %{wishlist: records} end - defp escape(string) do - string - |> Phoenix.HTML.html_escape() - |> Phoenix.HTML.safe_to_string() - end - describe "Stats home page" do setup [:fill_collection, :fill_wishlist] diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index 613e1918..eb48e0df 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -30,6 +30,7 @@ defmodule MusicLibraryWeb.ConnCase do import MusicLibraryWeb.ConnCase import PhoenixTest import Phoenix.LiveViewTest, only: [render: 1, render_async: 1] + import MusicLibraryWeb.LiveTestHelpers end end diff --git a/test/support/live_test_helpers.ex b/test/support/live_test_helpers.ex new file mode 100644 index 00000000..823de0b2 --- /dev/null +++ b/test/support/live_test_helpers.ex @@ -0,0 +1,7 @@ +defmodule MusicLibraryWeb.LiveTestHelpers do + def escape(string) do + string + |> Phoenix.HTML.html_escape() + |> Phoenix.HTML.safe_to_string() + end +end