conn_case.ex 863 B

1234567891011121314151617181920212223242526272829303132333435
  1. defmodule WebWeb.ConnCase do
  2. @moduledoc """
  3. This module defines the test case to be used by
  4. tests that require setting up a connection.
  5. Such tests rely on `Phoenix.ConnTest` and also
  6. import other functionality to make it easier
  7. to build common datastructures and query the data layer.
  8. Finally, if the test case interacts with the database,
  9. it cannot be async. For this reason, every test runs
  10. inside a transaction which is reset at the beginning
  11. of the test unless the test case is marked as async.
  12. """
  13. use ExUnit.CaseTemplate
  14. using do
  15. quote do
  16. # Import conveniences for testing with connections
  17. use Phoenix.ConnTest
  18. import WebWeb.Router.Helpers
  19. # The default endpoint for testing
  20. @endpoint WebWeb.Endpoint
  21. end
  22. end
  23. setup _tags do
  24. {:ok, conn: Phoenix.ConnTest.build_conn()}
  25. end
  26. end