forked from phoenixframework/phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_helper.exs
35 lines (28 loc) · 895 Bytes
/
test_helper.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Code.require_file("support/router_helper.exs", __DIR__)
# Starts web server applications
Application.ensure_all_started(:plug_cowboy)
# Used whenever a router fails. We default to simply
# rendering a short string.
defmodule Phoenix.ErrorView do
def render("404.json", %{kind: kind, reason: _reason, stack: _stack, conn: conn}) do
%{error: "Got 404 from #{kind} with #{conn.method}"}
end
def render(template, %{conn: conn}) do
unless conn.private.phoenix_endpoint do
raise "no endpoint in error view"
end
"#{template} from Phoenix.ErrorView"
end
end
# For mix tests
Mix.shell(Mix.Shell.Process)
assert_timeout = String.to_integer(
System.get_env("ELIXIR_ASSERT_TIMEOUT") || "200"
)
excludes =
if Version.match?(System.version(), "~> 1.14") do
[]
else
[:mix_phx_new]
end
ExUnit.start(assert_receive_timeout: assert_timeout, exclude: excludes)