Extensions to Creating a Self-Updating Test

Learn how to write self-updating tests for a basic schema.

We'll cover the following

Before we write any more code, we’ll take our schema back to its previous state by removing the middle name field from the definition in the schema and from the @fields_and_types in the test file (discussed in the previous lesson).

Further refactoring

First, we’ll update the test for the cast errors. To do this, we’ll add one more helper function, similar to valid_params/1, but this time called invalid_params/1. It’ll work similarly but will return values that can’t be cast for the field’s type.

Get hands-on with 1200+ tech skills courses.