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