Update your web/static/vendor/phoenix.js
to the latest client: https://github.com/phoenixframework/phoenix/blob/v0.13.1/priv/static/phoenix.js
Simply create a test/support/channel_case.ex
file and replace the following MyApp
with your application:
defmodule MyApp.ChannelCase do
@moduledoc """
This module defines the test case to be used by
channel tests.
Such tests rely on `Phoenix.ChannelTest` and also
imports other functionality to make it easier
to build and query models.
Finally, if the test case interacts with the database,
it cannot be async. For this reason, every test runs
inside a transaction which is reset at the beginning
of the test unless the test case is marked as async.
"""
use ExUnit.CaseTemplate
using do
quote do
# Import conveniences for testing with channels
use Phoenix.ChannelTest
# Alias the data repository and import query/model functions
alias MyApp.Repo
import Ecto.Model
import Ecto.Query, only: [from: 2]
# The default endpoint for testing
@endpoint MyApp.Endpoint
end
end
setup tags do
# only if using Ecto, remove otherwise
unless tags[:async] do
Ecto.Adapters.SQL.restart_test_transaction(MyApp.Repo, [])
end
:ok
end
end