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

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 ...

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