Testing schema with has_many relationship

I’m looking for some examples (or better yet, guides) of testing Ecto schemas that have a has_many relationship with another schema. The examples in the Phoenix Guides either don’t cover testing, or they only cover testing simple schemas that neither reference nor are referenced by other tables, and I am not really sure how to go about writing good tests for such schemas.

Your question is a bit generic. You can start with telling us what exactly would you like to achieve and what is the trouble in doing it?

I don’t have anything specific that I want to test; I am more after general best-practice advice for testing, since I am still very new to this area.

This book should help you understand phoenix testing https://shankardevy.com/phoenix-inside-out-mpf/#chapter-3.

If you are on Linux then install phantomjs following this guide i wrote here Problem with acceptance test in hound not starting server on port 4001

2 Likes