Skip to Content
Phoenix Web Development
book

Phoenix Web Development

by Brandon Richey
April 2018
Beginner to intermediate content levelBeginner to intermediate
406 pages
9h 33m
English
Packt Publishing
Content preview from Phoenix Web Development

Fixing up our tests

We'll need to fix up our tests very quickly as well. For the most part, we can just reuse the code from the poll channel tests. We'll start off with a standard channel test skeleton. Create test/vocial_web/channels/chat_channel_test.exs and we'll start it off simply enough:

defmodule VocialWeb.ChatChannelTest do  use VocialWeb.ChannelCase  alias VocialWeb.ChatChannelend

Next, we'll add a setup block. We'll start off by creating a user and a poll to give us our baseline:

setup do    {:ok, user} = Vocial.Accounts.create_user(%{      username: "test",      email: "test@test.com",      password: "test",      password_confirmation: "test"    })    {:ok, poll} = Vocial.Votes.create_poll_with_options( %{ "title" => "My New Test Poll", "user_id" => user.id ...
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

Phoenix in Action

Phoenix in Action

Geoffrey Lessel
Real-Time Phoenix

Real-Time Phoenix

Stephen Bussey

Publisher Resources

ISBN: 9781787284197Supplemental Content