Changeset View
Changeset View
Standalone View
Standalone View
test/support/channel_case.ex
defmodule KolabChat.ChannelCase do | defmodule KolabChat.Web.ChannelCase do | ||||
@moduledoc """ | @moduledoc """ | ||||
This module defines the test case to be used by | This module defines the test case to be used by | ||||
channel tests. | channel tests. | ||||
Such tests rely on `Phoenix.ChannelTest` and also | Such tests rely on `Phoenix.ChannelTest` and also | ||||
import other functionality to make it easier | import other functionality to make it easier | ||||
to build and query models. | to build and query models. | ||||
Show All 12 Lines | quote do | ||||
alias KolabChat.Repo | alias KolabChat.Repo | ||||
import Ecto | import Ecto | ||||
import Ecto.Changeset | import Ecto.Changeset | ||||
import Ecto.Query | import Ecto.Query | ||||
# The default endpoint for testing | # The default endpoint for testing | ||||
@endpoint KolabChat.Endpoint | @endpoint KolabChat.Web.Endpoint | ||||
end | end | ||||
end | end | ||||
setup tags do | setup tags do | ||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(KolabChat.Repo) | :ok = Ecto.Adapters.SQL.Sandbox.checkout(KolabChat.Repo) | ||||
unless tags[:async] do | unless tags[:async] do | ||||
Ecto.Adapters.SQL.Sandbox.mode(KolabChat.Repo, {:shared, self()}) | Ecto.Adapters.SQL.Sandbox.mode(KolabChat.Repo, {:shared, self()}) | ||||
end | end | ||||
:ok | :ok | ||||
end | end | ||||
end | end |