diff --git a/lib/radiator_web/live/outline_live/index.ex b/lib/radiator_web/live/outline_live/index.ex new file mode 100644 index 00000000..564e1134 --- /dev/null +++ b/lib/radiator_web/live/outline_live/index.ex @@ -0,0 +1,8 @@ +defmodule RadiatorWeb.OutlineLive.Index do + use RadiatorWeb, :live_view + + @impl true + def mount(_params, _session, socket) do + {:ok, socket} + end +end diff --git a/lib/radiator_web/live/outline_live/index.html.heex b/lib/radiator_web/live/outline_live/index.html.heex new file mode 100644 index 00000000..5e99304d --- /dev/null +++ b/lib/radiator_web/live/outline_live/index.html.heex @@ -0,0 +1,4 @@ +
+

Outline

+

Inbox

+
diff --git a/lib/radiator_web/router.ex b/lib/radiator_web/router.ex index c46bd206..8cc462fe 100644 --- a/lib/radiator_web/router.ex +++ b/lib/radiator_web/router.ex @@ -68,6 +68,8 @@ defmodule RadiatorWeb.Router do on_mount: [{RadiatorWeb.UserAuth, :ensure_authenticated}] do live "/users/settings", UserSettingsLive, :edit live "/users/settings/confirm_email/:token", UserSettingsLive, :confirm_email + + live "/outline", OutlineLive.Index, :index end end diff --git a/test/radiator_web/live/outline_live_test.exs b/test/radiator_web/live/outline_live_test.exs new file mode 100644 index 00000000..fcc2da66 --- /dev/null +++ b/test/radiator_web/live/outline_live_test.exs @@ -0,0 +1,37 @@ +defmodule RadiatorWeb.OutlineLiveTest do + use RadiatorWeb.ConnCase + + import Phoenix.LiveViewTest + import Radiator.AccountsFixtures + + describe "Outline show page" do + test "can render page if user is logged in", %{conn: conn} do + {:ok, _live, html} = conn |> log_in_user(user_fixture()) |> live(~p"/outline") + + assert html =~ "Outline" + end + + test "redirects if user is not logged in", %{conn: conn} do + assert {:error, redirect} = live(conn, ~p"/outline") + + assert {:redirect, %{to: path, flash: flash}} = redirect + assert path == ~p"/users/log_in" + assert %{"error" => "You must log in to access this page."} = flash + end + end + + describe "Outline has an inbox" do + setup %{conn: conn} do + user = user_fixture() + %{conn: log_in_user(conn, user)} + end + + test "inbox has a haeadline", %{conn: conn} do + {:ok, live, _html} = live(conn, ~p"/outline") + + assert live + |> element("h2", "Inbox") + |> render() =~ "Inbox" + end + end +end