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 broken poll tests

If we run the mix test as it is it will fail, but that's okay as it's actually our expected behavior. As we have just added a new requirement of user_id for the creation of all polls, we should expect all of our previous poll creation logic to fail without a user ID as part of the changeset. We'll tackle the failing tests in test/vocial/votes/votes_test.exs, which will involve a lot of code-but not a lot of complicated code.

First, we need to add some code to the top of our Vocial.VotesTest module, which creates a user that we can use as the user ID value for all future polls. As mentioned in the last chapter, ExUnit provides a very simple way for us to set those features up, via the setup function. So, we'll now ...

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