Skip to content

Instantly share code, notes, and snippets.

@goughjt
Last active December 15, 2017 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goughjt/00f1290fe39101226ea4b7195829a8cd to your computer and use it in GitHub Desktop.
Save goughjt/00f1290fe39101226ea4b7195829a8cd to your computer and use it in GitHub Desktop.
A default auto-generated room_channel_test.exs
defmodule MyAppServerWeb.RoomChannelTest do
use MyAppServerWeb.ChannelCase
alias MyAppServerWeb.RoomChannel
# if I uncomment this then alchemist-help-search-at-point does work on "socket"
# use Phoenix.ChannelTest
setup do
{:ok, _, socket} =
# alchemist-help-search-at-point does not work on "socket"
socket("user_id", %{some: :assign})
|> subscribe_and_join(RoomChannel, "room:lobby")
{:ok, socket: socket}
end
test "ping replies with status ok", %{socket: socket} do
ref = push socket, "ping", %{"hello" => "there"}
assert_reply ref, :ok, %{"hello" => "there"}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment