diff --git a/config/test.exs b/config/test.exs index 108f359..fc1d4d5 100644 --- a/config/test.exs +++ b/config/test.exs @@ -6,6 +6,8 @@ config :chess, ChessWeb.Endpoint, http: [port: 4001], server: true +config :chess, :sql_sandbox, true + # Print only warnings and errors during test config :logger, level: :warn diff --git a/lib/chess_web/endpoint.ex b/lib/chess_web/endpoint.ex index ceb0fc8..887496e 100644 --- a/lib/chess_web/endpoint.ex +++ b/lib/chess_web/endpoint.ex @@ -1,6 +1,10 @@ defmodule ChessWeb.Endpoint do use Phoenix.Endpoint, otp_app: :chess + if Application.get_env(:chess, :sql_sandbox) do + plug Phoenix.Ecto.SQL.Sandbox + end + socket "/socket", ChessWeb.UserSocket # Serve at "/" the static files from "priv/static" directory.