Skip to Main Content
Programming Phoenix
book

Programming Phoenix

by Chris McCord, Bruce Tate, Jose Valim
April 2016
Beginner to intermediate content levelBeginner to intermediate
300 pages
6h 58m
English
Pragmatic Bookshelf
Content preview from Programming Phoenix

Communicating with a Test Channel

Let’s see how easy it is to test our VideoChannel features. Our plan is simple. We’re going to set up some data to share across our tests and then sign the user in within our setup block. Then, we can write some independent tests against that live connection.

Create a new rumbrella/apps/rumbl/test/channels/video_channel_test.exs file that looks like this:

1: defmodule​ Rumbl.Channels.VideoChannelTest ​do
use​ Rumbl.ChannelCase
import​ Rumbl.TestHelpers
5:  setup ​do
user = insert_user(​name:​ ​"​​Rebecca"​)
video = insert_video(user, ​title:​ ​"​​Testing"​)
token = Phoenix.Token.sign(@endpoint, ​"​​user socket" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Elm

Programming Elm

Jeremy Fairbank
Real-Time Phoenix

Real-Time Phoenix

Stephen Bussey

Publisher Resources

ISBN: 9781680501926Errata Page