diff options
author | href <href@random.sh> | 2018-01-31 20:36:42 +0100 |
---|---|---|
committer | href <href@random.sh> | 2018-01-31 20:36:42 +0100 |
commit | fcb2a082346054108f3f16cffe968450cf961976 (patch) | |
tree | 8e7d2eb9eeebf854e62e08c29b147f34dfeb1881 /test/lsg_web |
import
Diffstat (limited to 'test/lsg_web')
-rw-r--r-- | test/lsg_web/controllers/page_controller_test.exs | 8 | ||||
-rw-r--r-- | test/lsg_web/views/error_view_test.exs | 21 | ||||
-rw-r--r-- | test/lsg_web/views/layout_view_test.exs | 3 | ||||
-rw-r--r-- | test/lsg_web/views/page_view_test.exs | 3 |
4 files changed, 35 insertions, 0 deletions
diff --git a/test/lsg_web/controllers/page_controller_test.exs b/test/lsg_web/controllers/page_controller_test.exs new file mode 100644 index 0000000..b7a0299 --- /dev/null +++ b/test/lsg_web/controllers/page_controller_test.exs @@ -0,0 +1,8 @@ +defmodule LSGWeb.PageControllerTest do + use LSGWeb.ConnCase + + test "GET /", %{conn: conn} do + conn = get conn, "/" + assert html_response(conn, 200) =~ "Welcome to Phoenix!" + end +end diff --git a/test/lsg_web/views/error_view_test.exs b/test/lsg_web/views/error_view_test.exs new file mode 100644 index 0000000..2aae44d --- /dev/null +++ b/test/lsg_web/views/error_view_test.exs @@ -0,0 +1,21 @@ +defmodule LSGWeb.ErrorViewTest do + use LSGWeb.ConnCase, async: true + + # Bring render/3 and render_to_string/3 for testing custom views + import Phoenix.View + + test "renders 404.html" do + assert render_to_string(LSGWeb.ErrorView, "404.html", []) == + "Page not found" + end + + test "render 500.html" do + assert render_to_string(LSGWeb.ErrorView, "500.html", []) == + "Internal server error" + end + + test "render any other" do + assert render_to_string(LSGWeb.ErrorView, "505.html", []) == + "Internal server error" + end +end diff --git a/test/lsg_web/views/layout_view_test.exs b/test/lsg_web/views/layout_view_test.exs new file mode 100644 index 0000000..5a904f8 --- /dev/null +++ b/test/lsg_web/views/layout_view_test.exs @@ -0,0 +1,3 @@ +defmodule LSGWeb.LayoutViewTest do + use LSGWeb.ConnCase, async: true +end diff --git a/test/lsg_web/views/page_view_test.exs b/test/lsg_web/views/page_view_test.exs new file mode 100644 index 0000000..26fce45 --- /dev/null +++ b/test/lsg_web/views/page_view_test.exs @@ -0,0 +1,3 @@ +defmodule LSGWeb.PageViewTest do + use LSGWeb.ConnCase, async: true +end |