Skip to content

Commit

Permalink
ErrorView 修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nasshu2916 committed Jul 10, 2024
1 parent 59200f0 commit ef2c3fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/live_babiniku_web/components/error_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule LiveBabinikuWeb.ErrorView do
# By default, Phoenix returns the status message from
# the template name. For example, "404.html" becomes
# "Not Found".
def template_not_found(template, _assigns) do
def render(template, _assigns) do
Phoenix.Controller.status_message_from_template(template)
end
end
6 changes: 3 additions & 3 deletions test/live_babiniku_web/views/error_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ defmodule LiveBabinikuWeb.ErrorViewTest do
use LiveBabinikuWeb.ConnCase, async: true

# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
import Phoenix.Template

test "renders 404.html" do
assert render_to_string(LiveBabinikuWeb.ErrorView, "404.html", []) == "Not Found"
assert render_to_string(LiveBabinikuWeb.ErrorView, "404.html", "html", []) == "Not Found"
end

test "renders 500.html" do
assert render_to_string(LiveBabinikuWeb.ErrorView, "500.html", []) == "Internal Server Error"
assert render_to_string(LiveBabinikuWeb.ErrorView, "500.html", "html", []) == "Internal Server Error"
end
end

0 comments on commit ef2c3fc

Please sign in to comment.