From 6ef803f95bf1b0046e0d115efbd88ba1d0fbdc3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 25 Mar 2023 21:52:18 +0100 Subject: [PATCH] Fix 404 rendering, closes #1826 --- config/config.exs | 3 ++- test/livebook_web/controllers/errors_test.exs | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/livebook_web/controllers/errors_test.exs diff --git a/config/config.exs b/config/config.exs index 1918818f9..76e5d6cd1 100644 --- a/config/config.exs +++ b/config/config.exs @@ -5,7 +5,8 @@ config :livebook, LivebookWeb.Endpoint, url: [host: "localhost", path: "/"], pubsub_server: Livebook.PubSub, live_view: [signing_salt: "livebook"], - drainer: [shutdown: 1000] + drainer: [shutdown: 1000], + render_errors: [formats: [html: LivebookWeb.ErrorHTML], layout: false] # Configures Elixir's Logger config :logger, :console, diff --git a/test/livebook_web/controllers/errors_test.exs b/test/livebook_web/controllers/errors_test.exs new file mode 100644 index 000000000..422c5379d --- /dev/null +++ b/test/livebook_web/controllers/errors_test.exs @@ -0,0 +1,12 @@ +defmodule LivebookWeb.ErrorsTest do + use LivebookWeb.ConnCase, async: true + + test "renders 404", %{conn: conn} do + response = assert_error_sent :not_found, fn -> + get(conn, "/this/does/not/exist") + end + + assert {404, _, body} = response + assert body =~ "No Numbats here!" + end +end