Add Dashboard nav link for authenticated users
- Add conditional "Dashboard" link in navbar that shows when a user is logged in - Tests verify the link is hidden for unauthenticated users and visible when authenticated - Investigation reports for Q1 (drafts/scheduled), Q2 (RSS), Q3 (email subs)
This commit is contained in:
@@ -1,9 +1,32 @@
|
||||
defmodule FirehoseWeb.PageControllerTest do
|
||||
use FirehoseWeb.ConnCase
|
||||
|
||||
test "GET /", %{conn: conn} do
|
||||
body = conn |> get(~p"/") |> html_response(200)
|
||||
assert body =~ "Drinking from the firehose"
|
||||
assert body =~ "Willem van den Ende"
|
||||
describe "GET /" do
|
||||
test "renders the homepage", %{conn: conn} do
|
||||
body = conn |> get(~p"/") |> html_response(200)
|
||||
assert body =~ "Drinking from the firehose"
|
||||
assert body =~ "Willem van den Ende"
|
||||
end
|
||||
|
||||
test "shows navigation links", %{conn: conn} do
|
||||
body = conn |> get(~p"/") |> html_response(200)
|
||||
assert body =~ ~s|/blog/engineering|
|
||||
assert body =~ ~s|/blog/releases|
|
||||
assert body =~ ~s|/contact|
|
||||
end
|
||||
|
||||
test "does not show dashboard link when unauthenticated", %{conn: conn} do
|
||||
body = conn |> get(~p"/") |> html_response(200)
|
||||
refute body =~ ~s|/editor/dashboard|
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET / when authenticated" do
|
||||
setup :register_and_log_in_user
|
||||
|
||||
test "shows dashboard link in navigation", %{conn: conn} do
|
||||
body = conn |> get(~p"/") |> html_response(200)
|
||||
assert body =~ ~s|/editor/dashboard|
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user