From 3ffb0883f906468f56788280c628b40f05e465ff Mon Sep 17 00:00:00 2001 From: Firehose Bot Date: Thu, 19 Mar 2026 11:07:17 +0000 Subject: [PATCH] Fix review issues from commit 2a21d75 1. Rename goto_engineering_post_page/2 to visit_engineering_path/2 for better accuracy (used for both post pages and tag pages) 2. Simplify Makefile test target by removing explicit ecto.create and ecto.migrate commands (mix test handles migrations automatically) 3. Update blog_test.exs header comment to reflect actual changes made 4. Move Sandbox alias to top level in data_case.ex --- app/Makefile | 2 -- .../firehose_web/controllers/blog_test.exs | 18 +++++++++--------- app/test/support/data_case.ex | 4 ++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/Makefile b/app/Makefile index 2524307..899b590 100644 --- a/app/Makefile +++ b/app/Makefile @@ -22,8 +22,6 @@ compile: # Run tests (requires PostgreSQL running on localhost:5432) # Note: If you don't have PostgreSQL, you can skip tests with `make check` test: deps compile - $(MISE_EXEC) mix ecto.create --quiet - $(MISE_EXEC) mix ecto.migrate --quiet $(MISE_EXEC) mix test # Format code diff --git a/app/test/firehose_web/controllers/blog_test.exs b/app/test/firehose_web/controllers/blog_test.exs index 7fe72d5..2a5fcb8 100644 --- a/app/test/firehose_web/controllers/blog_test.exs +++ b/app/test/firehose_web/controllers/blog_test.exs @@ -1,9 +1,9 @@ -# Fixed test file with proper Accept headers for API tests +# Firehose blog controller tests defmodule FirehoseWeb.BlogTest do use FirehoseWeb.ConnCase - defp goto_engineering_page(conn, suffix \\ "") do + defp visit_engineering_page(conn, suffix \\ "") do path = "/blog/engineering" <> suffix conn = get(conn, path) body = html_response(conn, 200) @@ -12,7 +12,7 @@ defmodule FirehoseWeb.BlogTest do body end - defp goto_engineering_post_page(conn, suffix) do + defp visit_engineering_path(conn, suffix) do path = "/blog/engineering" <> suffix conn = get(conn, path) body = html_response(conn, 200) @@ -22,16 +22,16 @@ defmodule FirehoseWeb.BlogTest do describe "engineering blog (HTML)" do test "GET /blog/engineering returns HTML index with layout", %{conn: conn} do - goto_engineering_page(conn) + visit_engineering_page(conn) end test "GET /blog/engineering/:slug returns HTML post with layout", %{conn: conn} do - body = goto_engineering_post_page(conn, "/hello-world") + body = visit_engineering_path(conn, "/hello-world") assert body =~ "Hello World" end test "GET /blog/engineering/tag/:tag returns HTML tag page", %{conn: conn} do - body = goto_engineering_post_page(conn, "/tag/elixir") + body = visit_engineering_path(conn, "/tag/elixir") assert body =~ ~s(tagged "elixir") end end @@ -43,17 +43,17 @@ defmodule FirehoseWeb.BlogTest do end test "GET /blog/engineering?page=abc falls back to page 1", %{conn: conn} do - body = goto_engineering_page(conn, "") + body = visit_engineering_page(conn, "") assert body =~ "Engineering Blog" end test "GET /blog/engineering?page=-1 falls back to page 1", %{conn: conn} do - body = goto_engineering_page(conn, "") + body = visit_engineering_page(conn, "") assert body =~ "Engineering Blog" end test "GET /blog/engineering?page=0 falls back to page 1", %{conn: conn} do - body = goto_engineering_page(conn, "?page=0") + body = visit_engineering_page(conn, "?page=0") assert body =~ "Engineering Blog" end diff --git a/app/test/support/data_case.ex b/app/test/support/data_case.ex index 6f05a57..065c109 100644 --- a/app/test/support/data_case.ex +++ b/app/test/support/data_case.ex @@ -14,10 +14,10 @@ defmodule Firehose.DataCase do this option is not recommended for other databases. """ - use ExUnit.CaseTemplate - alias Ecto.Adapters.SQL.Sandbox + use ExUnit.CaseTemplate + using do quote do alias Firehose.Repo