Testing our Poll schema

While it's great that we have written some code that describes our Poll object in the database, it's no good if we can't actually validate that the code does what we need it to. A good way for us to test this, since we haven't hooked anything up to our controllers yet, is to run our tests in IEx instead!

We'll need to alias a few modules first, to make our lives a little easier when we're writing our code. We’ll start off with aliasing Vocial.Votes.Poll and Vocial.Repo. The first alias gives us access to our changeset and Poll struct, whereas the second gives us access to the Repo.insert() function, which we'll use to actually get the data into the database. Next, we need to create the actual changeset, since that ...

Get Phoenix Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.