Fix trailing newline and format code
This commit is contained in:
@@ -3,8 +3,8 @@ defmodule FirehoseWeb.BlogTagsTest do
|
||||
|
||||
defp goto_engineering_tag_page(conn, tag) do
|
||||
path = "/blog/engineering/tag/#{tag}"
|
||||
conn = get(conn, path)
|
||||
body = html_response(conn, 200)
|
||||
conn_res = get(conn, path)
|
||||
body = html_response(conn_res, 200)
|
||||
assert body =~ ~s(tagged "#{tag}")
|
||||
assert body =~ "Engineering Blog"
|
||||
body
|
||||
@@ -12,8 +12,8 @@ defmodule FirehoseWeb.BlogTagsTest do
|
||||
|
||||
defp goto_releases_tag_page(conn, tag) do
|
||||
path = "/blog/releases/tag/#{tag}"
|
||||
conn = get(conn, path)
|
||||
body = html_response(conn, 200)
|
||||
conn_res = get(conn, path)
|
||||
body = html_response(conn_res, 200)
|
||||
assert body =~ ~s(tagged "#{tag}")
|
||||
assert body =~ "Release Notes"
|
||||
body
|
||||
@@ -33,8 +33,8 @@ defmodule FirehoseWeb.BlogTagsTest do
|
||||
test "GET /blog/engineering/tag/:tag page shows empty list for nonexistent tag", %{
|
||||
conn: conn
|
||||
} do
|
||||
body = get(conn, "/blog/engineering/tag/nonexistent-tag")
|
||||
assert html_response(body, 200) =~ ~s(tagged "nonexistent-tag")
|
||||
conn_res = get(conn, "/blog/engineering/tag/nonexistent-tag")
|
||||
assert html_response(conn_res, 200) =~ ~s(tagged "nonexistent-tag")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,30 +45,30 @@ defmodule FirehoseWeb.BlogTagsTest do
|
||||
end
|
||||
|
||||
test "GET /blog/releases/tag/:tag page shows filtered posts", %{conn: conn} do
|
||||
body = get(conn, "/blog/releases/tag/nonexistent-tag")
|
||||
assert html_response(body, 200) =~ ~s(tagged "nonexistent-tag")
|
||||
conn_res = get(conn, "/blog/releases/tag/nonexistent-tag")
|
||||
assert html_response(conn_res, 200) =~ ~s(tagged "nonexistent-tag")
|
||||
end
|
||||
end
|
||||
|
||||
describe "tag URL pattern" do
|
||||
test "tag URLs follow pattern /blog/:blog_id/tag/:tag for engineering blog", %{conn: conn} do
|
||||
# Test that the tag route exists and works correctly
|
||||
conn = get(conn, "/blog/engineering/tag/elixir")
|
||||
assert html_response(conn, 200) =~ ~s(tagged "elixir")
|
||||
conn_res1 = get(conn, "/blog/engineering/tag/elixir")
|
||||
assert html_response(conn_res1, 200) =~ ~s(tagged "elixir")
|
||||
|
||||
conn = get(conn, "/blog/engineering/tag/phoenix")
|
||||
assert html_response(conn, 200) =~ ~s(tagged "phoenix")
|
||||
conn_res2 = get(conn, "/blog/engineering/tag/phoenix")
|
||||
assert html_response(conn_res2, 200) =~ ~s(tagged "phoenix")
|
||||
end
|
||||
|
||||
test "tag URLs follow pattern /blog/:blog_id/tag/:tag for releases blog", %{conn: conn} do
|
||||
# Test that the tag route exists and works correctly
|
||||
conn = get(conn, "/blog/releases/tag/release")
|
||||
assert html_response(conn, 200) =~ ~s(tagged "release")
|
||||
conn_res = get(conn, "/blog/releases/tag/release")
|
||||
assert html_response(conn_res, 200) =~ ~s(tagged "release")
|
||||
end
|
||||
|
||||
test "nonexistent tags return 200 with empty post list", %{conn: conn} do
|
||||
conn = get(conn, "/blog/engineering/tag/nonexistent-tag")
|
||||
assert html_response(conn, 200)
|
||||
conn_res = get(conn, "/blog/engineering/tag/nonexistent-tag")
|
||||
assert html_response(conn_res, 200)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,30 +94,30 @@ defmodule FirehoseWeb.BlogTagsTest do
|
||||
test "tags are rendered as clickable links on engineering blog index", %{
|
||||
conn: conn
|
||||
} do
|
||||
conn = get(conn, "/blog/engineering")
|
||||
body = html_response(conn, 200)
|
||||
conn_res1 = get(conn, "/blog/engineering")
|
||||
body1 = html_response(conn_res1, 200)
|
||||
|
||||
# Verify tag links exist with correct href pattern
|
||||
assert body =~ ~r{href="/blog/engineering/tag/meta"}
|
||||
assert body =~ ~r{href="/blog/engineering/tag/ai"}
|
||||
assert body1 =~ ~r{href="/blog/engineering/tag/meta"}
|
||||
assert body1 =~ ~r{href="/blog/engineering/tag/ai"}
|
||||
end
|
||||
|
||||
test "tags are rendered as clickable links on releases blog index", %{
|
||||
conn: conn
|
||||
} do
|
||||
conn = get(conn, "/blog/releases")
|
||||
body = html_response(conn, 200)
|
||||
conn_res2 = get(conn, "/blog/releases")
|
||||
body2 = html_response(conn_res2, 200)
|
||||
|
||||
# Verify tag link exists
|
||||
assert body =~ ~r{href="/blog/releases/tag/release"}
|
||||
assert body2 =~ ~r{href="/blog/releases/tag/release"}
|
||||
end
|
||||
|
||||
test "tag links have proper styling classes", %{conn: conn} do
|
||||
conn = get(conn, "/blog/engineering")
|
||||
body = html_response(conn, 200)
|
||||
conn_res3 = get(conn, "/blog/engineering")
|
||||
body3 = html_response(conn_res3, 200)
|
||||
|
||||
# Verify blogex-tag-link class is present for tag links
|
||||
assert body =~ ~r{class="[^"]*blogex-tag-link}
|
||||
assert body3 =~ ~r{class="[^"]*blogex-tag-link}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user