December 2019
Intermediate to advanced
248 pages
5h 34m
English
We’ll focus on fixtures in this section. Recall that in our functional core, test fixtures are functions that create data so we can write repeatable tests without the extra ceremony. Our quizzes are complex, so the job of our fixtures is to focus on building data—the various structs and maps that make up our data layer—so we can keep those details out of the tests.
Recall that our quizzes have the following structure:
| | defstruct title: nil, |
| | mastery: 3, |
| | templates: %{ }, |
| | used: [ ], |
| | current_question: nil, |
| | record: %{ }, |
| | last_response: nil, |
| | mastered: [ ] |
We’ll need to set those first three fields. The rest are computed. The best way to populate the templates field is to call our add_template ...
Read now
Unlock full access