January 2019
Intermediate to advanced
376 pages
8h 49m
English
Our last task before tying it all up is templating. This will be a simple section with limited tests, but we’ll still manage with properties. The requirement is straightforward. Send an email whose content is just Happy birthday, dear $first_name!. The function should take one employee term and that’s it. Since the focus is on unit tests and we won’t send actual emails, only templating needs coverage for now. Let’s start by writing a property in a standalone suite:
| | Erlang code/ResponsibleTesting/erlang/bday/test/prop_bday_mail_tpl.erl |
| | -module(prop_bday_mail_tpl). |
| | -include_lib("proper/include/proper.hrl"). |
| | |
| | prop_template_email() -> |
| | ?FORALL(Employee, employee_map(), |
| | nomatch =/= string:find(bday_mail_tpl:body(Employee), ... |
Read now
Unlock full access