April 2018
Beginner to intermediate
406 pages
9h 33m
English
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 ...