From fb8dd29c46ee0cdd63d57d165f9ef70328fd027c Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Fri, 12 Jul 2024 08:39:25 -0700 Subject: [PATCH] Added test --- .../pinchflat_web/controllers/source_controller_test.exs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/pinchflat_web/controllers/source_controller_test.exs b/test/pinchflat_web/controllers/source_controller_test.exs index b9d6882..a4d18dc 100644 --- a/test/pinchflat_web/controllers/source_controller_test.exs +++ b/test/pinchflat_web/controllers/source_controller_test.exs @@ -50,6 +50,15 @@ defmodule PinchflatWeb.SourceControllerTest do refute html_response(conn, 200) =~ "MENU" end + + test "preloads some attributes when using a template", %{conn: conn} do + source = source_fixture(custom_name: "My first source", download_cutoff_date: "2021-01-01") + + conn = get(conn, ~p"/sources/new", %{"template_id" => source.id}) + assert html_response(conn, 200) =~ "New Source" + assert html_response(conn, 200) =~ "2021-01-01" + refute html_response(conn, 200) =~ source.custom_name + end end describe "create source" do