From 2a7d13ec7ad5fec61ceeaa7e164ae40e25ddcf47 Mon Sep 17 00:00:00 2001 From: yakov-cl <181740410+yakov-cl@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:49:17 -0500 Subject: [PATCH] import only required function Based on hexdocs: https://hexdocs.pm/elixir/alias-require-and-import.html\#import it is recommended to only import the function you are using. This change proposes to just import `render_to_string` in the `error_html_test.exs` file --- installer/templates/phx_test/controllers/error_html_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/templates/phx_test/controllers/error_html_test.exs b/installer/templates/phx_test/controllers/error_html_test.exs index 6d33964708..7678803b08 100644 --- a/installer/templates/phx_test/controllers/error_html_test.exs +++ b/installer/templates/phx_test/controllers/error_html_test.exs @@ -2,7 +2,7 @@ defmodule <%= @web_namespace %>.ErrorHTMLTest do use <%= @web_namespace %>.ConnCase, async: true # Bring render_to_string/4 for testing custom views - import Phoenix.Template + import Phoenix.Template, only(render_to_string: 4) test "renders 404.html" do assert render_to_string(<%= @web_namespace %>.ErrorHTML, "404", "html", []) == "Not Found"